From 63b442977597bb049f4e1ec89bfb293d42324828 Mon Sep 17 00:00:00 2001 From: Harald Fernengel <harald.fernengel@here.com> Date: Wed, 22 Apr 2020 14:23:24 +0200 Subject: [PATCH 01/78] Escape clashing model names (#6004) Closes #6002 --- .../languages/TypeScriptFetchClientCodegen.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index b1ab5e4fa818..a2f03cfdd3fa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -235,9 +235,24 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o this.updateOperationParameterEnumInformation(operations); this.addOperationObjectResponseInformation(operations); this.addOperationPrefixParameterInterfacesInformation(operations); + this.escapeOperationIds(operations); return operations; } + private void escapeOperationIds(Map<String, Object> operations) { + Map<String, Object> _operations = (Map<String, Object>) operations.get("operations"); + List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation"); + for (CodegenOperation op : operationList) { + String param = op.operationIdCamelCase + "Request"; + if (op.imports.contains(param)) { + // we import a model with the same name as the generated operation, escape it + op.operationIdCamelCase += "Operation"; + op.operationIdLowerCase += "operation"; + op.operationIdSnakeCase += "_operation"; + } + } + } + private void addOperationModelImportInfomation(Map<String, Object> operations) { // This method will add extra infomation to the operations.imports array. // The api template uses this infomation to import all the required From b431d65099233e78ce19cde5f963aadc51ff2da9 Mon Sep 17 00:00:00 2001 From: Harald Fernengel <harald.fernengel@here.com> Date: Wed, 22 Apr 2020 14:24:42 +0200 Subject: [PATCH 02/78] Make "Index" a reserved word (#6000) Some APIs have a model called "Index" which would create a file "Index.ts" which would override "index.ts" on case-insensitive file systems (e.g. macOS, some Windows versions). Make "Index" a reserved word to prevent this clash. --- docs/generators/typescript-fetch.md | 1 + .../codegen/languages/TypeScriptFetchClientCodegen.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index af3dd9162686..40e7ff4eb2cc 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -76,6 +76,7 @@ sidebar_label: typescript-fetch <li>HTTPHeaders</li> <li>HTTPMethod</li> <li>HTTPQuery</li> +<li>Index</li> <li>JSONApiResponse</li> <li>Middleware</li> <li>ModelPropertyNaming</li> diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index a2f03cfdd3fa..38b3f71ac6cc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -327,6 +327,9 @@ private void addExtraReservedWords() { this.reservedWords.add("VoidApiResponse"); this.reservedWords.add("BlobApiResponse"); this.reservedWords.add("TextApiResponse"); + // "Index" would create a file "Index.ts" which on case insensitive filesystems + // would override our "index.js" file + this.reservedWords.add("Index"); } private boolean getUseSingleRequestParameter() { From 00ffcea6ef13a89d49ce3f4bb768e3a2e8df8dfb Mon Sep 17 00:00:00 2001 From: Harald Fernengel <harald.fernengel@here.com> Date: Wed, 22 Apr 2020 14:25:26 +0200 Subject: [PATCH 03/78] [typescript-fetch] Fix map API return type (#5995) Fix APIs that return a map. --- .../src/main/resources/typescript-fetch/apis.mustache | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 881f1b7ab52a..ace07d5b9626 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -290,7 +290,12 @@ export class {{classname}} extends runtime.BaseAPI { return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map({{returnBaseType}}FromJSON)); {{/isListContainer}} {{^isListContainer}} + {{#isMapContainer}} + return new runtime.JSONApiResponse(response, (jsonValue) => runtime.mapValues(jsonValue, {{returnBaseType}}FromJSON)); + {{/isMapContainer}} + {{^isMapContainer}} return new runtime.JSONApiResponse(response, (jsonValue) => {{returnBaseType}}FromJSON(jsonValue)); + {{/isMapContainer}} {{/isListContainer}} {{/returnTypeIsPrimitive}} {{/isResponseFile}} From 140f8234652671eb0f287512ddfd99b9f207f7c5 Mon Sep 17 00:00:00 2001 From: chenqping <5651810+chenqping@users.noreply.github.com> Date: Thu, 23 Apr 2020 13:31:42 +0800 Subject: [PATCH 04/78] fix generate java-inflector crash issue on windows (#6011) --- .../openapitools/codegen/languages/AbstractJavaCodegen.java | 2 +- .../openapitools/codegen/languages/GroovyClientCodegen.java | 2 +- .../openapitools/codegen/languages/JavaCXFClientCodegen.java | 2 +- .../codegen/languages/JavaInflectorServerCodegen.java | 3 ++- 4 files changed, 5 insertions(+), 4 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 5d9c5be398ec..c516814b8dfa 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 @@ -82,7 +82,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected String licenseUrl = "http://unlicense.org"; protected String projectFolder = "src/main"; protected String projectTestFolder = "src/test"; - protected String sourceFolder = projectFolder + "/java"; + protected String sourceFolder = projectFolder + File.separator +"java"; protected String testFolder = projectTestFolder + "/java"; protected boolean fullJavaUtil; protected boolean discriminatorCaseSensitive = true; // True if the discriminator value lookup should be case-sensitive. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java index 1066f2294b90..95b11793cdf5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java @@ -60,7 +60,7 @@ public GroovyClientCodegen() { languageSpecificPrimitives.add("File"); languageSpecificPrimitives.add("Map"); - sourceFolder = projectFolder + "/groovy"; + sourceFolder = projectFolder + File.separator +"groovy"; outputFolder = "generated-code/groovy"; modelTemplateFiles.put("model.mustache", ".groovy"); apiTemplateFiles.put("api.mustache", ".groovy"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java index bb206b12f663..14a83fa21e06 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaCXFClientCodegen.java @@ -54,7 +54,7 @@ public JavaCXFClientCodegen() { supportsInheritance = true; - sourceFolder = "src/gen/java"; + sourceFolder = "src"+ File.separator +"gen"+ File.separator +"java"; invokerPackage = "org.openapitools.api"; artifactId = "openapi-jaxrs-client"; dateLibrary = "legacy"; //TODO: add joda support to all jax-rs diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index 97c7bdb50b39..23036b61e7ed 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -26,6 +26,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.util.*; import static org.openapitools.codegen.utils.StringUtils.camelize; @@ -43,7 +44,7 @@ public JavaInflectorServerCodegen() { modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); - sourceFolder = "src/gen/java"; + sourceFolder = "src"+ File.separator+"gen"+ File.separator +"java"; apiTestTemplateFiles.clear(); // TODO: add test template embeddedTemplateDir = templateDir = "JavaInflector"; invokerPackage = "org.openapitools.controllers"; From c981535579332baa94ccdb1e60c408eba5c172cc Mon Sep 17 00:00:00 2001 From: "Francisco A. Lozano" <flozano@gmail.com> Date: Thu, 23 Apr 2020 17:25:35 +0200 Subject: [PATCH 05/78] Change access updateParamsForAuth to protected (#5940) So that it can be overridden with a custom behaviour. --- .../resources/Java/libraries/resttemplate/ApiClient.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache index b160b7cca231..a2e66a62b616 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache @@ -716,7 +716,7 @@ public class ApiClient { * @param queryParams The query parameters * @param headerParams The header parameters */ - private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) { + protected void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { From 4ed3421a77255e4a25fe41e60713e257e4b1d8ec Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 23 Apr 2020 23:32:47 +0800 Subject: [PATCH 06/78] update resttemplate sample --- .../src/main/java/org/openapitools/client/ApiClient.java | 2 +- .../src/main/java/org/openapitools/client/ApiClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java index 74cb86734366..cfdc5b1b8c8b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java @@ -702,7 +702,7 @@ protected RestTemplate buildRestTemplate() { * @param queryParams The query parameters * @param headerParams The header parameters */ - private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) { + protected void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java index 0be41bbbf7a2..8220b56a308f 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java @@ -689,7 +689,7 @@ protected RestTemplate buildRestTemplate() { * @param queryParams The query parameters * @param headerParams The header parameters */ - private void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) { + protected void updateParamsForAuth(String[] authNames, MultiValueMap<String, String> queryParams, HttpHeaders headerParams, MultiValueMap<String, String> cookieParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { From bafed337b51c5941802ad856c40fabc31e2f4dd2 Mon Sep 17 00:00:00 2001 From: iliaskarim <ilias.karim@icloud.com> Date: Thu, 23 Apr 2020 22:36:52 -0400 Subject: [PATCH 07/78] Fix OpenAPI link in broken Swift4/5 README templates (#6035) * Fix Swift README templates * Update Swift4/5 samples --- .../src/main/resources/swift4/README.mustache | 2 +- .../src/main/resources/swift5/README.mustache | 2 +- .../swift4/default/.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../client/petstore/swift4/default/README.md | 2 +- .../nonPublicApi/.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../petstore/swift4/nonPublicApi/README.md | 2 +- .../objcCompatible/.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../petstore/swift4/objcCompatible/README.md | 2 +- .../.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../swift4/promisekitLibrary/README.md | 2 +- .../resultLibrary/.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../petstore/swift4/resultLibrary/README.md | 2 +- .../rxswiftLibrary/.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../petstore/swift4/rxswiftLibrary/README.md | 2 +- .../unwrapRequired/.openapi-generator/VERSION | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 2 - .../petstore/swift4/unwrapRequired/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../swift5/alamofireLibrary/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../petstore/swift5/combineLibrary/README.md | 2 +- .../petstore/swift5/default/Package.swift | 4 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIHelper.swift | 17 +- .../Classes/OpenAPIs/APIs.swift | 14 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 4 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 56 +++--- .../APIs/FakeClassnameTags123API.swift | 4 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 48 +++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 26 ++- .../Classes/OpenAPIs/APIs/UserAPI.swift | 36 ++-- .../Classes/OpenAPIs/CodableHelper.swift | 2 +- .../Classes/OpenAPIs/Configuration.swift | 6 +- .../Classes/OpenAPIs/Extensions.swift | 20 +- .../Classes/OpenAPIs/JSONDataEncoding.swift | 2 +- .../Classes/OpenAPIs/JSONEncodingHelper.swift | 8 +- .../Classes/OpenAPIs/Models.swift | 7 +- .../Models/AdditionalPropertiesClass.swift | 12 +- .../Classes/OpenAPIs/Models/Animal.swift | 4 +- .../Classes/OpenAPIs/Models/AnimalFarm.swift | 1 - .../Classes/OpenAPIs/Models/ApiResponse.swift | 4 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 6 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 6 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 6 +- .../OpenAPIs/Models/Capitalization.swift | 6 +- .../Classes/OpenAPIs/Models/Cat.swift | 4 +- .../Classes/OpenAPIs/Models/CatAllOf.swift | 4 +- .../Classes/OpenAPIs/Models/Category.swift | 4 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 3 +- .../Classes/OpenAPIs/Models/Client.swift | 4 +- .../Classes/OpenAPIs/Models/Dog.swift | 4 +- .../Classes/OpenAPIs/Models/DogAllOf.swift | 4 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 6 +- .../Classes/OpenAPIs/Models/EnumClass.swift | 1 - .../Classes/OpenAPIs/Models/EnumTest.swift | 6 +- .../Classes/OpenAPIs/Models/File.swift | 3 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 4 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 4 +- .../Classes/OpenAPIs/Models/List.swift | 6 +- .../Classes/OpenAPIs/Models/MapTest.swift | 14 +- ...opertiesAndAdditionalPropertiesClass.swift | 8 +- .../OpenAPIs/Models/Model200Response.swift | 5 +- .../Classes/OpenAPIs/Models/Name.swift | 5 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 6 +- .../Classes/OpenAPIs/Models/Order.swift | 4 +- .../OpenAPIs/Models/OuterComposite.swift | 6 +- .../Classes/OpenAPIs/Models/OuterEnum.swift | 1 - .../Classes/OpenAPIs/Models/Pet.swift | 4 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 4 +- .../Classes/OpenAPIs/Models/Return.swift | 5 +- .../OpenAPIs/Models/SpecialModelName.swift | 6 +- .../OpenAPIs/Models/StringBooleanMap.swift | 8 +- .../Classes/OpenAPIs/Models/Tag.swift | 4 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 6 +- .../OpenAPIs/Models/TypeHolderExample.swift | 6 +- .../Classes/OpenAPIs/Models/User.swift | 4 +- .../OpenAPIs/URLSessionImplementations.swift | 178 +++++++++--------- .../client/petstore/swift5/default/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../petstore/swift5/nonPublicApi/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../petstore/swift5/objcCompatible/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../swift5/promisekitLibrary/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 24 +-- .../APIs/FakeClassnameTags123API.swift | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 +- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 8 +- .../Classes/OpenAPIs/APIs/UserAPI.swift | 16 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../petstore/swift5/resultLibrary/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../petstore/swift5/rxswiftLibrary/README.md | 2 +- .../PetstoreClient.xcodeproj/project.pbxproj | 5 +- .../contents.xcworkspacedata | 2 +- .../xcschemes/PetstoreClient.xcscheme | 6 + .../Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 6 +- .../swift5/urlsessionLibrary/README.md | 2 +- 144 files changed, 474 insertions(+), 533 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift4/README.mustache b/modules/openapi-generator/src/main/resources/swift4/README.mustache index da90d5e1b448..c62117517e47 100644 --- a/modules/openapi-generator/src/main/resources/swift4/README.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/README.mustache @@ -5,7 +5,7 @@ {{/appDescriptionWithNewLines}} ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: {{appVersion}} - Package version: {{packageVersion}} diff --git a/modules/openapi-generator/src/main/resources/swift5/README.mustache b/modules/openapi-generator/src/main/resources/swift5/README.mustache index 6ee7cf37afe9..3e3ff43b9f7b 100644 --- a/modules/openapi-generator/src/main/resources/swift5/README.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/README.mustache @@ -5,7 +5,7 @@ {{/appDescriptionWithNewLines}} ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: {{appVersion}} - Package version: {{packageVersion}} diff --git a/samples/client/petstore/swift4/default/.openapi-generator/VERSION b/samples/client/petstore/swift4/default/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/default/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/default/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/default/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/default/PetstoreClient.xcodeproj/project.pbxproj index 94b4f451305e..b606fe1ab100 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/default/PetstoreClient.xcodeproj/project.pbxproj @@ -299,8 +299,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/default/README.md b/samples/client/petstore/swift4/default/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/default/README.md +++ b/samples/client/petstore/swift4/default/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION b/samples/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/nonPublicApi/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj index 94b4f451305e..b606fe1ab100 100644 --- a/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj @@ -299,8 +299,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/nonPublicApi/README.md b/samples/client/petstore/swift4/nonPublicApi/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/nonPublicApi/README.md +++ b/samples/client/petstore/swift4/nonPublicApi/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION b/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj index 94b4f451305e..b606fe1ab100 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj @@ -299,8 +299,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/objcCompatible/README.md b/samples/client/petstore/swift4/objcCompatible/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/objcCompatible/README.md +++ b/samples/client/petstore/swift4/objcCompatible/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift4/promisekitLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift4/promisekitLibrary/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/promisekitLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj index 6b9213511f8a..c2e04850669d 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -303,8 +303,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/promisekitLibrary/README.md b/samples/client/petstore/swift4/promisekitLibrary/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/promisekitLibrary/README.md +++ b/samples/client/petstore/swift4/promisekitLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/resultLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj index e8707f0ff9b1..49e6ca81fd81 100644 --- a/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -302,8 +302,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/resultLibrary/README.md b/samples/client/petstore/swift4/resultLibrary/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/resultLibrary/README.md +++ b/samples/client/petstore/swift4/resultLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift4/rxswiftLibrary/.openapi-generator/VERSION b/samples/client/petstore/swift4/rxswiftLibrary/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/rxswiftLibrary/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj index c749d2778db9..43e65668d5ae 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -303,8 +303,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/rxswiftLibrary/README.md b/samples/client/petstore/swift4/rxswiftLibrary/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift4/rxswiftLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION b/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION index bfbf77eb7fad..b5d898602c2c 100644 --- a/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.0-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.xcodeproj/project.pbxproj index 94b4f451305e..b606fe1ab100 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.xcodeproj/project.pbxproj @@ -299,8 +299,6 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; diff --git a/samples/client/petstore/swift4/unwrapRequired/README.md b/samples/client/petstore/swift4/unwrapRequired/README.md index e00b3c99d2ae..bd093317bd7a 100644 --- a/samples/client/petstore/swift4/unwrapRequired/README.md +++ b/samples/client/petstore/swift4/unwrapRequired/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.pbxproj index a03104894c7c..5a3cb5019cc4 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -305,14 +305,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -568,7 +567,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index df7fa3936700..224d1fc911b6 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -41,7 +41,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } diff --git a/samples/client/petstore/swift5/alamofireLibrary/README.md b/samples/client/petstore/swift5/alamofireLibrary/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/README.md +++ b/samples/client/petstore/swift5/alamofireLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.pbxproj index 0e4ec79d9849..6f8918eb338e 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -265,14 +265,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -520,7 +519,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index e4cbda9c725d..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 ad5f58eea436..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/combineLibrary/README.md b/samples/client/petstore/swift5/combineLibrary/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/combineLibrary/README.md +++ b/samples/client/petstore/swift5/combineLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/default/Package.swift b/samples/client/petstore/swift5/default/Package.swift index 79f6f8188738..96dfff54edf4 100644 --- a/samples/client/petstore/swift5/default/Package.swift +++ b/samples/client/petstore/swift5/default/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.pbxproj index 0e4ec79d9849..6f8918eb338e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.pbxproj @@ -265,14 +265,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -520,7 +519,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/default/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index d94614b34fc7..200070096800 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") result.append(URLQueryItem(name: item.key, value: value)) } else if let value = item.value { @@ -68,4 +68,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df3..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bb3ae7178254..5bbf323f820c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1d81faa335c..134d6aea416a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -16,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d21c4a49d43d..48cfe7187b9a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 496da91171ac..0552d4a6c16e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -156,7 +154,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -180,8 +178,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -199,7 +197,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -226,8 +224,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -242,7 +240,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -283,7 +281,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -311,14 +309,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -335,7 +333,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -363,14 +361,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -387,7 +385,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -415,14 +413,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3848eda85ad6..a8a83eda39a4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 546166841d9e..505ed1b0c5c9 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e4394..627d9adb757e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff..b79e9f5e64d5 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b..02f78ffb4705 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift index 290c7f35e478..b0bfb1159760 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889..1af031535967 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9d..5ed9f31e2a36 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed2..e09b0e9efdc8 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45..ec270da89074 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394ba..6c252ed475b2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43..e84eb5d65025 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99..d2140933d181 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a59045..d1b3b27616ed 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488ca..7ab887f3113f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80..a51ad0dffab1 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d..eb8f7e5e1974 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd626..e2a7d4427a06 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4..00245ca37280 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6..492c1228008e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23f..7786f8acc5ae 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b..9844e7c40e35 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246..d4029d73f8af 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b..789f583e1d77 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb76..abf3ccffc485 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3..532f1457939a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb178..20bd6d103b3d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0..906ddb06fb17 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f2..fe13d302ccbf 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7a..4b6037f378ee 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b587..c3deb2f28932 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca..b61db7d6e716 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd731..8ab4db44b73a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4..4d1dafcc2c1f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e..40c30cc8609c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d22710441..18c3a024f122 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874..c3b778cbbed4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c96..b9ce0e933256 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a6..0acd21fd1000 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4..c223f993a69e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520..6e8650f76d8e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e..3f1237fee477 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf7..4dd8a9a9f5a0 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02..a9e088808ed3 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e..dff4083ae432 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e59..79f271ed7356 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 5700bb62c0ec..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,18 +23,18 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + let progress = Progress() - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -47,11 +47,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -79,40 +79,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -121,29 +121,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + 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 } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -159,18 +159,18 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in self.progress.totalUnitCount = newProgress.totalUnitCount self.progress.completedUnitCount = newProgress.completedUnitCount } - + onProgressReady?(progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -179,7 +179,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -199,52 +199,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -258,7 +258,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -277,7 +277,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -286,7 +286,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -300,7 +300,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -311,7 +311,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -331,28 +331,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -363,10 +363,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -409,13 +409,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -424,12 +424,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -440,13 +440,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -486,9 +486,9 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty - + body.append("--\(boundary)--") urlRequest.httpBody = body @@ -501,13 +501,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) let fileName = fileURL.lastPathComponent - + body.append("--\(boundary)\r\n") body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") @@ -516,25 +516,25 @@ fileprivate class FileUploadEncoding: ParameterEncoding { body.append(fileData) body.append("\r\n\r\n") - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty - + body.append("--\(boundary)\r\n") body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") body.append(data) - + body.append("\r\n\r\n") - + urlRequest.httpBody = body return urlRequest diff --git a/samples/client/petstore/swift5/default/README.md b/samples/client/petstore/swift5/default/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/default/README.md +++ b/samples/client/petstore/swift5/default/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj index 0e4ec79d9849..6f8918eb338e 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.pbxproj @@ -265,14 +265,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -520,7 +519,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift index 743d9aa443a1..5dfbd9cea8d9 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ internal class RequestBuilder<T> { } } - internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } internal func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index f14bd48aced6..280238b8263d 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ internal class CodableHelper { set { self.customJSONEncoder = newValue } } - internal class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + internal class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - internal class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + internal class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 b8cfe114dc55..ae2e1d0b86ea 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override internal func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ internal class URLSessionRequestBuilder<T>: RequestBuilder<T> { } internal class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/nonPublicApi/README.md b/samples/client/petstore/swift5/nonPublicApi/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/nonPublicApi/README.md +++ b/samples/client/petstore/swift5/nonPublicApi/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj index 0e4ec79d9849..6f8918eb338e 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.pbxproj @@ -265,14 +265,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -520,7 +519,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift index e4cbda9c725d..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 ad5f58eea436..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/objcCompatible/README.md b/samples/client/petstore/swift5/objcCompatible/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/objcCompatible/README.md +++ b/samples/client/petstore/swift5/objcCompatible/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj index 7664d648f4f5..31525ebfdc62 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -305,14 +305,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -568,7 +567,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index e4cbda9c725d..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 ad5f58eea436..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/promisekitLibrary/README.md b/samples/client/petstore/swift5/promisekitLibrary/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/README.md +++ b/samples/client/petstore/swift5/promisekitLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj index 0e4ec79d9849..6f8918eb338e 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -265,14 +265,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -520,7 +519,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index e4cbda9c725d..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 869f1ccd251a..001f71608114 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -15,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Client, Error>) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Client, Error>) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 2764fb314ab0..1289d6e2a94a 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -14,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Bool, Error>) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Bool, Error>) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -49,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<OuterComposite, Error>) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<OuterComposite, Error>) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -84,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Double, Error>) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Double, Error>) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<String, Error>) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<String, Error>) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -154,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -190,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -229,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Client, Error>) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Client, Error>) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -279,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - 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, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + 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, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -424,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - 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, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + 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, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -490,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -543,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -580,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 5f21b82aa35a..f54d6e7fcf02 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -15,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Client, Error>) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Client, Error>) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index a9c5c89eb1c6..c18155611399 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -15,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -55,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -111,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<[Pet], Error>) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[Pet], Error>) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -154,7 +154,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<[Pet], Error>) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[Pet], Error>) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -197,7 +197,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Pet, Error>) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Pet, Error>) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -240,7 +240,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -281,7 +281,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -333,7 +333,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<ApiResponse, Error>) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<ApiResponse, Error>) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -385,7 +385,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<ApiResponse, Error>) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<ApiResponse, Error>) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index f67d192fa914..5024c9dc8f63 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -15,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<[String: Int], Error>) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<[String: Int], Error>) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -93,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Order, Error>) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Order, Error>) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -133,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Order, Error>) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Order, Error>) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 930d55d9428e..c96c572b50c0 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -15,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -52,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -88,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -124,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -164,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<User, Error>) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<User, Error>) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -204,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<String, Error>) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<String, Error>) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -245,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -281,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the result */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Result<Void, Error>) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result<Void, Error>) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 ad5f58eea436..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/resultLibrary/README.md b/samples/client/petstore/swift5/resultLibrary/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/resultLibrary/README.md +++ b/samples/client/petstore/swift5/resultLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj index a039b69cf53f..8efc1d35ec6e 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -305,14 +305,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -568,7 +567,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index e4cbda9c725d..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 ad5f58eea436..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/rxswiftLibrary/README.md b/samples/client/petstore/swift5/rxswiftLibrary/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.pbxproj index 0e4ec79d9849..6f8918eb338e 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.pbxproj @@ -265,14 +265,13 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - TargetAttributes = { - }; }; buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( + Base, en, ); mainGroup = 5FBA6AE5F64CD737F88B4565; @@ -520,7 +519,7 @@ 3B2C02AFB91CB5C82766ED5C /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; + defaultConfigurationName = ""; }; ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { isa = XCConfigurationList; diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 59618cad9c0b..919434a6254f 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:PetstoreClient.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme index ce431fd1d1dd..26d510552bb0 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -41,6 +41,10 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> </TestAction> <LaunchAction buildConfiguration = "Debug" @@ -63,6 +67,8 @@ </MacroExpansion> <CommandLineArguments> </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift index e4cbda9c725d..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } 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 ad5f58eea436..a31860adfdeb 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) diff --git a/samples/client/petstore/swift5/urlsessionLibrary/README.md b/samples/client/petstore/swift5/urlsessionLibrary/README.md index 4829f29f6afe..1725415f7e04 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/README.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/README.md @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0.0 - Package version: From 3db7f65e3e2cb81f08c97f5d5beb2c0e8e10fc69 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 24 Apr 2020 10:56:12 +0800 Subject: [PATCH 08/78] Add a link to the blog post in Nordic APIs (#6038) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ec9b3822b97b..1fa10dd45ee7 100644 --- a/README.md +++ b/README.md @@ -749,6 +749,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2020-03-10 - [OpenAPI Generator Meetup #1](https://speakerdeck.com/akihito_nakano/openapi-generator-meetup-number-1) by [中野暁人](https://github.com/ackintosh) at [OpenAPI Generator Meetup #1](https://openapi-generator-meetup.connpass.com/event/168187/) - 2020-03-15 - [Load Testing Your API with Swagger/OpenAPI and k6](https://k6.io/blog/load-testing-your-api-with-swagger-openapi-and-k6) - 2020-04-13 - [俺的【OAS】との向き合い方 (爆速でOpenAPIと友達になろう)](https://tech-blog.optim.co.jp/entry/2020/04/13/100000) in [OPTim Blog](https://tech-blog.optim.co.jp/) +- 2020-04-22 - [Introduction to OpenAPI Generator](https://nordicapis.com/introduction-to-openapi-generator/) by [Kristopher Sandoval](https://nordicapis.com/author/sandovaleffect/) in [Nordic APIs](https://nordicapis.com/) ## [6 - About Us](#table-of-contents) From 93dd4a5138178526f8fbf94b670b4d2d0d3835a6 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 24 Apr 2020 12:47:25 +0800 Subject: [PATCH 09/78] Add jersey2-experimental to Java client generator (#6024) * add jersey2 experimental * add new files * add abstract one of class * read the stream multiple times * rename to getActualInstance * update petstore * fix jackon check * test new java petstore in ci * fix broken tests * remove todo * better exception message, primitive type handling * add anyof support * update samples * add new files * update all java client samples * update doc, fix pom * better null check for allOf * add primitive types support in oneof, anyof * better validation * update python exp samples * remove primitive type support in allOf --- bin/java-petstore-jersey2-experimental.json | 4 + bin/java-petstore-jersey2-experimental.sh | 48 + docs/generators/java.md | 2 +- .../openapitools/codegen/DefaultCodegen.java | 38 +- .../codegen/languages/JavaClientCodegen.java | 52 +- .../src/main/resources/Java/api_test.mustache | 22 +- .../AbstractOpenApiSchema.mustache | 30 + .../jersey2-experimental/ApiClient.mustache | 1072 ++++++++ .../jersey2-experimental/ApiResponse.mustache | 58 + .../jersey2-experimental/JSON.mustache | 65 + .../jersey2-experimental/anyof_model.mustache | 28 + .../jersey2-experimental/api.mustache | 244 ++ .../apiException.mustache | 96 + .../jersey2-experimental/api_doc.mustache | 121 + .../jersey2-experimental/api_test.mustache | 51 + .../build.gradle.mustache | 170 ++ .../jersey2-experimental/build.sbt.mustache | 38 + .../jersey2-experimental/model.mustache | 47 + .../jersey2-experimental/oneof_model.mustache | 45 + .../jersey2-experimental/pojo.mustache | 369 +++ .../jersey2-experimental/pom.mustache | 372 +++ .../Java/libraries/jersey2/pom.mustache | 2 +- .../codegen/DefaultCodegenTest.java | 6 +- pom.xml | 2 + .../java/jersey2-experimental/.gitignore | 21 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/VERSION | 1 + .../java/jersey2-experimental/.travis.yml | 22 + .../java/jersey2-experimental/README.md | 238 ++ .../jersey2-experimental/api/openapi.yaml | 2183 +++++++++++++++++ .../java/jersey2-experimental/build.gradle | 123 + .../java/jersey2-experimental/build.sbt | 24 + .../docs/AdditionalPropertiesAnyType.md | 12 + .../docs/AdditionalPropertiesArray.md | 12 + .../docs/AdditionalPropertiesBoolean.md | 12 + .../docs/AdditionalPropertiesClass.md | 22 + .../docs/AdditionalPropertiesInteger.md | 12 + .../docs/AdditionalPropertiesNumber.md | 12 + .../docs/AdditionalPropertiesObject.md | 12 + .../docs/AdditionalPropertiesString.md | 12 + .../java/jersey2-experimental/docs/Animal.md | 13 + .../docs/AnotherFakeApi.md | 74 + .../docs/ArrayOfArrayOfNumberOnly.md | 12 + .../docs/ArrayOfNumberOnly.md | 12 + .../jersey2-experimental/docs/ArrayTest.md | 14 + .../java/jersey2-experimental/docs/BigCat.md | 23 + .../jersey2-experimental/docs/BigCatAllOf.md | 23 + .../docs/Capitalization.md | 17 + .../java/jersey2-experimental/docs/Cat.md | 12 + .../jersey2-experimental/docs/CatAllOf.md | 12 + .../jersey2-experimental/docs/Category.md | 13 + .../jersey2-experimental/docs/ClassModel.md | 13 + .../java/jersey2-experimental/docs/Client.md | 12 + .../java/jersey2-experimental/docs/Dog.md | 12 + .../jersey2-experimental/docs/DogAllOf.md | 12 + .../jersey2-experimental/docs/EnumArrays.md | 31 + .../jersey2-experimental/docs/EnumClass.md | 15 + .../jersey2-experimental/docs/EnumTest.md | 54 + .../java/jersey2-experimental/docs/FakeApi.md | 997 ++++++++ .../docs/FakeClassnameTags123Api.md | 81 + .../docs/FileSchemaTestClass.md | 13 + .../jersey2-experimental/docs/FormatTest.md | 25 + .../docs/HasOnlyReadOnly.md | 13 + .../java/jersey2-experimental/docs/MapTest.md | 24 + ...dPropertiesAndAdditionalPropertiesClass.md | 14 + .../docs/Model200Response.md | 14 + .../docs/ModelApiResponse.md | 14 + .../jersey2-experimental/docs/ModelReturn.md | 13 + .../java/jersey2-experimental/docs/Name.md | 16 + .../jersey2-experimental/docs/NumberOnly.md | 12 + .../java/jersey2-experimental/docs/Order.md | 27 + .../docs/OuterComposite.md | 14 + .../jersey2-experimental/docs/OuterEnum.md | 15 + .../java/jersey2-experimental/docs/Pet.md | 27 + .../java/jersey2-experimental/docs/PetApi.md | 656 +++++ .../docs/ReadOnlyFirst.md | 13 + .../docs/SpecialModelName.md | 12 + .../jersey2-experimental/docs/StoreApi.md | 276 +++ .../java/jersey2-experimental/docs/Tag.md | 13 + .../docs/TypeHolderDefault.md | 16 + .../docs/TypeHolderExample.md | 17 + .../java/jersey2-experimental/docs/User.md | 19 + .../java/jersey2-experimental/docs/UserApi.md | 525 ++++ .../java/jersey2-experimental/docs/XmlItem.md | 40 + .../java/jersey2-experimental/git_push.sh | 58 + .../jersey2-experimental/gradle.properties | 2 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 58702 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + .../java/jersey2-experimental/gradlew | 183 ++ .../java/jersey2-experimental/gradlew.bat | 100 + .../java/jersey2-experimental/pom.xml | 293 +++ .../java/jersey2-experimental/settings.gradle | 1 + .../src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 995 ++++++++ .../org/openapitools/client/ApiException.java | 91 + .../org/openapitools/client/ApiResponse.java | 59 + .../openapitools/client/Configuration.java | 39 + .../client/CustomInstantDeserializer.java | 232 ++ .../java/org/openapitools/client/JSON.java | 47 + .../java/org/openapitools/client/Pair.java | 61 + .../client/RFC3339DateFormat.java | 32 + .../client/ServerConfiguration.java | 58 + .../openapitools/client/ServerVariable.java | 23 + .../org/openapitools/client/StringUtil.java | 61 + .../client/api/AnotherFakeApi.java | 104 + .../org/openapitools/client/api/FakeApi.java | 1198 +++++++++ .../client/api/FakeClassnameTags123Api.java | 104 + .../org/openapitools/client/api/PetApi.java | 692 ++++++ .../org/openapitools/client/api/StoreApi.java | 305 +++ .../org/openapitools/client/api/UserApi.java | 577 +++++ .../openapitools/client/auth/ApiKeyAuth.java | 77 + .../client/auth/Authentication.java | 30 + .../client/auth/HttpBasicAuth.java | 58 + .../client/auth/HttpBearerAuth.java | 60 + .../org/openapitools/client/auth/OAuth.java | 39 + .../openapitools/client/auth/OAuthFlow.java | 18 + .../client/model/AbstractOpenApiSchema.java | 41 + .../model/AdditionalPropertiesAnyType.java | 106 + .../model/AdditionalPropertiesArray.java | 107 + .../model/AdditionalPropertiesBoolean.java | 106 + .../model/AdditionalPropertiesClass.java | 480 ++++ .../model/AdditionalPropertiesInteger.java | 106 + .../model/AdditionalPropertiesNumber.java | 107 + .../model/AdditionalPropertiesObject.java | 106 + .../model/AdditionalPropertiesString.java | 106 + .../org/openapitools/client/model/Animal.java | 141 ++ .../model/ArrayOfArrayOfNumberOnly.java | 113 + .../client/model/ArrayOfNumberOnly.java | 113 + .../openapitools/client/model/ArrayTest.java | 191 ++ .../org/openapitools/client/model/BigCat.java | 145 ++ .../client/model/BigCatAllOf.java | 141 ++ .../client/model/Capitalization.java | 257 ++ .../org/openapitools/client/model/Cat.java | 106 + .../openapitools/client/model/CatAllOf.java | 102 + .../openapitools/client/model/Category.java | 132 + .../openapitools/client/model/ClassModel.java | 103 + .../org/openapitools/client/model/Client.java | 102 + .../org/openapitools/client/model/Dog.java | 106 + .../openapitools/client/model/DogAllOf.java | 102 + .../openapitools/client/model/EnumArrays.java | 213 ++ .../openapitools/client/model/EnumClass.java | 60 + .../openapitools/client/model/EnumTest.java | 370 +++ .../client/model/FileSchemaTestClass.java | 143 ++ .../openapitools/client/model/FormatTest.java | 516 ++++ .../client/model/HasOnlyReadOnly.java | 115 + .../openapitools/client/model/MapTest.java | 265 ++ ...ropertiesAndAdditionalPropertiesClass.java | 178 ++ .../client/model/Model200Response.java | 134 + .../client/model/ModelApiResponse.java | 164 ++ .../client/model/ModelReturn.java | 103 + .../org/openapitools/client/model/Name.java | 177 ++ .../openapitools/client/model/NumberOnly.java | 103 + .../org/openapitools/client/model/Order.java | 295 +++ .../client/model/OuterComposite.java | 165 ++ .../openapitools/client/model/OuterEnum.java | 60 + .../org/openapitools/client/model/Pet.java | 309 +++ .../client/model/ReadOnlyFirst.java | 124 + .../client/model/SpecialModelName.java | 102 + .../org/openapitools/client/model/Tag.java | 133 + .../client/model/TypeHolderDefault.java | 229 ++ .../client/model/TypeHolderExample.java | 259 ++ .../org/openapitools/client/model/User.java | 319 +++ .../openapitools/client/model/XmlItem.java | 1045 ++++++++ .../client/api/AnotherFakeApiTest.java | 50 + .../openapitools/client/api/FakeApiTest.java | 291 +++ .../api/FakeClassnameTags123ApiTest.java | 50 + .../openapitools/client/api/PetApiTest.java | 179 ++ .../openapitools/client/api/StoreApiTest.java | 94 + .../openapitools/client/api/UserApiTest.java | 156 ++ .../AdditionalPropertiesAnyTypeTest.java | 51 + .../model/AdditionalPropertiesArrayTest.java | 52 + .../AdditionalPropertiesBooleanTest.java | 51 + .../model/AdditionalPropertiesClassTest.java | 133 + .../AdditionalPropertiesIntegerTest.java | 51 + .../model/AdditionalPropertiesNumberTest.java | 52 + .../model/AdditionalPropertiesObjectTest.java | 51 + .../model/AdditionalPropertiesStringTest.java | 51 + .../openapitools/client/model/AnimalTest.java | 59 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 52 + .../client/model/ArrayOfNumberOnlyTest.java | 52 + .../client/model/ArrayTestTest.java | 68 + .../client/model/BigCatAllOfTest.java | 49 + .../openapitools/client/model/BigCatTest.java | 75 + .../client/model/CapitalizationTest.java | 89 + .../client/model/CatAllOfTest.java | 49 + .../openapitools/client/model/CatTest.java | 67 + .../client/model/CategoryTest.java | 57 + .../client/model/ClassModelTest.java | 49 + .../openapitools/client/model/ClientTest.java | 49 + .../client/model/DogAllOfTest.java | 49 + .../openapitools/client/model/DogTest.java | 67 + .../client/model/EnumArraysTest.java | 59 + .../client/model/EnumClassTest.java | 33 + .../client/model/EnumTestTest.java | 82 + .../client/model/FileSchemaTestClassTest.java | 59 + .../client/model/FormatTestTest.java | 158 ++ .../client/model/HasOnlyReadOnlyTest.java | 57 + .../client/model/MapTestTest.java | 76 + ...rtiesAndAdditionalPropertiesClassTest.java | 71 + .../client/model/Model200ResponseTest.java | 57 + .../client/model/ModelApiResponseTest.java | 65 + .../client/model/ModelReturnTest.java | 49 + .../openapitools/client/model/NameTest.java | 73 + .../client/model/NumberOnlyTest.java | 50 + .../openapitools/client/model/OrderTest.java | 90 + .../client/model/OuterCompositeTest.java | 66 + .../client/model/OuterEnumTest.java | 33 + .../openapitools/client/model/PetTest.java | 93 + .../client/model/ReadOnlyFirstTest.java | 57 + .../client/model/SpecialModelNameTest.java | 49 + .../openapitools/client/model/TagTest.java | 57 + .../client/model/TypeHolderDefaultTest.java | 84 + .../client/model/TypeHolderExampleTest.java | 92 + .../openapitools/client/model/UserTest.java | 105 + .../client/model/XmlItemTest.java | 276 +++ .../petstore/java/jersey2-java6/pom.xml | 2 +- .../petstore/java/jersey2-java8/pom.xml | 2 +- samples/client/petstore/java/jersey2/pom.xml | 2 +- .../go-petstore/api/openapi.yaml | 6 +- 219 files changed, 27324 insertions(+), 30 deletions(-) create mode 100644 bin/java-petstore-jersey2-experimental.json create mode 100755 bin/java-petstore-jersey2-experimental.sh create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_doc.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.gradle.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.sbt.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pojo.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache create mode 100644 samples/client/petstore/java/jersey2-experimental/.gitignore create mode 100644 samples/client/petstore/java/jersey2-experimental/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/jersey2-experimental/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/jersey2-experimental/.travis.yml create mode 100644 samples/client/petstore/java/jersey2-experimental/README.md create mode 100644 samples/client/petstore/java/jersey2-experimental/api/openapi.yaml create mode 100644 samples/client/petstore/java/jersey2-experimental/build.gradle create mode 100644 samples/client/petstore/java/jersey2-experimental/build.sbt create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesArray.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesBoolean.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesInteger.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesNumber.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesObject.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesString.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Animal.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/BigCat.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/BigCatAllOf.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Capitalization.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Cat.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/CatAllOf.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Category.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ClassModel.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Client.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Dog.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/DogAllOf.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/EnumClass.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/MapTest.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Model200Response.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Name.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Order.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Pet.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/PetApi.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Tag.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/TypeHolderDefault.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/TypeHolderExample.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/User.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/UserApi.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/XmlItem.md create mode 100644 samples/client/petstore/java/jersey2-experimental/git_push.sh create mode 100644 samples/client/petstore/java/jersey2-experimental/gradle.properties create mode 100644 samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/jersey2-experimental/gradlew create mode 100644 samples/client/petstore/java/jersey2-experimental/gradlew.bat create mode 100644 samples/client/petstore/java/jersey2-experimental/pom.xml create mode 100644 samples/client/petstore/java/jersey2-experimental/settings.gradle create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/bin/java-petstore-jersey2-experimental.json b/bin/java-petstore-jersey2-experimental.json new file mode 100644 index 000000000000..156775302d4c --- /dev/null +++ b/bin/java-petstore-jersey2-experimental.json @@ -0,0 +1,4 @@ +{ + "library": "jersey2-experimental", + "artifactId": "petstore-jersey2-exp" +} diff --git a/bin/java-petstore-jersey2-experimental.sh b/bin/java-petstore-jersey2-experimental.sh new file mode 100755 index 000000000000..a4ab8a13a843 --- /dev/null +++ b/bin/java-petstore-jersey2-experimental.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2-experimental.json -o samples/client/petstore/java/jersey2-experimental -t modules/openapi-generator/src/main/resources/Java --additional-properties hideGenerationTimestamp=true $@" + +echo "Removing files and folders under samples/client/petstore/java/jersey2-experimental/src/main" +rm -rf samples/client/petstore/java/jersey2-experimental/src/main +find samples/client/petstore/java/jersey2-experimental -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags + +# copy additional manually written unit-tests +#mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client +#mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth +#mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model + +#cp CI/samples.ci/client/petstore/java/test-manual/common/StringUtilTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/StringUtilTest.java +#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/ApiClientTest.java +#cp CI/samples.ci/client/petstore/java/test-manual/common/ConfigurationTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/ConfigurationTest.java +#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/auth/ApiKeyAuthTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth/ApiKeyAuthTest.java +#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/auth/HttpBasicAuthTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth/HttpBasicAuthTest.java +#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/model/EnumValueTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/EnumValueTest.java +#cp CI/samples.ci/client/petstore/java/test-manual/jersey2/JSONTest.java samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/JSONTest.java diff --git a/docs/generators/java.md b/docs/generators/java.md index 8789be83d742..8cdcd9dc4e3d 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -29,7 +29,7 @@ sidebar_label: java |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.client| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>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.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[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'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| +|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>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.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey2-experimental**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[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'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.client.model| 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 f0906626eea7..6f5990074ce4 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 @@ -1846,8 +1846,8 @@ public String toAnyOfName(List<String> names, ComposedSchema composedSchema) { @SuppressWarnings("static-method") public String toOneOfName(List<String> names, ComposedSchema composedSchema) { Map<String, Object> exts = composedSchema.getExtensions(); - if (exts != null && exts.containsKey("x-oneOf-name")) { - return (String) exts.get("x-oneOf-name"); + if (exts != null && exts.containsKey("x-one-of-name")) { + return (String) exts.get("x-one-of-name"); } return "oneOf<" + String.join(",", names) + ">"; } @@ -2190,9 +2190,33 @@ public CodegenModel fromModel(String name, Schema schema) { m.interfaces = new ArrayList<String>(); for (Schema interfaceSchema : interfaces) { + interfaceSchema = ModelUtils.unaliasSchema(this.openAPI, interfaceSchema, importMapping); + if (StringUtils.isBlank(interfaceSchema.get$ref())) { + // primitive type + String languageType = getTypeDeclaration(interfaceSchema); + + if (composed.getAnyOf() != null) { + if (m.anyOf.contains(languageType)) { + LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); + } else { + m.anyOf.add(languageType); + } + } else if (composed.getOneOf() != null) { + if (m.oneOf.contains(languageType)) { + LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); + } else { + m.oneOf.add(languageType); + } + } else if (composed.getAllOf() != null) { + // no need to add primitive type to allOf, which should comprise of schemas (models) only + } else { + LOGGER.error("Composed schema has incorrect anyOf, allOf, oneOf defined: {}", composed); + } continue; } + + // the rest of the section is for model Schema refSchema = null; String ref = ModelUtils.getSimpleRef(interfaceSchema.get$ref()); if (allDefinitions != null) { @@ -2393,8 +2417,10 @@ protected void addProperties(Map<String, Schema> properties, List<String> requir if (schema instanceof ComposedSchema) { ComposedSchema composedSchema = (ComposedSchema) schema; - for (Schema component : composedSchema.getAllOf()) { - addProperties(properties, required, component); + if (composedSchema.getAllOf() != null) { + for (Schema component : composedSchema.getAllOf()) { + addProperties(properties, required, component); + } } if (schema.getRequired() != null) { @@ -5788,14 +5814,14 @@ public void setRemoveEnumValuePrefix(final boolean removeEnumValuePrefix) { //// Following methods are related to the "useOneOfInterfaces" feature /** - * Add "x-oneOf-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements) + * Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements) * * @param s schema to add the extension to * @param name name of the parent oneOf schema */ public void addOneOfNameExtension(ComposedSchema s, String name) { if (s.getOneOf() != null && s.getOneOf().size() > 0) { - s.addExtension("x-oneOf-name", name); + s.addExtension("x-one-of-name", name); } } 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 58134a28b1ef..5caf5c0b679f 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 @@ -71,6 +71,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String GOOGLE_API_CLIENT = "google-api-client"; public static final String JERSEY1 = "jersey1"; public static final String JERSEY2 = "jersey2"; + public static final String JERSEY2_EXPERIMENTAL = "jersey2-experimental"; public static final String NATIVE = "native"; public static final String OKHTTP_GSON = "okhttp-gson"; public static final String RESTEASY = "resteasy"; @@ -144,6 +145,7 @@ public JavaClientCodegen() { 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(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); + supportedLibraries.put(JERSEY2_EXPERIMENTAL, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). 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'."); supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead."); @@ -367,9 +369,12 @@ public void processOpts() { if ("retrofit2".equals(getLibrary()) && !usePlayWS) { supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); } - } else if (JERSEY2.equals(getLibrary())) { + } else if (JERSEY2.equals(getLibrary()) || JERSEY2_EXPERIMENTAL.equals(getLibrary())) { supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); + if (JERSEY2_EXPERIMENTAL.equals(getLibrary())) { + supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar), "AbstractOpenApiSchema.java")); + } forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); } else if (NATIVE.equals(getLibrary())) { setJava8Mode(true); @@ -499,7 +504,7 @@ public void processOpts() { additionalProperties.remove(SERIALIZATION_LIBRARY_GSON); } - if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON)) { + if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON) && !JERSEY2_EXPERIMENTAL.equals(getLibrary())) { useOneOfInterfaces = true; addOneOfInterfaceImports = true; } @@ -595,6 +600,39 @@ public int compare(CodegenParameter one, CodegenParameter another) { objs = AbstractJavaJAXRSServerCodegen.jaxrsPostProcessOperations(objs); } + if (JERSEY2_EXPERIMENTAL.equals(getLibrary())) { + // index the model + HashMap<String, CodegenModel> modelMaps = new HashMap<String, CodegenModel>(); + for (Object o : allModels) { + HashMap<String, Object> h = (HashMap<String, Object>) o; + CodegenModel m = (CodegenModel) h.get("model"); + modelMaps.put(m.classname, m); + + } + + // check if return type is oneOf/anyeOf model + Map<String, Object> operations = (Map<String, Object>) objs.get("operations"); + List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation"); + for (CodegenOperation op : operationList) { + if (op.returnType != null) { + // look up the model to see if it's anyOf/oneOf + if (modelMaps.containsKey(op.returnType) && modelMaps.get(op.returnType) != null) { + CodegenModel cm = modelMaps.get(op.returnType); + + if (cm.oneOf != null && !cm.oneOf.isEmpty()) { + op.vendorExtensions.put("x-java-return-type-one-of", true); + } + + if (cm.anyOf != null && !cm.anyOf.isEmpty()) { + op.vendorExtensions.put("x-java-return-type-any-of", true); + } + } else { + //LOGGER.error("cannot lookup model " + op.returnType); + } + } + } + } + return objs; } @@ -769,12 +807,16 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) { CodegenModel cm = (CodegenModel) mo.get("model"); cm.getVendorExtensions().putIfAbsent("implements", new ArrayList<String>()); // TODO: 5.0 Remove cm.getVendorExtensions().putIfAbsent("x-implements", cm.getVendorExtensions().get("implements")); - List<String> impl = (List<String>) cm.getVendorExtensions().get("implements"); + //List<String> impl = (List<String>) cm.getVendorExtensions().get("x-implements"); + if (JERSEY2_EXPERIMENTAL.equals(getLibrary())) { + cm.getVendorExtensions().put("x-implements", new ArrayList<String>()); + } + if (this.parcelableModel) { - impl.add("Parcelable"); + ((ArrayList<String>) cm.getVendorExtensions().get("x-implements")).add("Parcelable"); } if (this.serializableModel) { - impl.add("Serializable"); + ((ArrayList<String>) cm.getVendorExtensions().get("x-implements")).add("Serializable"); } } diff --git a/modules/openapi-generator/src/main/resources/Java/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/api_test.mustache index 1d95ac2ed89a..7011191c80a3 100644 --- a/modules/openapi-generator/src/main/resources/Java/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api_test.mustache @@ -7,39 +7,45 @@ import {{invokerPackage}}.ApiException; {{/imports}} import org.junit.Test; import org.junit.Ignore; +import org.junit.Assert; {{^fullJavaUtil}} import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{/fullJavaUtil}} /** * API tests for {{classname}} */ -@Ignore public class {{classname}}Test { private final {{classname}} api = new {{classname}}(); - {{#operations}}{{#operation}} + {{#operations}} + {{#operation}} /** + {{#summary}} * {{summary}} * + {{/summary}} + {{#notes}} * {{notes}} * + {{/notes}} * @throws ApiException * if the Api call fails */ @Test public void {{operationId}}Test() throws ApiException { - {{#allParams}} - {{{dataType}}} {{paramName}} = null; - {{/allParams}} - {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + //{{#allParams}} + //{{{dataType}}} {{paramName}} = null; + //{{/allParams}} + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); // TODO: test validations } - {{/operation}}{{/operations}} + {{/operation}} + {{/operations}} } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache new file mode 100644 index 000000000000..607c223aa266 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache @@ -0,0 +1,30 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.model; + +import org.openapitools.client.ApiException; +import java.lang.reflect.Type; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} +public abstract class AbstractOpenApiSchema { + + private Object instance; + + public final String schemaType; + + public AbstractOpenApiSchema(String schemaType) { + this.schemaType = schemaType; + } + + public abstract Map<String, GenericType> getSchemas(); + + public Object getActualInstance() {return instance;} + + public void setActualInstance(Object instance) {this.instance = instance;} + + public String getSchemaType() { + return schemaType; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache new file mode 100644 index 000000000000..618264dc90c0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache @@ -0,0 +1,1072 @@ +package {{invokerPackage}}; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + +import java.io.IOException; +import java.io.InputStream; + +{{^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.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +import java.util.TimeZone; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +import {{invokerPackage}}.auth.ApiKeyAuth; +import {{invokerPackage}}.model.AbstractOpenApiSchema; + +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +{{/hasOAuthMethods}} + +{{>generatedAnnotation}} +public class ApiClient { + protected Map<String, String> defaultHeaderMap = new HashMap<String, String>(); + protected Map<String, String> defaultCookieMap = new HashMap<String, String>(); + protected String basePath = "{{{basePath}}}"; + protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>({{#servers}}{{#-first}}Arrays.asList( +{{/-first}} new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + new HashMap<String, ServerVariable>(){{#variables}}{{#-first}} {{ +{{/-first}} put("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new HashSet<String>( + {{#enumValues}} + {{#-first}} + Arrays.asList( + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ) + {{/-last}} + {{/enumValues}} + ) + )); + {{#-last}} + }}{{/-last}}{{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + ){{/-last}}{{/servers}}); + protected Integer serverIndex = 0; + protected Map<String, String> serverVariables = null; + protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{ + {{#apiInfo}} + {{#apis}} + {{#operations}} + {{#operation}} + {{#servers}} + {{#-first}} + put("{{{classname}}}.{{{operationId}}}", new ArrayList<ServerConfiguration>(Arrays.asList( + {{/-first}} + new ServerConfiguration( + "{{{url}}}", + "{{{description}}}{{^description}}No description provided{{/description}}", + new HashMap<String, ServerVariable>(){{#variables}}{{#-first}} {{ +{{/-first}} put("{{{name}}}", new ServerVariable( + "{{{description}}}{{^description}}No description provided{{/description}}", + "{{{defaultValue}}}", + new HashSet<String>( + {{#enumValues}} + {{#-first}} + Arrays.asList( + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ) + {{/-last}} + {{/enumValues}} + ) + )); + {{#-last}} + }}{{/-last}}{{/variables}} + ){{^-last}},{{/-last}} + {{#-last}} + )));{{/-last}} + {{/servers}} + {{/operation}} + {{/operations}} + {{/apis}} + {{/apiInfo}} + }}; + protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>(); + protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>(); + protected boolean debugging = false; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map<String, Authentication> authentications; + protected Map<String, String> authenticationLookup; + + protected DateFormat dateFormat; + + public ApiClient() { + json = new JSON(); + httpClient = buildHttpClient(debugging); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<String, Authentication>();{{#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}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + // Setup authentication lookup (key: authentication alias, value: authentication name) + authenticationLookup = new HashMap<String, String>();{{#authMethods}}{{#vendorExtensions.x-auth-id-alias}} + authenticationLookup.put("{{name}}", "{{.}}");{{/vendorExtensions.x-auth-id-alias}}{{/authMethods}} + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * @return JSON + */ + public JSON getJSON() { + return json; + } + + public Client getHttpClient() { + return httpClient; + } + + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + public List<ServerConfiguration> getServers() { + return servers; + } + + public ApiClient setServers(List<ServerConfiguration> servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map<String, String> getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map<String, String> serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map of authentication object + */ + public Map<String, Authentication> getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + */ + public void configureApiKeys(HashMap<String, String> secrets) { + for (Map.Entry<String, Authentication> authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.getOrDefault(name, name); + if (secrets.containsKey(name)) { + ((ApiKeyAuth) auth).setApiKey(secrets.get(name)); + } + } + } + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + {{#hasOAuthMethods}} + /** + * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + {{/hasOAuthMethods}} + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent Http user agent + * @return API client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return API client + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return API client + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return API client + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(debugging); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is <code>null</code>, i.e. using + * the system's default tempopary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param readTimeout Read timeout in milliseconds + * @return API client + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List<Pair> parameterToPairs(String collectionFormat, String name, Object value){ + List<Pair> params = new ArrayList<Pair>(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * 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) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) throws ApiException { + Entity<?> entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry<String, Object> param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry<String, Object> param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + } + return entity; + } + + public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ + + Object result = null; + int matchCounter = 0; + ArrayList<String> matchSchemas = new ArrayList<>(); + + for (Map.Entry<String, GenericType> entry : schema.getSchemas().entrySet()) { + String schemaName = entry.getKey(); + GenericType schemaType = entry.getValue(); + + if (schemaType instanceof GenericType) { // model + try { + Object deserializedObject = deserialize(response, schemaType); + if (deserializedObject != null) { + result = deserializedObject; + matchCounter++; + + if ("anyOf".equals(schema.getSchemaType())) { + break; + } else if ("oneOf".equals(schema.getSchemaType())) { + matchSchemas.add(schemaName); + } else { + throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); + } + } else { + // failed to deserialize the response in the schema provided, proceed to the next one if any + } + } catch (Exception ex) { + // failed to deserialize, do nothing and try next one (schema) + } + } else {// unknown type + throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); + } + + } + + if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf + throw new ApiException("Response body is invalid as it matches more than one schema (" + String.join(", ", matchSchemas) + ") defined in the oneOf model: " + schema.getClass().getName()); + } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas + throw new ApiException("Response body is invalid as it doens't match any schemas (" + String.join(", ", schema.getSchemas().keySet()) + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + } else { // only one matched + schema.setActualInstance(result); + return schema; + } + + } + + + + /** + * Deserialize response body to Java object according to the Content-Type. + * @param <T> Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List<Object> contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + + // read the entity stream multiple times + response.bufferEntity(); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + 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); + } + } + + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param <T> Type + * @param operation The qualified name of the operation + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @param schema An instance of the response that uses oneOf/anyOf + * @return The response body in type of string + * @throws ApiException API exception + */ + public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + String targetURL; + if (serverIndex != null) { + Integer index; + List<ServerConfiguration> serverConfigurations; + Map<String, String> variables; + + if (operationServers.containsKey(operation)) { + index = operationServerIndex.getOrDefault(operation, serverIndex); + variables = operationServerVariables.getOrDefault(operation, serverVariables); + serverConfigurations = operationServers.get(operation); + } else { + index = serverIndex; + variables = serverVariables; + serverConfigurations = servers; + } + if (index < 0 || index >= serverConfigurations.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size() + )); + } + targetURL = serverConfigurations.get(index).URL(variables) + path; + } else { + targetURL = this.basePath + path; + } + WebTarget target = httpClient.target(targetURL); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + } + } + } + + Invocation.Builder invocationBuilder = target.request().accept(accept); + + for (Entry<String, String> entry : headerParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + for (Entry<String, String> entry : cookieParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry<String, String> entry : defaultCookieMap.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry<String, String> entry : defaultHeaderMap.entrySet()) { + String key = entry.getKey(); + if (!headerParams.containsKey(key)) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(key, value); + } + } + } + + Entity<?> entity = serialize(body, formParams, contentType); + + Response response = null; + + try { + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else if ("HEAD".equals(method)) { + response = invocationBuilder.head(); + } else if ("OPTIONS".equals(method)) { + response = invocationBuilder.options(); + } else if ("TRACE".equals(method)) { + response = invocationBuilder.trace(); + } else { + throw new ApiException(500, "unknown method type " + method); + } + + int statusCode = response.getStatusInfo().getStatusCode(); + Map<String, List<String>> responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) + return new ApiResponse<{{#supportJava6}}T{{/supportJava6}}>(statusCode, responseHeaders); + else + if (schema == null) { + return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + } else { // oneOf/anyOf + return new ApiResponse<>(statusCode, responseHeaders, (T)deserializeSchemas(response, schema)); + } + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue + } + } + } + + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ + @Deprecated + public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema); + } + + /** + * Build the Client used to make HTTP requests. + * @param debugging Debug setting + * @return Client + */ + protected Client buildHttpClient(boolean debugging) { + final ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + // 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); + } + performAdditionalClientConfiguration(clientConfig); + return ClientBuilder.newClient(clientConfig); + } + + protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { + // No-op extension point + } + + protected Map<String, List<String>> buildResponseHeaders(Response response) { + Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>(); + for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) { + List<Object> values = entry.getValue(); + List<String> headers = new ArrayList<String>(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache new file mode 100644 index 000000000000..a67b11f054c8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache @@ -0,0 +1,58 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.List; +import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +/** + * API response returned by API call. + * + * @param <T> The type of data that is deserialized from response body + */ +public class ApiResponse<T> { + private final int statusCode; + private final Map<String, List<String>> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { + this.statusCode = statusCode; + {{#caseInsensitiveResponseHeaders}} + Map<String, List<String>> responseHeaders = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); + for(Entry<String, List<String>> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map<String, List<String>> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache new file mode 100644 index 000000000000..b442f0836da8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache @@ -0,0 +1,65 @@ +package {{invokerPackage}}; + +{{#threetenbp}} +import org.threeten.bp.*; +{{/threetenbp}} +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import org.openapitools.jackson.nullable.JsonNullableModule; +{{#java8}} +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +{{/java8}} +{{#joda}} +import com.fasterxml.jackson.datatype.joda.JodaModule; +{{/joda}} +{{#threetenbp}} +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; +{{/threetenbp}} + +import java.text.DateFormat; + +import javax.ws.rs.ext.ContextResolver; + +{{>generatedAnnotation}} +public class JSON implements ContextResolver<ObjectMapper> { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + {{#java8}} + mapper.registerModule(new JavaTimeModule()); + {{/java8}} + {{#joda}} + mapper.registerModule(new JodaModule()); + {{/joda}} + {{#threetenbp}} + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + mapper.registerModule(module); + {{/threetenbp}} + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class<?> type) { + return mapper; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache new file mode 100644 index 000000000000..a3702d221ad2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/anyof_model.mustache @@ -0,0 +1,28 @@ +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { + + // store a list of schema names defined in anyOf + public final static Map<String, GenericType> schemas = new HashMap<String, GenericType>(); + + public {{classname}}() { + super("anyOf"); + } + + static { + {{#anyOf}} + schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { + }); + {{/anyOf}} + } + + @Override + public Map<String, GenericType> getSchemas() { + return {{classname}}.schemas; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache new file mode 100644 index 000000000000..a0730135f711 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache @@ -0,0 +1,244 @@ +package {{package}}; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; + +import javax.ws.rs.core.GenericType; + +{{#imports}}import {{import}}; +{{/imports}} + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private ApiClient apiClient; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + {{#operation}} + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + {{#returnType}} + * @return {{returnType}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + {{#responses}} + <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr> + {{/responses}} + </table> + {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see <a href="{{url}}">{{summary}} Documentation</a> + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}.getData(){{/returnType}}; + } + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + {{/allParams}} + * @return ApiResponse<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + {{#responses}} + <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr> + {{/responses}} + </table> + {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see <a href="{{url}}">{{summary}} Documentation</a> + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + } + {{/required}}{{/allParams}} + // create path and map variables + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + + // query params + {{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>(); + {{javaUtilPrefix}}Map<String, String> localVarHeaderParams = new {{javaUtilPrefix}}HashMap<String, String>(); + {{javaUtilPrefix}}Map<String, String> localVarCookieParams = new {{javaUtilPrefix}}HashMap<String, String>(); + {{javaUtilPrefix}}Map<String, Object> localVarFormParams = new {{javaUtilPrefix}}HashMap<String, Object>(); + + {{#queryParams}} + localVarQueryParams.addAll(apiClient.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); + {{/queryParams}} + + {{#headerParams}}if ({{paramName}} != null) + localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/headerParams}} + + {{#cookieParams}}if ({{paramName}} != null) + localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/cookieParams}} + + {{#formParams}}if ({{paramName}} != null) + localVarFormParams.put("{{baseName}}", {{paramName}}); + {{/formParams}} + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} }; + + {{#returnType}} + GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; + + {{/returnType}} + return apiClient.invokeAPI("{{classname}}.{{operationId}}", localVarPath, "{{httpMethod}}", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#vendorExtensions.x-java-return-type-one-of}}new {{{returnType}}}(){{/vendorExtensions.x-java-return-type-one-of}}{{^vendorExtensions.x-java-return-type-one-of}}{{#vendorExtensions.x-java-return-type-any-of}}new {{{returnType}}}(){{/vendorExtensions.x-java-return-type-any-of}}{{^vendorExtensions.x-java-return-type-any-of}}null{{/vendorExtensions.x-java-return-type-any-of}}{{/vendorExtensions.x-java-return-type-one-of}}); + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#allParams}} + private {{#isRequired}}final {{/isRequired}}{{{dataType}}} {{localVariablePrefix}}{{paramName}}; + {{/allParams}} + + private API{{operationId}}Request({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) { + {{#pathParams}} + this.{{localVariablePrefix}}{{paramName}} = {{paramName}}; + {{/pathParams}} + } + {{#allParams}}{{^isPathParam}} + + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} ({{^required}}optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}{{/required}}{{#required}}required{{/required}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { + this.{{localVariablePrefix}}{{paramName}} = {{paramName}}; + return this; + } + {{/isPathParam}}{{/allParams}} + + /** + * Execute {{operationId}} request + {{#returnType}}* @return {{.}}{{/returnType}} + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + {{#responses}} + <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr> + {{/responses}} + </table> + {{/responses.0}} + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + */ + {{#isDeprecated}}@Deprecated{{/isDeprecated}} + public {{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}return {{/returnType}}this.executeWithHttpInfo().getData(); + } + + /** + * Execute {{operationId}} request with HTTP info returned + * @return ApiResponse<{{#returnType}}{{.}}{{/returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + {{#responses}} + <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr> + {{/responses}} + </table> + {{/responses.0}} + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + */ + {{#isDeprecated}}@Deprecated{{/isDeprecated}} + public ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + } + } + + /** + * {{summary}} + * {{notes}}{{#pathParams}} + * @param {{paramName}} {{description}} (required){{/pathParams}} + * @return {{operationId}}Request + * @throws ApiException if fails to make API call + {{#isDeprecated}}* @deprecated{{/isDeprecated}} + {{#externalDocs}}* {{description}} + * @see <a href="{{url}}">{{summary}} Documentation</a>{{/externalDocs}} + */ + {{#isDeprecated}}@Deprecated{{/isDeprecated}} + public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) throws ApiException { + return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache new file mode 100644 index 000000000000..e89524565917 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache @@ -0,0 +1,96 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +{{>generatedAnnotation}} +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private int code = 0; + private Map<String, List<String>> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); + for(Entry<String, List<String>> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map<String, List<String>> headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); + for(Entry<String, List<String>> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map<String, List<String>> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_doc.mustache new file mode 100644 index 000000000000..f162d1cc9748 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_doc.mustache @@ -0,0 +1,121 @@ +# {{classname}}{{#description}} + +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} + +## {{operationId}} + +{{^vendorExtensions.x-group-parameters}} +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +{{/vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-group-parameters}} +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute(); +{{/vendorExtensions.x-group-parameters}} + +{{summary}}{{#notes}} + +{{{unescapedNotes}}}{{/notes}} + +### Example + +```java +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.models.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{^vendorExtensions.x-group-parameters}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + .execute(); + {{/vendorExtensions.x-group-parameters}} + {{#returnType}} + System.out.println(result); + {{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + +- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_test.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_test.mustache new file mode 100644 index 000000000000..5ee6e494084e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api_test.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.ApiException; +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +/** + * API tests for {{classname}} + */ +public class {{classname}}Test { + + private final {{classname}} api = new {{classname}}(); + + {{#operations}}{{#operation}} + /** + * {{summary}} + * + * {{notes}} + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void {{operationId}}Test() throws ApiException { + {{#allParams}} + //{{{dataType}}} {{paramName}} = null; + {{/allParams}} + {{^vendorExtensions.x-group-parameters}} + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{/vendorExtensions.x-group-parameters}} + {{#vendorExtensions.x-group-parameters}} + //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}} + // .{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}} + // .execute(); + {{/vendorExtensions.x-group-parameters}} + // TODO: test validations + } + {{/operation}}{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.gradle.mustache new file mode 100644 index 000000000000..cdb451adb345 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.gradle.mustache @@ -0,0 +1,170 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +buildscript { + repositories { + maven { url "https://repo1.maven.org/maven2" } + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + 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 + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + 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 { + pom.artifactId = '{{artifactId}}' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.5.22" + jackson_version = "2.10.3" + jackson_databind_version = "2.10.3" + jackson_databind_nullable_version = "0.2.1" + {{#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" + {{#threetenbp}} + threetenbp_version = "2.9.10" + {{/threetenbp}} +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "com.google.code.findbugs:jsr305:3.0.2" + compile "org.glassfish.jersey.core:jersey-client:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + {{#joda}} + compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + {{/joda}} + {{#java8}} + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{/java8}} + {{#supportJava6}} + compile "commons-io:commons-io:$commons_io_version" + compile "org.apache.commons:commons-lang3:$commons_lang3_version" + {{/supportJava6}} + {{#threetenbp}} + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" + {{/threetenbp}} + {{^java8}} + compile "com.brsanthu:migbase64:2.2" + {{/java8}} + testCompile "junit:junit:$junit_version" +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.sbt.mustache new file mode 100644 index 000000000000..abb91ecdc990 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/build.sbt.mustache @@ -0,0 +1,38 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.22", + "org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, + "org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, + "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", + {{#joda}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", + {{/joda}} + {{#java8}} + "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.10" % "compile", + {{/java8}} + {{#threetenbp}} + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", + {{/threetenbp}} + {{^java8}} + "com.brsanthu" % "migbase64" % "2.2", + {{/java8}} + {{#supportJava6}} + "org.apache.commons" % "commons-lang3" % "3.6", + "commons-io" % "commons-io" % "2.5", + {{/supportJava6}} + "junit" % "junit" % "4.13" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/model.mustache new file mode 100644 index 000000000000..02787f8bb7ff --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/model.mustache @@ -0,0 +1,47 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +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}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{/jackson}} +{{#withXml}} +import javax.xml.bind.annotation.*; +{{/withXml}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#oneOf}}{{#-first}}{{>oneof_model}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>anyof_model}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>pojo}}{{/anyOf}}{{/oneOf}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache new file mode 100644 index 000000000000..62289f9b2d72 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache @@ -0,0 +1,45 @@ +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { + + // store a list of schema names defined in oneOf + public final static Map<String, GenericType> schemas = new HashMap<String, GenericType>(); + + public {{classname}}() { + super("oneOf"); + } + + static { + {{#oneOf}} + schemas.put("{{{.}}}", new GenericType<{{{.}}}>() { + }); + {{/oneOf}} + } + + @Override + public Map<String, GenericType> getSchemas() { + return {{classname}}.schemas; + } + + public String getSchemaType() { + return schemaType; + } + + @Override + public void setActualInstance(Object instance) { + {{#oneOf}} + if (instance instanceof {{{.}}}) { + super.setActualInstance(instance); + return; + } + + {{/oneOf}} + throw new RuntimeException("Invalid instance type. Must be {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}"); + } + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pojo.mustache new file mode 100644 index 000000000000..c438cd43eb72 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pojo.mustache @@ -0,0 +1,369 @@ +/** + * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} + */{{#description}} +@ApiModel(description = "{{{description}}}"){{/description}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/gson}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/jackson}} + {{#withXml}} + {{#isXmlAttribute}} + @XmlAttribute(name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlAttribute}} + {{^isXmlAttribute}} + {{^isContainer}} + @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + // Is a container wrapped={{isXmlWrapped}} + {{#items}} + // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} + // items.example={{example}} items.type={{dataType}} + @XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/items}} + {{#isXmlWrapped}} + @XmlElementWrapper({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{/isXmlAttribute}} + {{/withXml}} + {{#gson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + {{/isContainer}} + {{^isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + {{#parcelableModel}} + public {{classname}}() { + {{#parent}} + super(); + {{/parent}} + {{#gson}} + {{#discriminator}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator}} + {{/gson}} + } + {{/parcelableModel}} + {{^parcelableModel}} + {{#gson}} + {{#discriminator}} + public {{classname}}() { + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + } + {{/discriminator}} + {{/gson}} + {{/parcelableModel}} + {{#vars}} + + {{^isReadOnly}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});{{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = {{name}};{{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#isListContainer}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().add({{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isListContainer}} + {{#isMapContainer}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().put(key, {{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isMapContainer}} + + {{/isReadOnly}} + /** + {{#description}} + * {{description}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ +{{#required}} +{{#isNullable}} + @javax.annotation.Nullable +{{/isNullable}} +{{/required}} +{{^required}} + @javax.annotation.Nullable +{{/required}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} +{{#vendorExtensions.x-is-jackson-optional-nullable}} + {{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} + @JsonIgnore +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} + public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} + if ({{name}} == null) { + {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + } + {{/isReadOnly}} + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{> jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} + this.{{name}} = {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{^isReadOnly}} + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isReadOnly}} + + {{/vars}} + +{{^supportJava6}} + @Override + public boolean equals(java.lang.Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && + {{/hasMore}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + } + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + {{/useReflectionEqualsHashCode}} + } + +{{/supportJava6}} +{{#supportJava6}} + @Override + public boolean equals(java.lang.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}}){{#hasMore}} && + {{/hasMore}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + } + +{{/supportJava6}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + 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("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArrayModel}} + out.writeList(this); +{{/isArrayModel}} +{{^isArrayModel}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArrayModel}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArrayModel}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArrayModel}} +{{^isArrayModel}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArrayModel}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArrayModel}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArrayModel}} +{{^isArrayModel}} + return new {{classname}}(in); +{{/isArrayModel}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache new file mode 100644 index 000000000000..bf1c3648c20e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache @@ -0,0 +1,372 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>{{groupId}}</groupId> + <artifactId>{{artifactId}}</artifactId> + <packaging>jar</packaging> + <name>{{artifactId}}</name> + <version>{{artifactVersion}}</version> + <url>{{artifactUrl}}</url> + <description>{{artifactDescription}}</description> + <scm> + <connection>{{scmConnection}}</connection> + <developerConnection>{{scmDeveloperConnection}}</developerConnection> + <url>{{scmUrl}}</url> + </scm> +{{#parentOverridden}} + <parent> + <groupId>{{{parentGroupId}}}</groupId> + <artifactId>{{{parentArtifactId}}}</artifactId> + <version>{{{parentVersion}}}</version> + </parent> +{{/parentOverridden}} + + <licenses> + <license> + <name>{{licenseName}}</name> + <url>{{licenseUrl}}</url> + <distribution>repo</distribution> + </license> + </licenses> + + <developers> + <developer> + <name>{{developerName}}</name> + <email>{{developerEmail}}</email> + <organization>{{developerOrganization}}</organization> + <organizationUrl>{{developerOrganizationUrl}}</organizationUrl> + </developer> + </developers> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <version>3.0.0-M1</version> + <executions> + <execution> + <id>enforce-maven</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireMavenVersion> + <version>2.2.0</version> + </requireMavenVersion> + </rules> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.12</version> + <configuration> + <systemProperties> + <property> + <name>loggerPath</name> + <value>conf/log4j.properties</value> + </property> + </systemProperties> + <argLine>-Xms512m -Xmx1500m</argLine> + <parallel>methods</parallel> + <forkMode>pertest</forkMode> + </configuration> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <!-- attach test jar --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <goals> + <goal>jar</goal> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + <configuration> + </configuration> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.10</version> + <executions> + <execution> + <id>add_sources</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/main/java</source> + </sources> + </configuration> + </execution> + <execution> + <id>add_test_sources</id> + <phase>generate-test-sources</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>src/test/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.6.1</version> + <configuration> + {{#supportJava6}} + <source>1.6</source> + <target>1.6</target> + {{/supportJava6}} + {{^supportJava6}} + {{#java8}} + <source>1.8</source> + <target>1.8</target> + {{/java8}} + {{^java8}} + <source>1.7</source> + <target>1.7</target> + {{/java8}} + {{/supportJava6}} + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.1.1</version> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + <configuration> + <doclint>none</doclint> + <tags> + <tag> + <name>http.response.details</name> + <placement>a</placement> + <head>Http Response Details:</head> + </tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>2.2.1</version> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>sign-artifacts</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-gpg-plugin</artifactId> + <version>1.5</version> + <executions> + <execution> + <id>sign-artifacts</id> + <phase>verify</phase> + <goals> + <goal>sign</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger-annotations-version}</version> + </dependency> + + <!-- @Nullable annotation --> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>3.0.2</version> + </dependency> + + <!-- HTTP client: jersey-client --> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey-version}</version> + </dependency> + {{^supportJava6}} + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + <version>${jersey-version}</version> + </dependency> + {{/supportJava6}} + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-multipart</artifactId> + <version>${jersey-version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey-version}</version> + </dependency> + + <!-- JSON processing: jackson --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson-databind-version}</version> + </dependency> + <dependency> + <groupId>org.openapitools</groupId> + <artifactId>jackson-databind-nullable</artifactId> + <version>${jackson-databind-nullable-version}</version> + </dependency> + {{#withXml}} + + <!-- XML processing: JAXB --> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-jaxb</artifactId> + <version>${jersey-version}</version> + </dependency> + + {{/withXml}} + {{#joda}} + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-joda</artifactId> + <version>${jackson-version}</version> + </dependency> + {{/joda}} + {{#java8}} + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>${jackson-version}</version> + </dependency> + {{/java8}} + {{#threetenbp}} + <dependency> + <groupId>com.github.joschi.jackson</groupId> + <artifactId>jackson-datatype-threetenbp</artifactId> + <version>${threetenbp-version}</version> + </dependency> + {{/threetenbp}} + {{^java8}} + <!-- Base64 encoding that works in both JVM and Android --> + <dependency> + <groupId>com.brsanthu</groupId> + <artifactId>migbase64</artifactId> + <version>2.2</version> + </dependency> + {{/java8}} + {{#supportJava6}} + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons_lang3_version}</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons_io_version}</version> + </dependency> + {{/supportJava6}} + {{#useBeanValidation}} + <!-- Bean Validation API support --> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>1.1.0.Final</version> + <scope>provided</scope> + </dependency> + {{/useBeanValidation}} + <!-- test dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit-version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <swagger-annotations-version>1.6.1</swagger-annotations-version> + {{^supportJava6}} + <jersey-version>2.30.1</jersey-version> + {{/supportJava6}} + {{#supportJava6}} + <jersey-version>2.6</jersey-version> + <commons_io_version>2.5</commons_io_version> + <commons_lang3_version>3.6</commons_lang3_version> + {{/supportJava6}} + <jackson-version>2.10.3</jackson-version> + <jackson-databind-version>2.10.3</jackson-databind-version> + <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> + {{#threetenbp}} + <threetenbp-version>2.9.10</threetenbp-version> + {{/threetenbp}} + <junit-version>4.13</junit-version> + </properties> +</project> 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 9bd8925f001b..d999ffaf0faf 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 @@ -352,7 +352,7 @@ </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <swagger-annotations-version>1.5.22</swagger-annotations-version> + <swagger-annotations-version>1.6.1</swagger-annotations-version> {{^supportJava6}} <jersey-version>2.27</jersey-version> {{/supportJava6}} 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 d43f7062e230..93ddc121dfa7 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 @@ -1401,7 +1401,7 @@ public void testUseOneOfInterfaces() { .get("application/json") .getSchema() .getExtensions() - .get("x-oneOf-name"), + .get("x-one-of-name"), "CreateState" ); Assert.assertEquals( @@ -1414,11 +1414,11 @@ public void testUseOneOfInterfaces() { .get("application/json") .getSchema() .getExtensions() - .get("x-oneOf-name"), + .get("x-one-of-name"), "GetState200" ); // for the array schema, assert that a oneOf interface was added to schema map Schema items = ((ArraySchema) openAPI.getComponents().getSchemas().get("CustomOneOfArraySchema")).getItems(); - Assert.assertEquals(items.getExtensions().get("x-oneOf-name"), "CustomOneOfArraySchemaOneOf"); + Assert.assertEquals(items.getExtensions().get("x-one-of-name"), "CustomOneOfArraySchemaOneOf"); } } diff --git a/pom.xml b/pom.xml index df4f81ac4e5d..b9ff2c632c3d 100644 --- a/pom.xml +++ b/pom.xml @@ -1306,6 +1306,7 @@ <module>samples/client/petstore/java/jersey1</module> <module>samples/client/petstore/java/jersey2</module> <module>samples/client/petstore/java/jersey2-java8</module> + <module>samples/client/petstore/java/jersey2-experimental</module> <module>samples/client/petstore/java/okhttp-gson</module> <module>samples/client/petstore/java/retrofit</module> <module>samples/client/petstore/java/retrofit2</module> @@ -1399,6 +1400,7 @@ <module>samples/client/petstore/java/feign</module> <module>samples/client/petstore/java/jersey1</module> <module>samples/client/petstore/java/jersey2</module> + <module>samples/client/petstore/java/jersey2-experimental</module> <module>samples/client/petstore/java/okhttp-gson</module> <module>samples/client/petstore/java/retrofit</module> <module>samples/client/petstore/java/retrofit2</module> diff --git a/samples/client/petstore/java/jersey2-experimental/.gitignore b/samples/client/petstore/java/jersey2-experimental/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/jersey2-experimental/.openapi-generator-ignore b/samples/client/petstore/java/jersey2-experimental/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/.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/java/jersey2-experimental/.openapi-generator/VERSION b/samples/client/petstore/java/jersey2-experimental/.openapi-generator/VERSION new file mode 100644 index 000000000000..b5d898602c2c --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-experimental/.travis.yml b/samples/client/petstore/java/jersey2-experimental/.travis.yml new file mode 100644 index 000000000000..e3bdf2af1bea --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/samples/client/petstore/java/jersey2-experimental/README.md b/samples/client/petstore/java/jersey2-experimental/README.md new file mode 100644 index 000000000000..a42ed132fe24 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/README.md @@ -0,0 +1,238 @@ +# petstore-jersey2 + +OpenAPI Petstore + +- API version: 1.0.0 + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 1.7+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml +<dependency> + <groupId>org.openapitools</groupId> + <artifactId>petstore-jersey2</artifactId> + <version>1.0.0</version> + <scope>compile</scope> +</dependency> +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "org.openapitools:petstore-jersey2:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/petstore-jersey2-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class AnotherFakeApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*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 +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | 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/{order_id} | 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 + + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md) + - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md) + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md) + - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md) + - [Animal](docs/Animal.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [CatAllOf](docs/CatAllOf.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Dog](docs/Dog.md) + - [DogAllOf](docs/DogAllOf.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + - [XmlItem](docs/XmlItem.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### api_key_query + + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +### http_basic_test + + +- **Type**: HTTP basic authentication + +### 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 + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml b/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml new file mode 100644 index 000000000000..30aad25824c8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml @@ -0,0 +1,2183 @@ +openapi: 3.0.1 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + "405": + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: application/json + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: application/json + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: application/json + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-contentType: multipart/form-data + x-accepts: application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: application/json + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: application/json + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + "400": + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: application/json + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Delete user + tags: + - user + x-accepts: application/json + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: application/json + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + "400": + content: {} + description: Invalid user supplied + "404": + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + in: query + name: required_string_group + required: true + schema: + type: integer + - description: Required Boolean in group parameters + in: header + name: required_boolean_group + required: true + schema: + type: boolean + - description: Required Integer in group parameters + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + - description: String in group parameters + in: query + name: string_group + schema: + type: integer + - description: Boolean in group parameters + in: header + name: boolean_group + schema: + type: boolean + - description: Integer in group parameters + in: query + name: int64_group + schema: + format: int64 + type: integer + responses: + "400": + content: {} + description: Someting wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + responses: + "400": + content: {} + description: Invalid request + "404": + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + post: + description: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + security: + - http_basic_test: [] + summary: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true + responses: + "200": + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-codegen-request-body-name: param + x-contentType: application/json + x-accepts: application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake/create_xml_item: + post: + description: this route creates an XmlItem + operationId: createXmlItem + requestBody: + content: + application/xml: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + description: XmlItem Body + required: true + responses: + "200": + content: {} + description: successful operation + summary: creates an XmlItem + tags: + - fake + x-codegen-request-body-name: XmlItem + x-contentType: application/xml + x-accepts: application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema + named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake/test-query-paramters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: form + - in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + - in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: {} + description: Success + tags: + - fake + x-accepts: application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-contentType: multipart/form-data + x-accepts: application/json +components: + schemas: + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Dog_allOf' + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + BigDecimal: + format: number + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_string: + additionalProperties: + type: string + type: object + map_number: + additionalProperties: + type: number + type: object + map_integer: + additionalProperties: + type: integer + type: object + map_boolean: + additionalProperties: + type: boolean + type: object + map_array_integer: + additionalProperties: + items: + type: integer + type: array + type: object + map_array_anytype: + additionalProperties: + items: + properties: {} + type: object + type: array + type: object + map_map_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_map_anytype: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + type: object + anytype_1: + properties: {} + type: object + anytype_2: + type: object + anytype_3: + properties: {} + type: object + type: object + AdditionalPropertiesString: + additionalProperties: + type: string + properties: + name: + type: string + type: object + AdditionalPropertiesInteger: + additionalProperties: + type: integer + properties: + name: + type: string + type: object + AdditionalPropertiesNumber: + additionalProperties: + type: number + properties: + name: + type: string + type: object + AdditionalPropertiesBoolean: + additionalProperties: + type: boolean + properties: + name: + type: string + type: object + AdditionalPropertiesArray: + additionalProperties: + items: + properties: {} + type: object + type: array + properties: + name: + type: string + type: object + AdditionalPropertiesObject: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesAnyType: + additionalProperties: + properties: {} + type: object + properties: + name: + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterComposite: + example: + my_string: my_string + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + TypeHolderDefault: + properties: + string_item: + default: what + type: string + number_item: + type: number + integer_item: + type: integer + bool_item: + default: true + type: boolean + array_item: + items: + type: integer + type: array + required: + - array_item + - bool_item + - integer_item + - number_item + - string_item + type: object + TypeHolderExample: + properties: + string_item: + example: what + type: string + number_item: + example: 1.234 + type: number + float_item: + example: 1.234 + format: float + type: number + integer_item: + example: -2 + type: integer + bool_item: + example: true + type: boolean + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + required: + - array_item + - bool_item + - float_item + - integer_item + - number_item + - string_item + type: object + XmlItem: + properties: + attribute_string: + example: string + type: string + xml: + attribute: true + attribute_number: + example: 1.234 + type: number + xml: + attribute: true + attribute_integer: + example: -2 + type: integer + xml: + attribute: true + attribute_boolean: + example: true + type: boolean + xml: + attribute: true + wrapped_array: + items: + type: integer + type: array + xml: + wrapped: true + name_string: + example: string + type: string + xml: + name: xml_name_string + name_number: + example: 1.234 + type: number + xml: + name: xml_name_number + name_integer: + example: -2 + type: integer + xml: + name: xml_name_integer + name_boolean: + example: true + type: boolean + xml: + name: xml_name_boolean + name_array: + items: + type: integer + xml: + name: xml_name_array_item + type: array + name_wrapped_array: + items: + type: integer + xml: + name: xml_name_wrapped_array_item + type: array + xml: + name: xml_name_wrapped_array + wrapped: true + prefix_string: + example: string + type: string + xml: + prefix: ab + prefix_number: + example: 1.234 + type: number + xml: + prefix: cd + prefix_integer: + example: -2 + type: integer + xml: + prefix: ef + prefix_boolean: + example: true + type: boolean + xml: + prefix: gh + prefix_array: + items: + type: integer + xml: + prefix: ij + type: array + prefix_wrapped_array: + items: + type: integer + xml: + prefix: mn + type: array + xml: + prefix: kl + wrapped: true + namespace_string: + example: string + type: string + xml: + namespace: http://a.com/schema + namespace_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + namespace_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + namespace_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + namespace_array: + items: + type: integer + xml: + namespace: http://e.com/schema + type: array + namespace_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + type: array + xml: + namespace: http://f.com/schema + wrapped: true + prefix_ns_string: + example: string + type: string + xml: + namespace: http://a.com/schema + prefix: a + prefix_ns_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + prefix: b + prefix_ns_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + prefix: c + prefix_ns_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + prefix: d + prefix_ns_array: + items: + type: integer + xml: + namespace: http://e.com/schema + prefix: e + type: array + prefix_ns_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + prefix: g + type: array + xml: + namespace: http://f.com/schema + prefix: f + wrapped: true + type: object + xml: + namespace: http://a.com/schema + prefix: pre + Dog_allOf: + properties: + breed: + type: string + Cat_allOf: + properties: + declawed: + type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + diff --git a/samples/client/petstore/java/jersey2-experimental/build.gradle b/samples/client/petstore/java/jersey2-experimental/build.gradle new file mode 100644 index 000000000000..b21805a1ddb6 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/build.gradle @@ -0,0 +1,123 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + maven { url "https://repo1.maven.org/maven2" } + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + install { + repositories.mavenInstaller { + pom.artifactId = 'petstore-jersey2-exp' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.5.22" + jackson_version = "2.10.3" + jackson_databind_version = "2.10.3" + jackson_databind_nullable_version = "0.2.1" + jersey_version = "2.27" + junit_version = "4.13" + threetenbp_version = "2.9.10" +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "com.google.code.findbugs:jsr305:3.0.2" + compile "org.glassfish.jersey.core:jersey-client:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" + compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" + compile "com.brsanthu:migbase64:2.2" + testCompile "junit:junit:$junit_version" +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} diff --git a/samples/client/petstore/java/jersey2-experimental/build.sbt b/samples/client/petstore/java/jersey2-experimental/build.sbt new file mode 100644 index 000000000000..e77fd2df2281 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/build.sbt @@ -0,0 +1,24 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "petstore-jersey2-exp", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.22", + "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", + "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", + "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", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", + "com.brsanthu" % "migbase64" % "2.2", + "junit" % "junit" % "4.13" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 000000000000..87b468bb7ca3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesAnyType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesArray.md new file mode 100644 index 000000000000..cb7fe9b3903d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesArray.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesArray + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 000000000000..6b53e7ba73a1 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesBoolean + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..36e181620016 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md @@ -0,0 +1,22 @@ + + +# AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapString** | **Map<String, String>** | | [optional] +**mapNumber** | [**Map<String, BigDecimal>**](BigDecimal.md) | | [optional] +**mapInteger** | **Map<String, Integer>** | | [optional] +**mapBoolean** | **Map<String, Boolean>** | | [optional] +**mapArrayInteger** | [**Map<String, List<Integer>>**](List.md) | | [optional] +**mapArrayAnytype** | [**Map<String, List<Object>>**](List.md) | | [optional] +**mapMapString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapMapAnytype** | [**Map<String, Map<String, Object>>**](Map.md) | | [optional] +**anytype1** | [**Object**](.md) | | [optional] +**anytype2** | [**Object**](.md) | | [optional] +**anytype3** | [**Object**](.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesInteger.md new file mode 100644 index 000000000000..d2ed7fb1a460 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesNumber.md new file mode 100644 index 000000000000..53f6e81e7176 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesNumber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesObject.md new file mode 100644 index 000000000000..98ac8d2e5fe0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesObject.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesString.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesString.md new file mode 100644 index 000000000000..d7970cdfe190 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesString.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Animal.md b/samples/client/petstore/java/jersey2-experimental/docs/Animal.md new file mode 100644 index 000000000000..c8e18ae55e4f --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Animal.md @@ -0,0 +1,13 @@ + + +# Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..059616ec6baa --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md @@ -0,0 +1,74 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + + +## call123testSpecialTags + +> Client call123testSpecialTags(body) + +To test special tags + +To test special tags and operation ID starting with number + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/jersey2-experimental/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..a48aa23e78ee --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,12 @@ + + +# ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/jersey2-experimental/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..fa2909211a07 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ArrayOfNumberOnly.md @@ -0,0 +1,12 @@ + + +# ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ArrayTest.md b/samples/client/petstore/java/jersey2-experimental/docs/ArrayTest.md new file mode 100644 index 000000000000..9ad1c9814a51 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ArrayTest.md @@ -0,0 +1,14 @@ + + +# ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/BigCat.md b/samples/client/petstore/java/jersey2-experimental/docs/BigCat.md new file mode 100644 index 000000000000..8a075304abf8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/BigCatAllOf.md b/samples/client/petstore/java/jersey2-experimental/docs/BigCatAllOf.md new file mode 100644 index 000000000000..21177dbf089d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Capitalization.md b/samples/client/petstore/java/jersey2-experimental/docs/Capitalization.md new file mode 100644 index 000000000000..7b73c40b5545 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Capitalization.md @@ -0,0 +1,17 @@ + + +# Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**scAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Cat.md b/samples/client/petstore/java/jersey2-experimental/docs/Cat.md new file mode 100644 index 000000000000..39c2f864df88 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Cat.md @@ -0,0 +1,12 @@ + + +# Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/CatAllOf.md b/samples/client/petstore/java/jersey2-experimental/docs/CatAllOf.md new file mode 100644 index 000000000000..1098fd900c5d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/CatAllOf.md @@ -0,0 +1,12 @@ + + +# CatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Category.md b/samples/client/petstore/java/jersey2-experimental/docs/Category.md new file mode 100644 index 000000000000..613ea9f7ee24 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Category.md @@ -0,0 +1,13 @@ + + +# Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ClassModel.md b/samples/client/petstore/java/jersey2-experimental/docs/ClassModel.md new file mode 100644 index 000000000000..d5453c20133a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ClassModel.md @@ -0,0 +1,13 @@ + + +# ClassModel + +Model for testing model with \"_class\" property +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Client.md b/samples/client/petstore/java/jersey2-experimental/docs/Client.md new file mode 100644 index 000000000000..228df492383f --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Client.md @@ -0,0 +1,12 @@ + + +# Client + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Dog.md b/samples/client/petstore/java/jersey2-experimental/docs/Dog.md new file mode 100644 index 000000000000..73cedf2bc919 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Dog.md @@ -0,0 +1,12 @@ + + +# Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/DogAllOf.md b/samples/client/petstore/java/jersey2-experimental/docs/DogAllOf.md new file mode 100644 index 000000000000..cbeb9e9a22df --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/DogAllOf.md @@ -0,0 +1,12 @@ + + +# DogAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/EnumArrays.md b/samples/client/petstore/java/jersey2-experimental/docs/EnumArrays.md new file mode 100644 index 000000000000..869b7a6c066d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/EnumArrays.md @@ -0,0 +1,31 @@ + + +# EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] +**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] + + + +## Enum: JustSymbolEnum + +Name | Value +---- | ----- +GREATER_THAN_OR_EQUAL_TO | ">=" +DOLLAR | "$" + + + +## Enum: List<ArrayEnumEnum> + +Name | Value +---- | ----- +FISH | "fish" +CRAB | "crab" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/EnumClass.md b/samples/client/petstore/java/jersey2-experimental/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md b/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md new file mode 100644 index 000000000000..61eb95f22fe9 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md @@ -0,0 +1,54 @@ + + +# EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] + + + +## Enum: EnumStringEnum + +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + + +## Enum: EnumStringRequiredEnum + +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + + +## Enum: EnumIntegerEnum + +Name | Value +---- | ----- +NUMBER_1 | 1 +NUMBER_MINUS_1 | -1 + + + +## Enum: EnumNumberEnum + +Name | Value +---- | ----- +NUMBER_1_DOT_1 | 1.1 +NUMBER_MINUS_1_DOT_2 | -1.2 + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md b/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md new file mode 100644 index 000000000000..543c51f066c5 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md @@ -0,0 +1,997 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | + + + +## createXmlItem + +> createXmlItem(xmlItem) + +creates an XmlItem + +this route creates an XmlItem + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## fakeOuterBooleanSerialize + +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Boolean**| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +## fakeOuterCompositeSerialize + +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +## fakeOuterNumberSerialize + +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **BigDecimal**| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +## fakeOuterStringSerialize + +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +## testBodyWithFileSchema + +> testBodyWithFileSchema(body) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testBodyWithQueryParams + +> testBodyWithQueryParams(query, body) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **body** | [**User**](User.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testClientModel + +> Client testClientModel(body) + +To test \"client\" model + +To test "client" model + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testEndpointParameters + +> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## testEnumParameters + +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List<String> enumHeaderStringArray = Arrays.asList("$"); // List<String> | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List<String> enumQueryStringArray = Arrays.asList("$"); // List<String> | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List<String> enumFormStringArray = "$"; // List<String> | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +## testGroupParameters + +> testGroupParameters().requiredStringGroup(requiredStringGroup).requiredBooleanGroup(requiredBooleanGroup).requiredInt64Group(requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute(); + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + api.testGroupParameters() + .requiredStringGroup(requiredStringGroup) + .requiredBooleanGroup(requiredBooleanGroup) + .requiredInt64Group(requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **Integer**| Required String in group parameters | + **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | + **requiredInt64Group** | **Long**| Required Integer in group parameters | + **stringGroup** | **Integer**| String in group parameters | [optional] + **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] + **int64Group** | **Long**| Integer in group parameters | [optional] + +### Return type + +null (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** | Someting wrong | - | + + +## testInlineAdditionalProperties + +> testInlineAdditionalProperties(param) + +test inline additionalProperties + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Map<String, String> param = new HashMap(); // Map<String, String> | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**Map<String, String>**](String.md)| request body | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testJsonFormData + +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testQueryParameterCollectionFormat + +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List<String> pipe = Arrays.asList(); // List<String> | + List<String> ioutil = Arrays.asList(); // List<String> | + List<String> http = Arrays.asList(); // List<String> | + List<String> url = Arrays.asList(); // List<String> | + List<String> context = Arrays.asList(); // List<String> | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List<String>**](String.md)| | + **ioutil** | [**List<String>**](String.md)| | + **http** | [**List<String>**](String.md)| | + **url** | [**List<String>**](String.md)| | + **context** | [**List<String>**](String.md)| | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **200** | Success | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..14a74a37a4e2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md @@ -0,0 +1,81 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +## testClassname + +> Client testClassname(body) + +To test class name in snake case + +To test class name in snake case + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FileSchemaTestClass.md b/samples/client/petstore/java/jersey2-experimental/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..3a95e27d7c09 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/FileSchemaTestClass.md @@ -0,0 +1,13 @@ + + +# FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**java.io.File**](java.io.File.md) | | [optional] +**files** | [**List<java.io.File>**](java.io.File.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md b/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md new file mode 100644 index 000000000000..d138e921902a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md @@ -0,0 +1,25 @@ + + +# FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Long** | | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | | +**_float** | **Float** | | [optional] +**_double** | **Double** | | [optional] +**string** | **String** | | [optional] +**_byte** | **byte[]** | | +**binary** | [**File**](File.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] +**password** | **String** | | +**bigDecimal** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/jersey2-experimental/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..4795b40ef65e --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/HasOnlyReadOnly.md @@ -0,0 +1,13 @@ + + +# HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/MapTest.md b/samples/client/petstore/java/jersey2-experimental/docs/MapTest.md new file mode 100644 index 000000000000..c35c3cf2c0be --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/MapTest.md @@ -0,0 +1,24 @@ + + +# MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] +**directMap** | **Map<String, Boolean>** | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] + + + +## Enum: Map<String, InnerEnum> + +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-experimental/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..3dc283ae4936 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,14 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | [**UUID**](UUID.md) | | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Model200Response.md b/samples/client/petstore/java/jersey2-experimental/docs/Model200Response.md new file mode 100644 index 000000000000..f9928d70622c --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Model200Response.md @@ -0,0 +1,14 @@ + + +# Model200Response + +Model for testing model name starting with number +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ModelApiResponse.md b/samples/client/petstore/java/jersey2-experimental/docs/ModelApiResponse.md new file mode 100644 index 000000000000..14fb7f1ed27b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ModelApiResponse.md @@ -0,0 +1,14 @@ + + +# ModelApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ModelReturn.md b/samples/client/petstore/java/jersey2-experimental/docs/ModelReturn.md new file mode 100644 index 000000000000..5005d4b72392 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ModelReturn.md @@ -0,0 +1,13 @@ + + +# ModelReturn + +Model for testing reserved words +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Name.md b/samples/client/petstore/java/jersey2-experimental/docs/Name.md new file mode 100644 index 000000000000..b815a0b4c994 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Name.md @@ -0,0 +1,16 @@ + + +# Name + +Model for testing model name same as property name +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | +**snakeCase** | **Integer** | | [optional] [readonly] +**property** | **String** | | [optional] +**_123number** | **Integer** | | [optional] [readonly] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/NumberOnly.md b/samples/client/petstore/java/jersey2-experimental/docs/NumberOnly.md new file mode 100644 index 000000000000..1c12b6adf3bd --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/NumberOnly.md @@ -0,0 +1,12 @@ + + +# NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Order.md b/samples/client/petstore/java/jersey2-experimental/docs/Order.md new file mode 100644 index 000000000000..409fc4cc9616 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Order.md @@ -0,0 +1,27 @@ + + +# Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/OuterComposite.md b/samples/client/petstore/java/jersey2-experimental/docs/OuterComposite.md new file mode 100644 index 000000000000..e06292218847 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/OuterComposite.md @@ -0,0 +1,14 @@ + + +# OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/OuterEnum.md b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnum.md new file mode 100644 index 000000000000..1f9b723eb8e7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnum.md @@ -0,0 +1,15 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Pet.md b/samples/client/petstore/java/jersey2-experimental/docs/Pet.md new file mode 100644 index 000000000000..37ac007b7931 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Pet.md @@ -0,0 +1,27 @@ + + +# Pet + +## 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** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md b/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md new file mode 100644 index 000000000000..875a8e6783e9 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md @@ -0,0 +1,656 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/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 +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + + +## addPet + +> addPet(body) + +Add a new pet to the store + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> deletePet(petId, apiKey) + +Deletes a pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List<String> status = Arrays.asList("available"); // List<String> | Status values that need to be considered for filter + try { + List<Pet> result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + +### 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 | - | + + +## findPetsByTags + +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List<String> tags = Arrays.asList(); // List<String> | Tags to filter by + try { + List<Pet> result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## updatePet + +> updatePet(body) + +Update an existing pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 + +null (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 | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.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 | - | + + +## uploadFileWithRequiredFile + +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.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 | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/ReadOnlyFirst.md b/samples/client/petstore/java/jersey2-experimental/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..a692499dc661 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/ReadOnlyFirst.md @@ -0,0 +1,13 @@ + + +# ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/SpecialModelName.md b/samples/client/petstore/java/jersey2-experimental/docs/SpecialModelName.md new file mode 100644 index 000000000000..934b8f0f25d7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/SpecialModelName.md @@ -0,0 +1,12 @@ + + +# SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**$specialPropertyName** | **Long** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md b/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md new file mode 100644 index 000000000000..6625d5969ee4 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md @@ -0,0 +1,276 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +## deleteOrder + +> deleteOrder(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 + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +null (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 | - | + + +## getInventory + +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map<String, Integer> result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + +### 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 | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## placeOrder + +> Order placeOrder(body) + +Place an order for a pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### 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 Order | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Tag.md b/samples/client/petstore/java/jersey2-experimental/docs/Tag.md new file mode 100644 index 000000000000..f24eba7d222e --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Tag.md @@ -0,0 +1,13 @@ + + +# Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/TypeHolderDefault.md b/samples/client/petstore/java/jersey2-experimental/docs/TypeHolderDefault.md new file mode 100644 index 000000000000..a338fc900cb1 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/TypeHolderDefault.md @@ -0,0 +1,16 @@ + + +# TypeHolderDefault + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | [**BigDecimal**](BigDecimal.md) | | +**integerItem** | **Integer** | | +**boolItem** | **Boolean** | | +**arrayItem** | **List<Integer>** | | + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/TypeHolderExample.md b/samples/client/petstore/java/jersey2-experimental/docs/TypeHolderExample.md new file mode 100644 index 000000000000..f8858da60664 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/TypeHolderExample.md @@ -0,0 +1,17 @@ + + +# TypeHolderExample + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | [**BigDecimal**](BigDecimal.md) | | +**floatItem** | **Float** | | +**integerItem** | **Integer** | | +**boolItem** | **Boolean** | | +**arrayItem** | **List<Integer>** | | + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/User.md b/samples/client/petstore/java/jersey2-experimental/docs/User.md new file mode 100644 index 000000000000..c4ea94b7fc17 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/User.md @@ -0,0 +1,19 @@ + + +# User + +## 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** | **Integer** | User Status | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md b/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md new file mode 100644 index 000000000000..ca9f550c3167 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md @@ -0,0 +1,525 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/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 + +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> createUsersWithArrayInput(body) + +Creates list of users with given input array + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List<User> body = Arrays.asList(); // List<User> | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> createUsersWithListInput(body) + +Creates list of users with given input array + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List<User> body = Arrays.asList(); // List<User> | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (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 username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> | +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> logoutUser() + +Logs out current logged in user session + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (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 user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/XmlItem.md b/samples/client/petstore/java/jersey2-experimental/docs/XmlItem.md new file mode 100644 index 000000000000..6065fd1f4e59 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/XmlItem.md @@ -0,0 +1,40 @@ + + +# XmlItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attributeString** | **String** | | [optional] +**attributeNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**attributeInteger** | **Integer** | | [optional] +**attributeBoolean** | **Boolean** | | [optional] +**wrappedArray** | **List<Integer>** | | [optional] +**nameString** | **String** | | [optional] +**nameNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**nameInteger** | **Integer** | | [optional] +**nameBoolean** | **Boolean** | | [optional] +**nameArray** | **List<Integer>** | | [optional] +**nameWrappedArray** | **List<Integer>** | | [optional] +**prefixString** | **String** | | [optional] +**prefixNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**prefixInteger** | **Integer** | | [optional] +**prefixBoolean** | **Boolean** | | [optional] +**prefixArray** | **List<Integer>** | | [optional] +**prefixWrappedArray** | **List<Integer>** | | [optional] +**namespaceString** | **String** | | [optional] +**namespaceNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**namespaceInteger** | **Integer** | | [optional] +**namespaceBoolean** | **Boolean** | | [optional] +**namespaceArray** | **List<Integer>** | | [optional] +**namespaceWrappedArray** | **List<Integer>** | | [optional] +**prefixNsString** | **String** | | [optional] +**prefixNsNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**prefixNsInteger** | **Integer** | | [optional] +**prefixNsBoolean** | **Boolean** | | [optional] +**prefixNsArray** | **List<Integer>** | | [optional] +**prefixNsWrappedArray** | **List<Integer>** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/git_push.sh b/samples/client/petstore/java/jersey2-experimental/git_push.sh new file mode 100644 index 000000000000..ced3be2b0c7b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/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/java/jersey2-experimental/gradle.properties b/samples/client/petstore/java/jersey2-experimental/gradle.properties new file mode 100644 index 000000000000..05644f0754af --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..cc4fdc293d0e50b0ad9b65c16e7ddd1db2f6025b GIT binary patch literal 58702 zcma&OV~}W3vL#%;<*Hk@ZQHhO+qTVHwr$(CZQFL$+?np4n10i5zVAmKMC6WrGGd+F zD|4@N<RpPXAOQft!2tjO`2QLJ0MP$B0suh#JxdEK@l%V-h|mH9$o-q6bsY~k-(Lsb zzlQXGI!g1)h>Hj-D$z)bJV;MYNJ&!D%)v-fQ%q0JG$_z5GVUJTPg0MHPf1Tvic<kX zo`)DE9~Nqmx1tgk9~M#sp%SAY6{6fZ+&KXLml^*~^1mMq<nOhugX#bERR5<B)IWVp z9rTT?jQ^jmi2v^D>Y#6DXYBBQ4M`$iC~gA;06+%@0HFQPLj-JXogAJ1j+fRqw^4M` zcW^RxAfl%+w9<EUj8>SiS>QwBUTAfuFAjPXc2DHf6*sr+V+jLQj^m@DQgHTPmAb@F z8%GyCfcQkhWWlT31%4$PtV4tV*LI?J#C4orYI~WU(cSR{aEs^ycxY`1>j1po>yDMi zh4W$pMaecV*mCsOsPLxQ#Xc!RXhpXy*p3S2Hl8t}H7x#p5<WRyv}DXB?O~G(<$s$* zKaOKsPlhxwVsG;yzcbFHI7dn;N@!ew>V6G5va4jV;5^S^+>+x&#zzv4!R}wB;)TyU zE_N~}nN>DTG+uZns%_eI=DL1E#<--Sccx30gvMT}^eu`2-u|{qQZ58(rA2aBYE*ZD zm|*12zg*@J$n|tbH%Mp|d|O9W%VT~<mtdFxoyg6#?kijTREKTws{`nYl9fj8r{K~0 zMu0f8cYQ}X31$v~y4H25-D)q8#heTIRfC~{opJg3^7Ooc5b-v2z7D{(ZN1$J#;pIq zcmMvi?bwYCS7hZ>xG})R=Ld5z<(z%DOO6=MF3Xh-aF%9Hf$?1N9%8Pkev{wun$jZ2 z^i*EhRt8Ve<7`Wyz~iMZDye+XVn}O%qbhV`wHL+%P+n)K&-UMuZw^RRfeQ)%K=k*m zq5l7mf`4K_WkV5B73~MxajljrjGiJqpiV#>0FkyyrB)@HY!;Ln(7JJ*W(>d5#^ubU zVAkTMs*CHzzvUa^nRu0<X(7d>*f-(ek+VZw+@P~}a;;(K=|!9Mhv(~y-ml<QTm%4- zL1zFI0#z_Ik&f69<7WJpKZ%Y|Uqu8u#Yk(|li~Oe@<?YCJc^N4pR#=?u7HeOb+Daw z|1Sgu27*?6Lo8NeuhnoJFCu;@efib#$O1fA8h!C$A3(g2{2*g6<8h|8Ec!-=v=sD! z5+_Ah8OB$HF-qv~DCJ$~4dt!FhNO9dmXjvoKr;QMam!)kspTQh=u_8Z=lVD$>W);J zb&bB=vySHG`u?j&_6dh^*se*l_B3avjlE|!!Cb0pXyEXRbLy*@WEQ4|)M<`p8<Y|5 z2%93>Q!rfDJ2RI!u1hPzNjy&)(kcY~GaD6?)7#dCbm`NF<g;7l5g5&;Mj%py#Ra;y z1f5hxOf`Wvp;B#xff%qI8u3<?PxNalP0$dvK)<OJ=xo<{oLC}PR#F@5qU=twiZ#W7 z67lXxhom0vf~r;n1SbcUy7Uvu7@IU>h?Y_g$#!+Qrie7%<7P}<-+W@{sxi4JYI{iY zk0(>m$DxOI=~-&eXf2bfh^&(U@o)>(iA1_wJ%B(+nFH+ceib%H<b^rOPv2E&MDz*+ zr2XQfL74H-frDv=SY0Pdq#DCW*_^D%3zICZ*|CytwcjZFf`LbQNP;uT36ha5;8j5z zkkE-B2=@&q?8HR?nCy^Lm13`I{xIWZ1-Sv7kk=8002K(!NL~T5$eRP+<1|gK;}^wB z*p}nK<Oun@j9xNT6dC~v8w$#xy1SB~x_g%Ag&y;aA<D=3-H_dVde~Z37)+5$(13@U zpgVj10XKJk#h1vTR=Z&VxVMA@vy>Eck32QL=J(BNFh`f>St1%llF8chX7#cp*;z}& zcTeXkwsXhf+e;#<mHvK))RWS2J3{sLW+lTJ7aYn7N;z>#!FS2yi=2cChcYfzm$wQJ z9%4kAq)wLHf5wfcj!A|xDsAiAOHRzf*)Z-|daN9y5jK-*R{Q0?xaSX-3m|WeuZ`BJ z>eTi@uQ{OGSDIJ#Iu@JPtOy!C?q)g*6SHORg)eAJGh8b-I*X_+xNqZ|OXEsQ-RWte ze`zjjeV9PpE3ac2za+Rs=PA;%QZ>T{x(TRzwWLp_X^2yC-DOEMUy5So!npzL&-@}u z#>uK#&`i&c%J$!bsntEJhY@rF(>6eY;6RoI5Qkn!&<80X5+1(<A$tFH9m~_-ye9aQ z>x$T|wR-ad?4N1N^a0)nBj#&EkVvQ?I_+8t*%l#VK&I?uo$ERI1HMu4P2rLMeH%m3 zZ|HA^*O^dA$gb<A+8nWE*k|^~9YyriduFNhhxV~rFy`G?Fp=Nyxg%Hcw9t{3e=8LB zF)zo5Es8J(TDV5xlhq!cIHF5nZif)&_hum~A2pjjr;tmkr{n=0C`K<u%<PnC^Yk2C zzTu%X@i-=%OlQX7fplhWP?xe~(g>$`Cw;z9?G?m3@nH6TNYJ04Fd-M2wp8@(;vAvJ ztFoni)BLwncQ3@cO*^+6u;(&D<;N;RKb)_NQ_Qu&?@h3MWvo>6FHG%%*smTwj3;dG zQJnT7Wb?4!XmV^>N@ZkA7Jv9kAfD-gC<I~>Hu2i+!A!}y98SO><8g}t;1JOOxj>#l zM!?y|j5fR3WY2(&_HSGjgMa?Zif<<W?VbNO!_NOT!vCCUg=}4ItZem-{<X$>M@d8W z)4>Ptm@zj|xX=bbt$=j}@a_s|xdp6-tRlq6D|xb_;`9oJlkYF1AH%?Pzv$eIAogMi zf(_H*5t({Arfs5XAPj46pjiudQw?dulW-=OUqBVa)OW9E;^R+NDr&LES&m_nmP>Ga zPf)7_&Gn(3v1qu_a^qW9w4#XIEfgiHOQ(LDi=E&(-DcUSfuQE0`ULsRvS}fpS@<)3 z|CbQSi49rU{<4|XU;kiV|C7}Gld$}Yh5YXjg^W$~ovobybuZ^&YwBR^=qP3G=wxhT z?C_5Trbu~95mOoIXUmEOY646_j4ZL)ubCM{qFkl1u*%xs%#18a4!(*b<&edy<8t2w z_zUxWS5fypUp9ue+eswoJSyv*J&=*3;2;q9U?j>n^q?)}c8+}4Ns8oToBJgD;Ug=y zOa0>{VFrLJutjR{PJmm(P9lPzoPi{K!I{l)pGwDy59p-uxHB9I&7zl11lkCu(}*A< zh492AmxsgwEondBpB^{`I*L&Ut40fjM^JS8VdAWQMlwc>_RUM5|Mjes!36DGqW`xs z4tU4`CpOk|vew8!(L}fEvv5&-3#GqZ(#1EZF4ekDQ@y*$tMDEeG?nOUiS-KXG=rAZ zHUDlMo@X&yzo1TdE6b6!s#f{*45V-T3`e2)w5Ra3l>JWf46`v?Y6B&7*1$eS4M(3% z9C~G@<i(!>N@RXm)8~EXL*9IObA+PwD)`%64fON_8}&pqjrg|<uecKJ--R_&hYSS; z45Wc65)1%>2LmP{W^<0@W`9s^*i#F}V;E8~`-}(4@R4kz?t(RjA;y-r%s^=)15%C> zbF;NZET~nybEsmUr8sH^Hgq^xc^n$ZP=GcZ!-X-Go7J4nByj8%?aQ`c{88;p15K<V z_d~|1+?4Of*5i$x2xWRe8tvdys2dG>f>|0h+5BLkM&@KI-(flp^npO3MC~W@Uyjv* z6Hu!4#(NtZJ0*;_{8<J7i=0az&%(<wS04-($bOqbcbe=uYc<`1Rb#j%;6L!T%ZS_V zMbGG<3YW{=7)G%MCMRNB>^xcLrC4-zK$BVo7S5V=eg?R8P;BOpK3Xwms+Jt-8R6us zf_rUHFYHn~lu!)U$e$#%UBz7d8YS;mq}xx$T1PIi=4={c-_cY6OVc<=){mOVn>~J$ zW*2PB%*40eE^c<dlxK9Bvqt-M7aU^3PVe-^Jdu~jOmq^mOt%KN4?i~W$Rz0zz3gTI zO10DxC0A~Xt|6f*@>+d=PP7J@bqIX_h4u6b6#W|ir<;IlR`#s`Q*_Z8Q?*s<ipU}C znJI(0^W}FQE#0cJ?}zrKq&LVFW@=gW@-3uOe9H}<#JHT}p&{DB{3o-4!x`}b_o6VK zx_QKsJ{r-=Y5h-fZFj+CH)$d6Y$&chBrmxO`M#7{#wFMtQhdY~p2sMLLWhoXb?h@o zqg!S0;-k+JS<Moesi8@EgD2<{{X!b%EaE#h7NN;r&^HdO_%wt!GRa&Fc2{T!e6b=# zR{1MnI@pu!?=15b)mgWnY9L&^02S(JQaRCkQ;Kui#Z+B;pq{udS&lnShF4(1SIHuW z_)%trHzwlpgrUL&*@|H!)`f}k!qoM#LZ&1o>_&emuu8D;NSiPX9mK?>$CwcbjhCuv zO&u(0)@}8nZe=Fl*0uMri02oYDjs#g$OHCZ6oTXV2Y0TrZ}+o%{%i)OAJBj2xHC<V zJg9%`K&ii}iRu3%^Zw04ZtncfPG-h7PUeRCPPYHdL`jNQHVFJk+zoOlEs{gZeHtJ7 znimR5MLxoT^yYLVBxdPK8L8jt{UFO$u48m!?v&9G@X}rYxZ`f7l9c8UOJ8-2jyLQl z*_^Bo7cVb4066<)!Rl1%wRJ`Y?9s?jEp_R`8W<NIo+JHW*BWBI%ys7bID+TFxbNr0 zg8kH&^hA{M+H_jg?|E)3>|F5o+`Qmq`$`2EaL=uePwq%k<;6S2n=w%_9vj$8NO|{` zTEg*tK8PU#DnQ#dQ2mMJaaL|HV;BCn?eQ%d0v<K_HfTbf-99?GlXN@q7NMtGV#^~A zK1d9eZNcZH-)WwCa@$67YlGe)%B~iBRrS~FY!viVx&TJCE(I}_;Va$O+>Y@S7Pu@7 zsf5u`T=bL7NfyYO?K^PR_|jap@<F00udMd{#(px%QdVnBTcYiwhKRCg5kIbJ&~1u_ zrU;RW878B{gMOhfwk<0v`+xLRW`sq8l(<7+S~$Su=ixAq`rqIO8X$Uo3r%K*M}s0L zq-k1;4vh%TP@XBF-yn#eDLwk36xRnKyD%`{C3|NBLAn4q+#Bbi=^EJm?vhx*>K|qQ zmO8CK+&O3fzgEnp2|_=^K9ln~QhxjgMM>EQqY@k@@#np@FnZq|C{EyEP7^NurUm0q zW5rKmiy%__KE>YItA<BWGcGAzq0!#vJ2KS5%v%gT395&RU@W@)Dr)Tn2kOsw{~c(u zSvk0UumAvvH~;|n|8JoEV|}Yqhj7zUb^eYuahEM988Xy-UJYlAF%(_K;EchZ2uGZ_ zSiKipR%56?V3VCsV0tzaNpm;URQKcCLNS93ZVcuFhZpm!WkZUULZWk`r`A3dK$SR4 zpYL+YD{2IJ>TyMhE({0%ve10la=mUd<^AcB{T_$Y`2_N-x;F#3xTORXvhPZ7psm<b zUAnad>qhXy?WxxB5w!m*4&Q;?t$4Kt?m_em-htVDxora24&6~5z$MG(RT{trtp(L( zy&VDT{@p9_DGoq+I|abw$E!TyTO7j6dWQ<wiR)Vy(!+3D@A2&nAbX$*_zCl^0^_SH zZS8Bjj|=oF`kCPG%W`)Gz_O?7CFhIbhw(}IP3>25dqdKV*z3E?n-p|IG42ZUnNok? zY4K{y{27bUT@#|Zcni!tIgjE`j=-0rl(tVlWEn>5x7BJBkt0iw6j^4n1f2i^6ebo; zt^&Yb##}W0$3xhH&Nz*nANYpO$emARR6-FWX;C?(l7+}<97Ay#!y%BI6^st=LaJ>n zu{ORVJ9%`f*oy85MUf@Fek@T_+ML0-0b$lkEE2y8h%#P^<E#sUGr^uAAmf?6z=dV+ zT2fn#MB!P?mV-Ijg(2<QZP<B~3_RY+-a>X6+cn<CYt==OX!%7nR>)IEXa@T7CQ{fV z-{^wJGN*+T!NsAH@VNM3tWG;%y{pV<xGCY<FKd*exDmpl{T&W#b;p$ig}qG|?>F2m z2*0+i?o40zSKVq_S18#=0RrJIse+;5cv#a`*`wNs+B%Ln8#e0v^I>7a_33h?lHo14 zg)CbDfGMyH2cj%7C`>|Rrg;U?$&y!z(U10>(dHKQsf9*=z)&@9u@w%y+e@*CnUS|E z*O^cQqM*!sD|e!u(yhXPi$Sl<$daf3sq@Ie<ZQHLniQg<q{eeW>xafxt3F#2R&=cK z!gT-qto{oVdGUIxC0q`tg)B-Zy(pxGx}&svoA}7p=}jb3<Deq;uYCwnOS;Rr-^Lgh z20WA(rh{XxcSiiGTc2H2eqX4eS>jEjQ!v6=afKI!2`&M{#tY$~3LR}#G#U2up2L{} zMGSX>Yjg6-^vWgeX0i;Nb0=gQmYa!|r0rRUshm2+z3AlehjfTqRGnRAmGhHY3`R_@ zPh4GAF@=nkRz;xMO3TPh$)9Iq?Fs5B@~)Q<G^#^w-p1z4@tK-Tg<F4M1#K9OBJnk0 z+Ooh*FXc;ku~92E;V-A4fXBlIVb(;ppgmHu!r^G8PLCtrG%kb2we(sar!y-`MdAy{ z`=|e8**Dv6<X|mR*OrwDm@5nX385dEvX#Jf-n>IntSyeBy^10!ts?9Z@tK&L6xJd9 zNzaaz<rXw;6ED)9yFL}aX;}zw-PcebRxU3jIEY~o>6zvrtr&MPQ@UD)njFUtFupwB zv+8%r`c@#asm}cKW^*x0%v_k3faHOnRLt7vzVFlqslue32rt(NNXnkS+fMSM&^u)8 zC`p{on>0pf=1id|vzdTnBLB;v%*ta`o_lzj21u+U-cTRXR%sxE%4k<(bU!orfsJ&v z3FLM2UT_*)BJm1^W;Z{0<d(!lZ_}A{gA{p}>;z^_e=N&QXSO>rdB`*cp>yGnjHJt$ zcJd~52X&k1b<-`2R{bqLm*E(W{=|-)RTB*i$h4TdV12@beTkR&*iJ==ck*QlFiQ52 zBZ|o_LP06C?Sgs3VJ=oZQU0vK6#}f9gHSs)JB7TU2h~}UVe%un<qkD{F?01SaaNX7 z)^EWW&3Rg@z9Zs4r{qbscuGj<-Fl||#+VyPb-*E+wTI3OW@F;)#D4fM>JA!URBgJ# zI~26)lGD4yk~ngKRg;(s4f@PccDZaL{Y=%6UKHl&k|M@Zc4vdx-DX4{belQ);URF? zyxW+|Ziv}%Y<r9Dq}a^~ObiFm4~Y;n`Vy<s!I7z$$Hlk&*e$o<6C~KU;}qG?cDDWa z>!sFdY@YO))Z|f34L(WjN*v#EfZHn6m)X@;TzQ@wIjl4B_TieZY}qY`mG}3VL{w?; z&O>sZ8)YnW+eLuW@rhClOOCZe2YP@4YWKN?P{c~zFUj*U?OayavPUo!r{uqA1<8h! zs0=rKKlwJYk~34F9$q6fQ&jnw_|@cTn{_kA8sUZ#2(Lb@R$NL*u>08yYGx{p6OeX~ zr7!lwGqMSury(v5=1_9%#*MORl2apGf(MQIQTMN35yE3l`^OS7r;SKS6&v-5q}Gw* zNWI*4OKBD&2YbCr8c{ifn~-9w-v+mV49W+k)$jjU@WA+Aok01SA#X$Sspj}*r52!- zNqOS<0%uMUZeSp+*i1TEO$KGKn7EwzW=s?(b5X^@3s5k*80ns2I2|bTHU+bWZ$x;j z`k@<m7i|D;)p+5h2=doQb#<n7oFI?h-8r2Le0MiDcODojim!C5C7&lD!*Tb;{j^M! zwo4_dJ|LYnc7;R>>)1G#JgT=F!8awgol?DqK^S4R*g?<j)Em0v<Rr^iEUud)JcOH( z;j}xl%Ki+t#kp}5-1LyHCEG}dwhXenu4yedz7AtrlzTlWS~@$is%I}VLm5qXh=H9c z=RD{ouN=1VZE5UvE5AADipriSPn0vLPSj+*b)YLV>e}2rOYRVMUKKxSudO(hOLnnL zQqpxPNouLiQFYJs3?7!9f6!-#Pi83{q3-GgOA|{btKup4fYDu-JFOK~Q1c3KD@fdJ z?uABYOkHA^Fc~l0gTAy4geF<-1UqdS=b=UM6Xi30mPhy1-f^aQh9H(jwFl5w*X`Mh z=Ee5C<tYtM&3HgW2B%f^TRXT=U62{6MBC$8$4Z|{?j2f=zZggy{xnO!otRFog--_9 zp;oV#6Ml}L5D_jvr_=ldE2?RSY|XQmVlDd>?038GEqSVTd!67bn9*zQg-r8RIH3$$ zf8vWEBbOc`_0U{b)t)Toa~~<7c-K_=G%*iTW^?6mj9{#)<L8!847Sdr#z3mABv$w= zEvStNJ~?l6I@Kk@27iwDE^HS$6ph<mYmV@yOUSNX1EEp~l?On9(o~Lc2;tl5;RQ9Y zjkp8xA(PaCi5E)TBzXDOUUEn0z7y?nm3B)!K6veo!9no=A7=FnV&NWZ@_OCgt8Z-* zR9P?lL2XPGWimt_QAsr$D9B_!LBI3p<p05_)1XA)RxB@nlp=pHL$;+Vb^E1Us>@|# zku9R^IDzbzzERz~fpxFrU*it;-Iu&<j;5*?pXVX-!@&XPBzIw**a7Oi8iCxJ)wdQB z-72`zNKM;jv``!`ozd8#?2)|0QkGUfElI&!1G)TUX6cXI*Q>m!CAtM&$)6^2rMyV4 z$+e!$(e)!UY(Sc9n6hkr^n&cvqy8}NfZz+AQc8fU9lNczlP>5D3qzWoR55YvH94^* z-S%SVQ<IE2ZA<>96pK3|Yo`75D&85)xij9Dl8AO<OG)v-)LY{lc$!e^^sZ4&kUDTL z^8>8{J*{_yhs-KtsLXUYqwieO(nfrkB@%|OyI>yF+1G?m7>X&djb(HBNNw3KX;M<Q zZL^M3x-GBRRlsrxmBt?Qt3_3n8|H*!`NZzQv-X~G6~2==G@5ah39Zu^LwW_nQbk3# z-gS{_`P|gn@Cwo@yVPf&Tulp7%VS@>a*oMV)cV0xzxmIy+5>yz>l_LLH)VyRnYYce zw$?q!hJzX0TlE0+o5QJDM~sPrjVCN7#|32#rUkc>?-eN6Q0RqQTAl~`&isrQg)ass z+x5XapaYh{Dj`+V096?w)w2!Cnmh?x1WmFC$jEFY4;V)XAl3*tBS)V)3TbL)g46_g zCw9pl^!3OCTOcaEP!?==guEAw;VZ}fE6K-;@qD-Rx~td+j(N>)Wv$_mq<O4G#`)_D zg%4ybW4PuW2>FTH_wVZNEEuDG!0T`HXLsf+_E=X3lw4`_&d5&YMl%H733ckO){vZm znF<wT-MSz)%0zh6H-vHoxb5hdUc&M}_nclvZU{HVN=o#;5dP|r)y%ciy(qvpjJJvY zFPLuYy}zIz(W4UF%1lwDB^|<#*Js%z1-~NS!lW9UOtvABw4uH1lE0Q}&5B+_p|MQP zWQ5y{y$#BD9FWrQ!2?U%&A*_Vp;=C9mDx6@bF4qx0(m#y8VoU9b!eK(bZyymm!B{0 z^hKOxhD1l-sIn<bUyT5jU0GYC3{4xaCT_doFRk*bv0S(zBv-DrE4P++w-{Hs*`hrI zUXE)^(!e)|Okq9Oq8x7%Li<C_Mh2jl2%!%z>LS`;5J#^`5~unet`V#*Y5In3yb|Ax z|A6b^F37!_z$_{6h{7l~<{u7{Fx*A*#zw{GD)6e}n6f<|)&7`S-txiz3Jm4S5hV&8 zm|Ncc{j_~`^pQ*I#w21;(jwi8GnH4efO;R|r4<G1p%Ku<jzuUqgF5G$#u;0Y_4VKy z(y0*MvA`MV-?s}9tXk6{f++pmOHa}y`+-3@Seh2+f1TuN!2FS)^;MgoZ6CF?HKKuQ z+SKF!^o2&LHFUuvqQ}h6(`V&A+69=iKPfqG;f0Zs)@MJ=ChHlc?hBZ+R~fr{3zbP8 z=F^FEG2*P{{(y((i=t{)5Mc*ZZc?^gV40BhN0Asi<H-J;I!<g>$tH~i;Bcmp^sP9) zjhJne@yzU&XvFNoc~i(wQ?nE`o6Hk~!;x(%xh7?zvigH2g`!v<HwxDXh*xMMM<3HW z_4L_Fy~v7Oy+?S3!Iq}+)$tv#C5(_ZnW6~n9#W&J%Udh6PZE@~ho88dPWG4VLjU#d z*ZMl+`1&p|7H1c~Cbw4~{?qNRP)w;Tz2zQOmeZpFR7|6^L9j3U>8L-vEN0DvV3?m( zSW(TZ%2AWf`rS}GGMqUj!8yCp#|fR--Vxfj=9}YD<U6o`xy0)+sf@3V>97Gocdj=S z0zkF-jsO>EcPTB1zRO$++k^bH%O`=UkHdHT^5?{$)ot<-K2XIE7js*4OjF)BsVjCJ z*KN<g*T3%mQu%p*>)!FdM*sh=fB$p8*EzZmGJp?B_=a-90$FI{S$LLjBU$(lxUj;9 zIBszmA*129W+YE;Yy{J~3u<Twd*;f=9Y}3|Z{SIuZ0cY+jRWz)tb}ITlr##&NYEYC z=%IE*Kowigv*k{XF8F|)GRMAlI-`F3SD9!P!qhNGS)Ep`PBV#qo)ZBA^+Bd^m9cs~ z$`4ZiX~slGCz}>yOr<2A(`*cu0IJN#tmUfz2jIWQi_h)_-V6o+5CjbX!1$lz6?QYU za&|O#F%~hmGUhil{M+J|*0<3&{a1%ONp-^!Qx*LOTYY}L!r9BbTxCjHMuUR0E(uH` z!b$*ZMdnB{b2vsb<&P6})+%O=%a8@~$fjbtfF@Z>^Q@enTOJ%V<CRnekz2@P*(BWn zCbTbLtoL3pIvQP110{Pmu@v|7nq&9FR?p7M)w}G^*B34TR$q-1SA?lX?tyyKq=lP| zD3b1?os1~fOzA+%;&o>T)Rdc!wX|@iq9i}HaFZAeY6g8xGZY7h-r1sy_<#YU6}I?L zwvf0ePE5PKbK>2RiJOFO5xNhMY+kt`Qi?Oxo&@xH$<^Q;Nb(&rjPBAcv;XtmSY90z z;oIFFl%lDq$o&kYQ;aSHZHD@W({Y1hw<-I>7f_X8wc?%hNDlo~Ig;63RlHNhw~#R3 zA*f5D_Qo`4_ajY4Gr{mLs*(Fxh(U%oua_u3r%`H!TI)@R!!iqV8IOhIOzI@=7QJ=G zV$(9mEVL(7DvPn0j%_cOZN|vvNg8*PHma`6+oS;PDz%iOFyo0n0e%$<#A3r~$=I0T zDL*{AREUGx&C2}?I9cVL`UcPyawTqA4j-4%Mr-4`9#8GX1jiJkKGpHVr1~Rj#zFaZ zqmE!<|1JCi!LDG?1^Ys62xz(p;Uu!QZB7!C0#piy1_9=e?^s@-sd1gs!h$;Q`TNtf z3N4Elsgl#={#U`~&}FNvH78MLjjavl1x*4pNVr338>%sfHu>bxo2#eZN2ee9q#*Jg zDk_=OBR;8t6=pBN0aj)&Nj}pzqqUYW(tfk?bXTdKbNQFSUMCyN-!b0#3?Z;ijzx$M z^Eo6Eq*NO!Y8K;84H4MHj_xwBYc|3>+D(PFj7ejhECG@5@Pk&8dG<)HwwO2~j7KV6 z0$s}=*D;ek#8$a*sxVlC_`qFkM0%BQQ@v2H&Aq@G9XCQt^^x<8w*=MbZV)@aPrrn; z`6r*&f`x&1lp)`5>-|-4%l&W4jy~LydfN;iq?Y8Xx>Sh#2Lx@FXo|5{WKp@y-x;)7 zl;;<Qz|a;@wP~yH(!0er%z<lyLwxk~5K2ICIx(q03AW??arZ^Re4=vD+%Qa;I&F4g zI?4Z}!kS90ccrTM|0F)(Ny9-x)u-w(Q0I(6NYylHaaesf-hgEvl07qa8t-ycTfDaU zx7ce8&_aJAsH)F$^4CN*dou!oK5rsAM1OQNDH3*Uz(&F7NYT1oE0o5oWkLM*;uv*K zt$dbxIX2IaJ4#gFKbn?$aS7zCp4~$VPn%r6s6ueAExSADz!%@`ZRT#}|J@axf)XB9 zJC_Y*Qlfn4E~S>_Y*-Nu3pcH-)p0(tP~3xO_u~>HpCdEfgyq7V-!ZZ{?`6v_b-vx< zuu|gm5mG6c@D{FYMLuzvG+A2T&6&`n>XM%s`+Qtj)5XdpyFOnz3KLSCOxaCEUl()M z3b~FYqA3FT1#SY{p36h%M^gBQpB2QzEdtM9hMBMRMu{<KhV173&yh!JiTXWL8LIaT zOjx!yF5Y~@2QX6?DmX7nm~fkm{Z=drRxd2qWGo6EcEsMotJG@|eCqE$8T1IdA2uFI zn)L8bboxf1{cvO<Q@CY#O@6OuFeaM}OS3a6yRyDk|7FFl&M9HVISd!A5ySJfXB33< zH6Ltk%G1=U2^SZIu+0}{BiC(|w$#xf^zkq58$yREuJUj#$?~IEG^NJE=l2b^_JBhx z+Y?~cTRocOh^0T{LyC78IFM+nKj{%WgVjn=P|8f&9pPIyl|H3PkJYSQp)5(^7|$-( z2j9D3tgu@G8h9loVyBQu^A&ug*qw%WMLijkRx=5$S&Yl{7%gc(JqLz!!&uGXuunqr zLPD-~Jf+!(a!($Jv3A~xOXDDXYyx;#rq<I96eLi(M5<|vkQdKDl#dvek6<wl%igd( zBCtLDygreDi)2j!{2JK9BW&Tmw*z-MpB$g4!?h9izxxVj*{Wcm7cvqE!aG-k<?B!l z_W^ErgCRVa$zc;t>|rf}(;S85&|A!|Aj}?fMKaju!y>_AS}#hRe_!&%8V=6+oPPtE zOOJ-Rcrf>hNq<InXW^Acyh4TC67d>@lG{{@$H?6ikt@!A2OePLe{MBIWSPz7{u(I} z$PXzD;leHG?Xl0FnWt+Wr<rd)0uIC(aO;XiGnyqUc^y$z?J9`@apilEzT621F50PL zR^-affr-}-;(F?Jexj+E$T?v|csvv}yJ`y-1=;3z`s9u;FtRFIE9TQisLKt0+W|T| zad(XQdi&&fvX1gimra6ziGzr)?_|StV|w^6ZSOyqK~(O4_g6yx?yvke8Y0pEC0kQ= zG<FcPwKkTrwY7A%`=^FTaYJT<51t!}$R)~uF;Nl{NrIfHaS(KU9!fZ0kB>krk*|<T zm_!{ku#RvfFJE^l5~Nhj`%<u{teoQ_ND>e3P~YVF@N$y<VvG03=NpJF5EN8CO5Baa zP^%AQ9{~YUAT{w$t5R2JHh>&L929cc=#-!*k)HZKDo8!#+t|?9p0z1KSDKclB<j;< zSnOn_nFSh*+F1`LqurW=nESvpS@FG>&M6~hN5<9~^DIltXKR$+iK<Ozh!vaHa$Q;G z>*h9k$|@Qoy9H}PSI;b(v>w`8(k70@sfa4nRweeiwZ-syP3zPSsyK_8Te9*(FQdm+ z84ZDah4PGehH72w=Q8bx;pK5juT67rJKb|ovD#COI^l6z0eBidn$!Y?T2;5sN+vTV z$`%Edb<%-Oq@NPZy<2Z3m;$}!9JzIuVK6;fJi>><V{U}bUe=tba9BbGLiTzA7eS}O zEs!1TshDr>m3q!Lr!2xXRq+l0LvZIR_PNYrP57E#sCvD^4UU2GVr*Rx`QcT}yQanF z3i~!-2Vkk4S%4Hd2baDvrM2g(&1jZaA1!vLi!I#5wX6g^&PE`0-TovM(%wuaPXAno z`a&j{ai=TsgKpc1C3|)tY#!4>SPBbMnchi}glCBwaNE(4`gi}JY0;`|m`s{HtaP@& zHxwCt#2&z9A7O+=v>za}LW~}G>_tWo$dsRX)f1L=+tZF5E&RBA#jUC|N9ZPa_&z5= zekCOsIfOh`p(&S8dnkE~9#(;BAh8qzi5JYT0nP7x&Hga3v`XFdRN|$5Ry#mq*AN$J zV)l~LSq}2d{EJ@%{TLnkRVn*sdM{_b|4!x73|Ux9{%S;FPyhfZ{xg;P2ZmMuA*cMG zipYNeI7{u98`22!_phwRk|lyX#49r%Lq1aZAabxs6MP79J3Kxh0z1E>MzLS6Ee5u+ z@od~O#6yMa;R}eI*a|ZB$ar0BT`%X4+kyxqW4s+D3rV176EAsfS**6-swZ9OIPRZ& zlmIH>ppe;l28`Kd0z(alw^r<%RlDpI6hv)6Gs?GIpffKApgx^)2-6jAzjZE0BtPBC z0z8!#C5AP${zTF$-Z^v%^ie8LI*rvR+*xc=>fa;`SRUSLAio?qL;jVFV1Bw4K>D+i zyEQ}vyG2HTx>W?Ul&MhxUXK7n;yfN)QS`foM!4>4-(PGwxW!^^UyKOz(v+1BejI*& zQSkV|m5=JF4T0k*+|h|3dx`ZKBVX7H4{5iakAxnD#J=9igW@LS;HE_8$lZy1l|$wX zn<8-$u=7&li+^MB(1y~Mz7lj7?oYf%1k{wT#?(Mep094qqnPv7*OYkQ#7$pkU5U24 zzPLEwAb<<WoR&Nlw`OCRo!3>VIp_uUE~+r5)jt(>>Bg48_{)twH$QJDSBrUS!j{lX z)SK$6dfLWt)c9%Cml+sRp*OHXB?e<YL%nKD`AAfR55^ByJME|HKb?>4hbYZQo!@=6 zBPTpi&6&atD*#Cn6f@5<>79Mq7o0^E!NH)bD26g}?@qg%*AYeE6Tec@F?y9Q8i}^s zz`)l`8>;h75!kL!`&*<Cny^?$4#8Bbz^Rj<UZuvxBLNOENOw?+Y)9a4NuYnKrPi1- z;aFNQBSLVm(ME4w-NKhLSdhpfirJ`XcIKUEjk6$hIOg92XpA)f7NifoL_0XapO0I} zX^FjDP!O(linG*Rj~U7sKAV?8wZu)jVnS?eAh3aj7BfEa5XRr9a?q7dp7&V}E4EJf zjO=`cLvj#rX~~JksAh-kp58tE`Wmu<Zzb14`_rEmRdp`mkfb9wxGje@y<REs#!wtA zx%z2uQnW~&@>_hsX1%2)(lWr|7!}@gn%MfwY8vN0=pMm3WesCRv5e*5m4z|u(zb<a z<hzW!8Hc+~5!b;%r;imxC73kEBD`Far0GlqU&(W_5t(`OF<afCTSd%Y3K%Yo<w1(U z=KKreIbU=DF>YCpuxO9$bY)hkL|}mRj{3dlRgNK)#PJp#vR=k<Ex81u)$5OX?%u|0 zOu&uBD^9m;wj$6`$vpi4irSYi7AFjEFC6nHIIqerB24Ul$z=YW;9^+`7`hM)@4yW5 zr@#R19VHAsm+%0*j5(Ws3B_wu$j)vHkR#XRdHfL@&dHt&>a^TZ(tKVI<>M~ekIfd2 zm3UDUNW*ZvS5L|SF334|YD>LJk(EqgPpVxtzwclUNaH70zWDVt^1+cz|F?RdF4HHn z@4~Gs`lj!0dWi2n#>7C@B$Q<wpK@Qa@7|8Xjv?fC!Jhr6Y91c`Ad+yRc|YkmvV0zd z@N1eZD;xjgqMOX6H0hOE|0p$ru9Ag7lE!O{qPw&bgtVSxMYdGBOX*H-97G5mQqqY{ z*f%6LYn9wGDgN@?to?*kP`;J;$YbK~a^1{wUHLzuTO%@P@|uW>f7|t{1!3mtrO1H7 zi{=I#^Oa1jJiF<s{+1D`W#Q@uEQ|^u$n>I!j>PualW+ncHJ)TelW$bv2MqUG1xK7R z%TsQfTn)7D3}XYU+{?Hq!I&fqi4>DmryMiO?!aN!T4fnwq2vsuB^s6fPW@u*h-JwG zNniJFR(RI*?5HV=tqO)lv}CRv_eNEBR%z}Vnftv0+<L2TR|d~&9c0$|63rt}R#`&I z(}Mb-YqN4psHxY)BHNtvE|HaJ{&w^r-nDl7*OHiSc(6#W0xj^B<mPz^7AL`As86Z$ zdTu)l7LmpYF0UcII-t&#l<w6iiL#=825c&`kAgbp2ju-#YuT1M#4B-*ktfQ<tDw<1 ze}=5f6VQ=TR2w*oj|W|g=La1WG+NxSwo+A(kEPn{9%(v>DUH^OCODH#&;{+aw^1vR z-c~|Mk+o?j-^Z+rR4s<fWU8E{OXgT6m@b4f&bk3mV#sq0#Hv!gtIJYN2h`5GX+ke> z-gNA5guTuab7N`{Y@eT&)!xF8#<YnYQKehlL|Kqf9>AeetvQ6d!W4BlO;0#0TxS_( zMm-A-u+h7-PjmOQHlh{Hxn+J$jh?uEtc8RG8tu->o<eV4;cW9B){Rg)FmgRhNN>g@ z86A%eUt+P8E3oLXIrq#K(nCF@L12>=DVT3ec6Vn=B^B;>D=O%op+0BT;T)FHZ`I93 z^5|bpJC_kB92`alM40Am>Yz5o1gxkIGRYQ)x^+R|TCK)r;Qyq6+~S9Uy9nr^nkvc- zxw~#_9eBBJcZNK0yFZxUK4h>u$8;4k-KpNTblRgS(y&u~u&J;O!aqAMYJp+(BED*d z^I#F7vPOEADj}Pziprs=a{%qgz#eso$j`At7p<W_8t?MLKPKsl80)I%mY2++&U!GU zrt?3swTZ-+h~N9mFFKg!wsEP^yexxyN25#GR-^SrnGl!$(V&k=GfGS9yMzwlubwo2 z{`EB>N~bDw%&ba-+4pI}T*?w-z^_~DfD~Z3Tg+#M#u{s&uRF^dr5RFZh7<|WNEG;P z-_SzXTbHc^yD$r;WJqqJkA7^(zN`nzQ5V16nG~Zobuy)a)(T@<ha)S<cs(qVX&ObN z2UVTBWWV+20tc%<OXgDKjf+FdRfQms@H1TiA|=cT&G>Ik>V!qOf<yFMm{;2;Q41`F z5eqDf$B&;Z(fL<ROep%u!{R=O48j%AQzT)Z9T7G=5J}J5^QZ{BL?!t=1BV0BUiUEH z03C*CZ6eQPeDZPJFt&p9ke_v_;IHIaFY`qyR7jL0zX#_<dWj_3?#kY#wZ?LT&*Zir z8WiG{n9jp;hfg4ZRrauCsvRoPJ?P{ITj5;tT82Q)(7JN8YEC#C71)@XIjYS9r>w;e z)?AZXjzDJg%BkIEY&bm&BczLuWY~k}3Zyx#)jxg1A9R`sz!_dCb!|13b*3PiA@(E6 z9HmG2R>-YrW93UMQO}XE4loI(*er9J*wDUd1se!pzdp<L$3aT<v1RADvUBMM+QQeJ z<z{5S)X%p^dzb8X%ro~YV>oB_v6^lQl}+!6e5MS`+bU#_b*a5Pkt;o+lOV4loyn2P z$3;z-cX>$R{6M4q%b}aMBF}6N+0RCE70bB;XwHV~JLO&!EB)Cgo9ta_>>Os1HNfaY z4PNu7BGhw`6}cm>glh6i^)Ja{rpLHix?C?u;(e&GI{?!E7$9hd*5c^iL?;6Kwn z@qbBE|3UMF|F$Ok>7YY?CeMzMes@CZJQ?&|R8v5M@XvW}jjxhjl`gzl;rvy6Nn9$K z;1TKGpUgZs`vR!t-sD~2<GqGgCoXc~OBH8i>ar{58-;2k`H(MIWr_cujtSCpjue(R z(a7R{q`G+;8qD8D1e?1zWv+pPFtk=k#>f`yqZo)3KwCBgABgQbq%hu4q}h+Bdyh?* z#Rlr*$38^Ru%m9FUTQL2Xy^j|f%*4H*{zWFRsMbs6@u{JM{48fq;F;QFV%6Dn!6X0 zEAr2G{RmY8;Jlmws#%7Hl_TvQMbLnN0KGK=9)1u=Vb&#V27UwM#U+)$hn#hlXxBxO zM~<3s(W;fe-0%mVWtZ)oN|h-01@5z=u(z!V>)I9-IepH|_q6NR_DA>2hxGK<NnR*m zWk2t+J}{L{{ATAL%!~{q)|e=iLSn4A-~C}h1q?=o?ha9+Eupsr*SeFGw0p-zn^-5u zu;>t-QX;H6(^FXwcBndi1s%qn2sH-rsuON7*ARP6Qt$2XIy3d#cn8sLh&7#USTFn3 zQm-o6-Bnofon2V;oq-v1@Ye@NuH$Z~+th}Cs>F7=H#=4PKLp%-!EwR&0`a}XL=br< zF>&?HNr}9ahB-EA7a({^_6`taBwmB~hJG)p>8r^vq0J_+o`sOq<{s2~2t}W&1f5`l zj;E0nmt?YRp{ONhti9{4&rvt5uoS0CO@%+Yv>+}ROQAGP3VLu^S4fe{ZRoGviEXMF zhM=I=Eg2~^5PIwEq{~Wt?inz13!axZU3knx_)Ey9<)z<=!TnCPHvs1l^spF`@INYQ zY|J1RWri-^D9mVY5Z<j$Ujv8AlCwzWydcK4C|+vv1pTa1iR$dG6=ZFyb~2D_cqt9U z3LS@qozPiYcF)#+d>{u+bXg#}3rUwSXX>&@PN+017W@!L5H8CvZf0wZxQ=UrHJ{Um z$Z;~3t<fSfV_$nKB$9GL7$e7eGk`|rFBnpk*l@Ms#aN18Lz{qD!dbS8_3AD&uT#ok zHo!>6ARGql*O1^YY(h4awy!h_brE6&k9B&5l;ya>jDyW5?o$q~=1iV!t7#8&QOx6P zhQIm55sij*Ef-G_?k^$AjK2j?=QQ?^=r{MDaGZ7`Y<Ik^MKRub@OW%3<1o)yw9XR$ zV+vp_%4EHfekP<b7G7B$#O)B9)Lf8$QmAE>o*Kp1uoZ=&5|O)D#xAHL)n9_l6-E!b zVV@8ny;`XU#X2((4cTmv5unmYzUmJ>Hm+Kvht&a+j3nr!sljTHUZn^0w@L|WKw2TO zRO>T!>jutIzNI5U_KL}vd00oi6$aJqPeJwq)lIr(2Gt#52i@sqCFaWC)pS$pYoRCK z<Am&vynz5ok1xL>d*$)r6FCClYp+n>gCqVF>x)ghAbl+h${~Mc_sQGk@+sR@b(88l zcx?*Usr}v|kV!RPfS%HK>Bn{7tdEV$CB5Z@=uy4>^(o(%@R|_7dq69s1(X_8szPZ! zSS~$LCX>-}F=io=YcY~9!vqo3&dh9_Mosio<F(tfcLSN-U)Vcue&bvsEh=lKD6ppL z6qI#&c+@~lX-+#F)tl51AhP=|DK)1x+fWoa?xN2jH<zYk=E_8&m7MhuZz-RhlB}ae zp2uQgS$=R_-5V00)NB-;DWBuTtVMJ(!fcu{Uh;g;m+zjEJ{!?s_s*iXMv@daoQ`1Z zI;?<lJc#B%Wh=hBo~~fr)9RCQQPzw#tL0c`1NxL`dLmHoc%e7WFdx$_=^QdjZ^2Yv zbegXruBz-cttz)ie=L{QV3DD2Jz!-4#s0>`zO6i|$&p;-9%+~sdYNrVE?Q8rS+eHx z4O$l|b3FUT#2jb(WU<`oKAjGQUsoCgE1(c>3byBNPhKeJ7f4S-hBRqRyePY)im;>H z)hyFuFTDqx*ZgXo$hn+u>TGs~=Bjqr3bhPmXG)v8){EU;N*58NKU5;EIZ<q#-eG>l z9%|JomX+b6M#jS2`B%~!+`EStMD{|y^P=`xPbD$o6;|!((h!+y%7Y{DuC!NCKDIN1 zER-J?vZ$2el4y~!<J6G}$XW{+?MSbe>-0vWjNRoC|ARB`IX@M&;?ZpULcAIu`zlH9 z&JK#H);Ij~fqoT{59}OI#ViA%!lPYyd@kHg*hyI;iMdCtw2&eLHOd1*N%2Y!BG*H_ zu@E?VbtZlI{7B{C>A^b3njh=KdF!=rQ!)oIjwkP{t^I{2q&<K(evUD+TLJYkvRec7 zYZ$&1>emQ-C1&U&fPC_viACTbT;(A3qRJeGINz^!0N26vQ~o|#pmjp-Zq46%+{X9n zLGKqhLh4`-(*oDHqHU~-45_+pe(BICF$*0jD&FW?ED=vn=t?p9X(%AH9+;6NcJ8JF zASkf}LfT7Z3u*#i$ml`gKIS>3jrTla--x##EDM{w{>Iu9qV!x95ECU*W_O`q>hcCa zswU!;H3R{}(A6aQ(B)lImTF$BzF;$V_?It*+8ZeiZa|b8n_DN4jUfI0jIA<yNEz-< zUAZU5rNnB5g&~PSflg90>6Q6*c0f(uq~DxrNm!$~G=Uz=qP*)?qc(}|7MQZT&B=Um zr{Lj_R7QJAlwD=CoYpjQsUyu1)C9p5CE)%3nb<t{qTHZCa3>)~WtP;@6(qGG`*qDT zS(zM>&R<;Z23V|80%3s!`0<bQH?H)~tkw2Eq4I%CK{w1nB~7P!a39`Gm_(f;5IclH z_Xj~YoDf^25IZFhTd@e;xP+73;-x+qR|XI^C>QpTt0Ay;*xLJeE|DP5@x?a!1)`g= z-1}G_LxiiO(*?R*{(yH#&yl|Seyx6*+ETayQtv7Htk3WPvI;U!@h-e$)gw9>pyKmB zk8#$3BF-ou%=`9_3)Q`0ttk$cymvULFS`Khmjes=2(-QY@eVjJ)rSD)z)1No&o+dz zrGItPZ$QuD;Nqt~U{J?9VlM0g{kx!4$?!?=o?um>#7tjMzrLfv<@pI&cp*5H>XPPZ zu8Xh<Y%l^G*aDwQBur}de;dit5r?efr|696x8R2CT@&l&Cx|39HUn<!vQ|CwedGQ+ zD*>&6y7v0pGDiQqd-~tBjK%-SO8$8kG&44|{09|FO5BoNkV6~JX>g{b#NHJW?gmM# zhbcS|M9fDc44(seG%$hK#va#4YL98mddGDi2qr;@CeiWO!!`DrF<%=_^*3JgoZiSj zdEv30G5`7ex`XP4#6cG;AQ}(|>CcCTGiom^pc*j-Mz1_oGp4iP*>N125YeWCw#L4H z*>u2Ih8jVRJ?rOj-7KbU7KXpYs2UZf)Vf}(lsM(oiB>tgqX2tILJit<W`zs#E>w_x z&7gq;`b}qrL{lEA3DaXDOi~HQ!^?xxjjVW|#Z+Ek&GKA2dYgO@zB2V*eY<n7t=eX> zx>@D06X)(FUz3xz99V3v*k7x|wxiFxv>=N$1Chfp>CErJq)gnf=P!u-QKrYnulzdQ zP56u!AH2^QVnuxTJjcQtlflq>PSm4C!$^fv4V_XsIO2d=O8|J`4bUDtjBchJ!14~3 z#mgUPYF*Z?k;Y)Igdx3yQg8L)M=c%}p3!P-0KOuXI+{*LXJ&w)$gzxeTyr`)h-Nc! z`$xa<>T2pbuU0VR?#FPEM44XDRw+cM6U1R2aLQpGHX40=4Er=lp&2aN#P1IA3|r+L z?5jaRyCgN)b(KuS+(x9rPLLjY&4^YY{0T2Ai%`f0p}sG*R!}{DSf7GdPJ=C2MT1ND zUJ@#y06`CNc9n?13R2KY1K*SYeV87wG%bjcIbn+AR8*FS<{?wWomTT5@`}~z3bFAJ zLR-wmE$iwwJ-Tn<Q5K*6H7Xi<7gjmiO=VIt?rKq7b!GrN6Ul@)bkLRFm0!xF9aqiP z9_Pg)EI}1<$M(ui^AkIKVo;qp+t%8pBvqRv=D97`;5VVg%UOaj{Ceqs=^8hD!q*o5 z{b2y#Uku~@H)X^>VEhl{{?+??DJ?DWk~VaX-L3-RLtprT2%z-GfD{UVBR~T}zymA0 z6VZ;1Qr%5q#+Oz#3)`D(%WVWWS4BW6%ZvAtt!u25FO@e{X`)_LH>p&pFzx(wvNEO- z!2$Z}`iynmY<d2b`M>2j&UCmRNB)9Cn3MXRls&PFVHzkzr;)B^BCMY~6lYY>0rsKT zm4}RV`Q7tbn)Aseay%@-I6ZT~PBsO?D|>kG*%(PGo=|gZ#0zsmE})xxtAvaCe&$1? z(7GyH&^jm!cguuMo@CPA&-lrdE&Aq8GIOuUK9jt{K0ldcvJJp7I`ZMx-EYj$)hl~) zFM!U~HxgO+lb$1cIK-nvz<5OPs(@d4tB6DUa3?-bJ98|dv-kIdtMS;9BuLc{a~_wW zO$u`rNyms<O+qXSuTB+_W%5p)Jq_HP^8*g_)!h=}PWkkjk27Z;>AeMH9zh(|w=<*V z&&B{&O0Am`<$iBa)>pNZ6cO`d^3B5%=gmsH(HYZw6!U(c@}#)19F}`BT+yOfamJY$ zYOmy2m^k+ADH2klhAJMLq;6>t3)NREUgk*cjJHg{NBkVhDORNK;v5362&NN=y*Ef- z$vxYTG5Ga{SI&C93^Gsu9G-osqbC9PbsC&@xxGlF?o{!rs9|YpEE?P8ix#yS`7JUy z%ez(_Q%I^RwPrW%rFF(+mE}rp#Wtg@^>O7T(@LFA7j{LNrL=XGDyB-|3<*mqLL_UA zUZz?ulF$5O59-WWZ!d@hRxC@4d6?okW%`1$#<5w9eh>4Cyr#xe5%VPG@TBe#HA^O} z1&q{T_TMTr($f<()ah%TXapiGp}`MAC7>0I=Cx*t+bXy+gMyk*#(A~ft=&4YBdQki zQ}I=c;etc@sD4?l`eYaksPtJnx5OUaZ6u;7p64DUuI`omrWjht5$8+cqb6Hw75WNX z@D(fl7tDl2H)H%QYyX3>cL0*DZPv8+ZgaP7+t_W}wr$(CZQHhO+qUig`^@>y%s1~j z6Y)pXii(P=SQS<4iS=aOnR(rqe#b*BR~GN+bMNQSnhcMHxh<oN+p_*@?ZNyQ{F31O z4E(hxex*(G{Iznmp)Gk__F1N9vOiHL^vV{PrPRnf8^HwQh!M`><eZ~9Id5FLsN8(T zWClYsF`O<sI`U$&kp#I1Sy1`gABIV;yhM^m^}tM|Raesy5y-{-dNa!|yaoL08X}v# z=8?LVzU@GDTGec@{th$%Y08sH!!r4Ymb6D^;y=69@L3iOE5?Gb@cNc_En3;Md`9l4 zVmfd<8t7(o`$ZKNh{eZ6&m|E}gc3K4jbKJ-MmJVcjLZ-V^~}_~4VG5H&rI_AV?#wv zKoSJ+qKyM;L{U|Ajc-&GjmVJ35Z=<e<A`nPrUOcwU`$QMY1WdIAS#&~!iQhz?0!Vx zbE2uC;P1zV_`0Ro)qnY@n*2AR@c_qQYG3uaG}MslD)yRHX`%&nhT%H%3p<IB=z6&z zQJ#?9X8{6fu4Ng}+LKglZ!a?ZzQV9%Z37zNYdyhWOdgH+Ak|q$qlV#yI;{lze|1(0 zR{wnjF&{!{`VFq=KczFKut~7<`*bI=QxwS!B7GqsEiWyVw&wML;O5L2I)|_-9m&!s zj|@bk5+hcIgZf7J*V7@0U_DS8!TdgR-a`;m+mep)T+1q~c#7$ZnmSE58r&o!6@W8p zDvXC3GeNj9s(m9|d`1T$9K?EtO~zc!7Z82^b6Aw(X^dvfQ+Hz?eHc}w0Axg#DE$nG zoGT^#Y#x{}k^mh6S^$Lh@A#m-#$3`V+LJT#l(yeygL{i<zi8TdVb0^sp+Vn$WI{<Q z>Vf6<CY86L9HFp!u$yM-M1NgDbONG~<QWI&+`0_2j6e7YN2dw7uYo7|);1uLRqz=R z7WV?4CgAnP>D7_zYs}@<K!DfX(WfX1Ai!~EE^8*KT!Co*K{>oo$eK9sZig1_lH0|C z&<1W;8dh6lutS+|02t0VqRfh9R+%!~9YsQ>cw-uGi!YMSo?19?Sty(u{GRqmTx8Zv zLz|nph}CNn+4a~dDzMog(j+NForDvDjLwub!b;p@dLHSBO0kjaI0CPZ)8B2(HNL&A zdr8Pw@u(POF1J*groJ~!1|E(Gm<U0SF<{bvqbm<z{6eP~UDu5*>nR3L6`P*3C;v?R zDw-pBC=u%}<}P_);mn-_cE}am&b1_WlqnWVzFS;*NhwoOb%+#0nI|H*Bw6_0R(=Kj z;7@eEqYkW2OvWkoz|yY1gZAJw8=>KShthS*ANzYdDT61^AK)>0H%LV4q3}hw?bkA$ zF$tz;<5T59v0Zd$)unmJ{vu_7eGDP6+pe(H&n^3E)g^rB?pn?GT<XDnE%*A{E#7oq zG^wO_f)9^{h?|RO1$KVF*JJ`JPlc&bhOtC&o!4l`CQ_6>9l1gztAUpR*+Kvt=FE~M zq5rZM&9v>ww1mzrK)vx*0;;?tnqA@Q;FBC@$2~=gy#jW$bAJUNIl_YpT)``*9nnkV zF!&XBK8(PeQfnScH*JaYqy{1bN4MwF=&g2)`!Kuo165*d^1Sc_d{I4>6V=>74c%g4 zXE_M`b@syq%jQx9VRp@ba!rY|MRhr!S3bN!1RT}^I(2gXE`KT57Y;maGA&dHM#`4* zy%<P60u?#!lJ{hm+I{teQZ&zA%?=v`TI>@6YB0A6Z^?fg!$4Gq0auM47(jE$Y4osH zhydBwQ-S~vMS7)hg;AC=MRf~AHZu|Ue*bk=ff`!Ol1%=|W-a+~l)QH04q^oeMZHj~ z8$8jQn(n1#O!_7sg1hi;{v%?nd&gK7<l$g#FetZCyif6!)lL5J_%)fl8&{g9&-fuI zz}MTJG%Z3cbXI$Jg<E5E0dl6)`j@n)Jz)^~Fq8EZW}-Hqi|_b2d3Rs8(yL<c3)rz- z6xoiA!n!^AcaS$lgcr%Ad1r!HvKx8#RJ#mI2slyAmPqU)^{RrG{K$}}>tfN3I{A0j zcg`ISk^Ir4G=(SvV$v}DE(nE+%rgFkT%cu5VR0Qa^H4-xPC*7Y*+<jZ^$o*_eeFvF zsTfD%_k_3XOEvj-<agB__e*w)d1E<m;`ZUQ!WT++G{8dbm+UF$SMwN72+DUqPSM1A zwTS#HfvDp*5>E8#xvyepS#xYE+FyIIi0|5$J%mKAB58%MgleT%Zx42e^L`TdA~Ips z=NvgHNpYZju?*J>oNcmd^(nFUc+-bu4*+9)qIwU^g?1_4-&-`uZm&f7F^1?@3I<Pc zR+jZ}=8fI>vJc{gnlh?no$<XHR=hHI%%?`ym%)e<m+sK?buh9+gMBvu!{q@xu@_Sg zL$w<39);`)8C-hm**vC?Zqy1NIpW&I7Vl$$s@COLjdoK=`O4y62~<uW9d$E)1V}mq z&1tG?e|CYuI;ov5(0@bx@$pLnnRPQ^>E9jFIfJ8i+33;o-!b2hD@}}{o}J4{l{44v z3Cd{3Lj%9^E43SBXmIvwsA2_8sXgRu=4=H{j9R(fYcCzOXriTZ51l+HcXr@)^?rK* zmc89=w8MW+txdobBh`X4rMvY#vuv0GIEO67sgL}mIw$pNW6s8Fd<Bov!}@g2V8>=t z@58{pFs^Oz&g}CPr8EL~QyUjk&}1qyO4;-6m0MRd4J9T2r5_j+YdeKP%Q+jnWNdV| zUJLU&d%m|g&3B83R^8K^WM{0at+=9UdVAzTnL+CqdcT#($38|-fQ|BJbHY4vk=ANj zvX?ek_oYp6t8bQz-T){|-5OGrv`IGd?>X*h(s{MvQ{j>fZbx<^-)&(j8(N+z^sftB z;V$0+Wd0oUR^&)Q+2bHfLt#V~jZT$UPU<McT?X43`{{xPGdu)fXen%p1BR%`j);!s zcQ>bkd#vD#zZJ&huG+-;T%sU~ONA?a`Va|T%I0yd%0*Xr3>p#slVg7Y<6o&Bx856S zg;7Q>mCFF?xq_m}VG5`(0fIX(V=yvQ;xjpwNhrLFMui8xdBw2aFOvI3t6-NG3%+d= z>1un%A{1+tFrn2nu2%`-hiqYhXDga3%{ZVkC@ROtTcA;g*E@K4i_G1&^P#Pl_9*m& zwBVKqZhrf4<CZn2jxKjiiI5NgAJti7cg9jZZMx)u3Vl*fh%q=`I#Rf>bhw@M)78cm zBMB!;A)H{6<Kn{rpK!2cr*s82Q@$}Dj(7rR*&p2Xoi)!3DtXgs`gx(6&=g+hePVA- zfr9>h6AjEv&|DGxYRmY|e_ARf_dMIvm*-i4h<r_8tvkwv-mtv3OW%+`67Gbr1Y*j9 z1&T&I%Q7}RZ_tLx5Xdau=2t~nmnA^llqFC`c`kZjr|ST!83-3^#QiGD+g(!P4^l0_ zP|$Ys8$BR6*YL`x-QRAEV-A|)Ue80PXI-%W90G95r?{o0Al{DMWFSAm*&2tnm~WWR zhB~N%h%v2*_wF<)WBhV+&W<{-{1jc}Aoumb^X+%biz)LbtdgCsCEjHL4sZSJ%spEh zwgQ4F)TR#!&1T4=RYeE5`3<M_dH=EAM06^oozPWr&lokjqVj@hez~UoCV%h@e;2)U z75g~|x;*@i!%Rx+mB#bq<~0f^N0kOCtCREd`XCl#6_i?3^?89#>R#IU_#<!!sCCgP ze<}OU<m2Sqkyn~b64uC7PUsbeDGv`CeW!m^IW#FfW2sYmw6ilejtm>A_QYP@L|sHs zo@Ky_Bx6e2??_k;7vjibD#pM*T7`h9V&s(moOn_x^N|9{gkOtFY~gDqSo+7meUjBR zK2jiOsA%PwD|1*KC^m(-WZ5j2AWi;81kCi5t)KouHKt|R6m{m!!n|4YN3yyBo0mSZ zN^yj9>I9Y6dI&$!T7&$%3Ccxua0-&DoNJFbCV%1;h^-U&1Q+@47qrKld+QNGOrh{a z27PfD|L06XuL1+ZMc{_7rB7bd&WD%*lbypj>|K|<#2#t+qPX<E^hRp}5ifDWr}U>H zTm`5QC)ktLW5+G&4lhvX8DgOK)|mvQ_b^HuJ&=wP%Z6%;E+Bx|#|Q}vOoGR(jK}sD zk9x4A-V%Hs#G>J5XldT-W&|Kv(!mEi;J38jdK>L|Q7~<_no&|~Fdc~yhC~%VqQc2e z2|pva(YaxgaE`xa5=u=WkhtI|f`XRHhA6|>1`)hDgYzt9kByS$l*OQ2O-a#Iq%SLz zV^&-mn{^KrM6&BueyiV}>&)9rr)de2+DkV8##PSmko(<`nqPVr^n_V~UoIi`_yVdB zzcj4`b5QijKNrR%0AYi<`{NDb!y1^#Pv|K2N8<&wlO7-JDa5Yp?eM)pf>PbMq@)Wr zvki0Y1yLr2WfDb`RBPgq^VC(KH;ofR#9^i$TaMi9J6p5TP5F8<&ofnvL|`*(;urRO z?0k?7WiOd&^v);ux~R9Hznc3moOxE+O$lYV0Ku|hENFV~?Lt!QZlMNp1%d#^Rv!pC zfq`*V)n<`Io8N2XGBOjLYB}#{g#>o-?Hmb6$VyvSN@nI?3{y-pdNvcYe%&%CIeh?s zWfdM@$o~R)P|M>ElHW0BAMI=ozdH-Fle#Dvq-bpmPg-!rDY|1*o|1dvDh9{`{gt%n zFemDyrWMrywXJ+rV5r%UR~0T*75`i&rM4=%7}ulJyHu{rZw;C$r+nn@cLyLgh0d-A z(3SS5tW>ZK0in8bOH$vW>HIcipgUXYGUq49#>Ixff27cCfWz$0vR4Dmq}CBw<~4Sh zDe9adM$vVItE_)3FJT5Bgk}V=1g+Qvf5+<KeZeKg27tmTqE9gb&&x%=tpSf&2MEao zUC{VNpb0ds0kEy%dt82E>hpxwh78gHe$<|r1^Nh?B&_~xSq+nVdY+~dc4GJ?e5EpV zXs-H~6poV`Kh5kok2qSUMD<MdZn`+nJNYMw{&G)!^_(?T4R_K|kG_&kKB*w~M<(!- zhQZMCoK7`vb~VQPn;h4Wbt|7ZqMK$e62u$?R-P>?0&WXKs7T0?Z-J8zti^WD-*_fo zhAqM(p+l2*(|b>aZC+?aK~^_VCZkP0>}TxdEC-KcmAx*YS?wTK?cW>PjS+NxM==Wg zg}e_*NcH%2(J=+WVL+;P)kz0c@48^4ZuemowCO=rriJFSD|#7D2oO{}$kCbL0#0%2 zQe&D2wwJ3%d|+L`bE=&9k_~(BOe$ZFap$YMGL$&$D0=mJ9n%He#RRlC3f=|WyrI0L zA_qS=<Vgd!^sQRNl;o#=j*2#}(jFc=Pbq)IH^}HuM2WfsZQ)UbZ$S&{*oOS@w8ILR zRS_=vsZ=Vvsel_;qaI4VVF?G4!%(}yJ9vLLtOY+Am(uVlK1?*n&LcLmEm7jIY#;R? z_}|tfmWe55o05Q+CuY#3(HB=;YRs1LyxEV4H=K1SVp&1_TRsjTe;iIff4w?AtlNHB zNMqEX>kzzw8f_QiJ<uGSKkH_|=yZI~fIr~fJr3_YkhypY(dCTuY)5@*ykUN{nPNZ= zTeU%bCW`RsT`<**6S5_K{prH4z?S|7a;AA{o^xN}hu@BBsCCv6e(zZ4{chs%Cfc%K z;|90`6xnOi$c?>Yg_b?xA6UgBS0tT_Y$!9>(J-Q|m=O+8+wIPlb5i=-aU~kBf=4dD zd6Q8*EoKqRCcMNO5q%nez-osz1XT6PZ+r7r7A_{!vpDIfE$$yCUU66H>HOUO>u7aE zs*>|KS24COy<^3O^xXssCI`2iF%;A&<Kxv-{GflzSv6^-_`6rn?k>7{j1UDk9dvv< zsUbj2HMoFr%{j!bRrmyt%jM|4U<OHrC`kz-+@|l{4Z^UxanM9OAV-o<n@~_@M{FGp zB3{v>Kza#}%V<gr#D>f*_fEvi$*6J-h}oRdsdinr_W1<aeI;E(BS}I<tGvKo%aVl9 zT8*N*66uB1#vc&pIZOW_e)6jzRk@!n4%w5IflFM&9gB4pN3@HP1cznSFcKzGbLr(5 z%;-ZZvhr^v5@#b;>-)p24zB*p9tfDdUa27+<E>yi5W`#8+~eE_NyvNZgCP48jF8P; zgYS#IP!@sLe^SeCy4jwre}sC*A4Vk3|EzFISR4QEai+j{bL%-B#Nlt4WJN3eh+Uo) zVtaBF&A%PtbaaH`A~$h0I(5#|WARn>4Hbxy+Jn-$LdJWL+&({?oGdxCC?@gw`D44O zZ)fV$Yi@4u-zGU|!cfh6Eq?2C3Nn%TL2ZoA1+5g5O#q6$QGS|1C!;H{)PU?dDlSGU zLGKxOa;zm!C-Zghet4U7l(%LaEQnKF+>ECNt@`F07q-JO?%%X~*k}Yndc#f*iq0<E zh-aX|Fu{GY>`hgW#iOvymYI0Ur<nK88ceN)<(kWMl$~V0V>}T;8qZ+%f1paM#v7e! zUS~+CMQqEbYZ%Ix+4iKAGa>>DLya7d_5zQo_zm&bP6F_75Qk^L7A%?p74r#_+3V6R z@m)%h$SZlQi)PpLLYyya^FulLkrPuM%+!YnWBCX|f#M*ph-`6S5IH3F;Os;ZZ&cDq z<~WF?be7SQre3OHq63A%t27ee4>e--Q*N)lFkAI_P@Yoq?Bd0s)IIqLY)xtXU`k>x zfQK0;b2n0v{oPhQju4$`uD>)Syw=X_l}YEfVF8)awhULL-sJNdq;z8~(wyAEW&sDx zxqHk8ufaTXHNnIUP~eE&k>D!g#IVt<k6q){kZ+Xa5{E*O4m>73wHY+ugJwtuy74u* z1qC32jRV4EWbz*0B5d5qGm7FB;V0Z>C63g4n6hW?!BfHU=<o!#m$<U^6GCf6@zfb2 zCK6(EF~y7{8irNw(TEqZa;=^EL_~#5FA*W{6Ch;E3Y4Bn8%0+V;vUKD8l#|Tf+?%! z$v>hqZbuGx&ccdij#|lWok<JeWHyPdKD0NJ{;sEc|6?4_+6oP>>4#{m^Fy>{`JdOS zjIM(Tuf4sYrJltP%2vW!U)Mt5hd5_vs^{onYW=T{?nF6taSUF>uPLMY@>8Y#vd&fU zJg$MqI>EOkIj}Gpu%?+k{%zvX7zqvMeuMm%YD6eLoHxL?e6eW>J~|~Z&lHB^r_Ag0 z{*SlMeG(r}i;4UY6e1TDhAnY@tyh=*e7>7?vlwq>&py6<k}1K8x)%|myUzlL62{)~ zcC(t-q?)Y}2a+q3St$dLT)}P{#}C1S%{Lv~>9o*=h<mOQg+m<h$F++m)45ZV^MD;} z14~gAixLHFnCUb*Zv-g9fXE7>IE389P!iE)Fe1v;HN5fVGS&&jBzQk*Q}Rb%{FF5H zt;vL@*J)TU^_AGy%>+&9)+R@9XQHe9%Cr#w>Q$NM0~WAiktZl>9`I-Ypc0UjVU1rn z_FPNg@88w2iz;NHBJ8)vM$%1oe7QzSs;NxSieG5h->Cq6`M#YqU;tx=1hYym@h%fi zzWLOcEgsbZ>jW|mkR)qpxv-Z}J6iTzy?L3sZiv!nbZ3a;A~Hu3j6-^%FcrouBW^*9 zwOO;eD$2J8edza=ZDF&}5X#=B9O(;A4zyM&5yTvxuoqjP+FZY!ZYI`_D=;czTJF-e z1-$=(BE%9~*+c%p5UT&+n27&>tc8D77L`o(F_e)w^~KRuv4^AdNE-D~2I(p(SCPRP zc{V^gm}JdYd(~~{max<jT;W{{qJ%=B4as7XJjrB86YBU^HBAa+06(X!_1K+_C|9c_ z)?wVPyNchhSe;#;C%M1xhq!-b3~m!(+EIn*a{?eN6C_xT#3bwT2NJCVt0F3LVDSR6 zuGR{Y2kwq&MDYwtu67ai7ll=VMeQQMdB}Z*@2ApoA@vsDrh++mC>0nhdPp5j3){eJ z$LuzR9V>9)451K&?27Aps3vsd_bU(1EDOA~g;@vOO2Ty`4MFO9u=`!_wEKPQp>9L& zzuUbCBGHhsuxYBy-^Uw`)=n<g=_6ADtF6^Rx#L$SiwTMLhKAeg$Ir`Cgx|~CQzRQP z$Wz=y+MlL|L*&gbKc>5pSF5)!a6qfH$^u&=0GA(}B-Ixjj|ce?Bp(~$q^7BqWU|H8 zKU!?5P@+8*_63=^7)|h<=`vW)2%PZF(`Q0Lr0x5QLjWKIQZB9)OOB_ISy!Mx`E{lJ z1=1d&Ic*{{_h#6sNH^Hz)~vB7gCTbuUkVrOm(pCye57-0<dsb45#E2#1+L^YW_jPQ zg|{|1r?W0<UY^icT@rM5xUrN4-Ga9XU0u_nfIv?(1uMbrC`*n&(*!`9nyVmbS_=f& ztm#Z7_qI6{SDwi8TYXWlf2RJhh;ePSIHox*bQFuoCD~m5Rk*v`1f8!iXFpVs${-fy z$0c2AP?2akzba<<^d<SZbCyJ~xa#1j;me29{-lz*roj;A<-tdU;s<sg)#XHxkMhZ9 z+8i0#C#i2XPgfC#@#J$TB(Cd_z^H$s?1$3twT&=tBNuLe%Fl<ptJ!ehn76f9bc;XE zGYEqyVB(x1YL77I?c#HWf{)93)ceY}s>NUsKiFMeA#@NBB+F5<+s{(H7mQAPQx`OR z8xRz&uf&f&-?8paW&Q%EHCq$Lv~}lCIW%s>Wxj&$Majn9D~*<r5R^S?hRD5q0~zZT zs*IT7`7B7o>{Yn8jBZ3b9-fuz!82Hn?&ZI2_JZYAy$kb_?<bYK2x3_{G^w#>7m*?J z7Ec<Xr+(5=w4>rbL2*)gJ(Wl`yg~c)vC1w>dR$LezB90-T0%EZo|KuQOirNpKJAd) zr+w2F#9m@j64vevMEx_$M}ESx!oajKsI7|Q#c-fWRsS7nAgMlxf$l`eoBx6_u1LP` z5wVEEAYNPN*iXKJza7=aP+z_r$z;5})S<oi+}-~^-hbQc5A1fqvyb6yUd6CgGXp~& z{!K_DqomY(!`}Af6)K8g57Ew*!8H?)fvR?Q1-qUyJge=3IfU+X{+Zbg*SGbTXB`6_ znB-fU;%-e~>+)<Zxm)3ukS-Zw|J@2{{Btj2|*FTy-<IRp;ZZg%-llvq6UA^3q{& z9-1NEWMTQ79rE01H;IvFc~*(*jxd{v*|<7%6lCMnTfDTRZCx;Wcs|m$@c3O(heLDe zz7X)KqYewJqpsVoSuCn{7x=bLQ>QGWl0SrU7qL5T>MpzjZPVq~an6pv29s{gIn1Rh z$*Vp>0p=05JN|HRiyOCbpgpZ@;9Xj|o3DNV!%Xn6t3hE>(=2$dFuEx{osGXYv`m73 z@j>86*-gsSS^3m<oE3c-)n~5N*se_9lLX+^`1AncyC%QkMGrmLV=Ho6!+4146a;OE z=`t$t9k^-$9aX;|lxOSwN9>R)HB6Bj1fy+E{@9e{bcRLU_iAqDzdQUqG)+sqNE`h1 z$3w4loJ+!{F4NdK!E7Vu6L}j5d=VnffP!j5b(b5(u}{;?o9PB`YLsrEsOeE8IUM8F zj!}~kYF^$l^i7CS$AnS+a4#EnWySE!?hNnzWe>=ETyc4WCXpNzZ9R&vLWR9n2)aFS zeT`FE>ZzLpjPr*qdk%A3<`U8cpr3K~?abpqM})l-j}Hz+9tJcw;_-BzCtzpYoNVk^ zd4xI@9~_|+Y_6S*Kx+?A$c)OqC718Wiat0Sl%qFMhix0?j{gw1XO9$zQhjjoeDj|S z8hS*$R7Ol=9=Sd-9s*OgZAC1sMC*(iexn}3CMYJdNZu8^S5)5@Bxo7ayS4fG2D@ns z(Y9t<TvhILu3uTgNy#qP3#T@k<{6-VswRt1u&eW*57dPh$?Zc_!H*7qqO83%5^W=J zUDb1tF}tG{zti)_rTId70^zJ-pFwgc_I^4(>_4DB(20CAx~=eL=RM?RRc4|4V{?Qe z=>g3K7H^2nxwHm|*N+zhk9ET-=0ak5wZAxM<)DFY7|^q+@a_=>AXMj@vZG11mH%nQ zn9XfRt<p14uRBgwWE`}!Ge7riPu`nI2MyttnjsO{6D=|e6fC%I-Hd12iyv8n7o-+$ zd+FXqK4mJ>7)!V&u0~v+`DaED;5~WX_cQ6~@iQ$)`#<lj@~%G+U&|lF!;kNPgQ=mt zh_2O-X~DlpnvqKX$@JBXtHGnBngM{GLk_3fWvC2OkgG`o3B4oYC4J1N)=j4j*lbx% z*i-)Wx`^MG@VuGqMH^0ii~B>bKdk&+uvYtZMGQ??&<Ml&ykYNkykYNsyp{g>zRmpw zbc5donS&q;jPQE_7rh5{ONJKBM;cxKH>r!f)K=VDf}bfc1B4Nv3C}__D{B|kU<cyu zF9k}G7xqV$0Xa_Uy)eXayVw@La<2}I9(Nb*FqncC;#r&}eZ(|BB;TVKI}bcIPfIH= zrzm_jxOTq%g)}FA$YLf2v?%r_U19<N=>4Q04E((6!W^q+&Xb=m`c#S!$wEEp4py_0 zDJO?v%A16hzF;#-Lt+DUyec?VXUS?%21=wBiJ<}TTQMa&n$+5wnHr4sni_Hb`tFO; z((K<Oi*SVDnfmxN(dJ3`C_=~LISLzk1=8i3J_I4P=m*3i)?tz0;zp?bkDyV@leHk8 z8Ym0~2G-&oe2JQxq&RM7jLy^<hA7?C2iK)XD&n~d11tW&nRZb|%1aLc{0q4frPQfe zL3eXNXW=1KO2n&WluR+J&Gk#3SDjeG1^E&4l@t0}!D9$oEGr}aNp!0lE%`)CXuC(U zF)}q}K4Xr)Z7s2kOeDq(-Vdi5-1lz2Es6CAZoUOkBn}=jL1iw#i-FUgmQok$$f^qQ zLlb&t%@DyGICCfIGjsKz&&lWLZ)3?nkxjPC-MEa|hJw1LSCv`|#aRhD%hmxjW!IZ7 zrX~}toQkL{6T7B5gPgRCsq)F0b;NW_M|KEQV=D0>g?Xh0p)JZ<LKDKMJSb=0FP{C4 zDb(+v$X^5oi(e!Lk6Q}&AU#U=C_F0nFgz$`R9u~00mjhDa;`{j=p?NM_{N%;!=2q} zNRLjMj#Mb~mq@X_xS*6*TgM0pa3DpadTKeBztTzJx&+q7#*~GwRtcSch}eXWn6yaj zaHTycG$->nUc=-mE(Ls`z5)+Qr8;F0R92sj9yEJx1kK&wQ8S2S`)h+Qk?^jShBw0n z^g^Pht7xCZvs&|5W95{bypf4acXhX`O_>*QyEk183j48^Ws>JcasVrhs5G9;&2dyi z%>jCf;J1W^x5i(=Cvt|^PAWSdNG}XTJ@;UD+R!_#xn5!VD8@`C$I>Ipes@q*x>0`l z)z8=i*VF~+bxTYjaCr)lzaDau^|9V&q!IlGwQu0TKbn4oBljDL$D`d(xUR1D_M2H5 z_D)E{)YMOgPe9j&Ta=X`w!K8L8Fz1tOon!uWan9)huounS4Mh4dF)BRXPW~rZ){=b z8GKrX8h<5U_7;gkNu2?Vha=mHR?g_-tDJ7e(~<p`5So+xCj_-OKdxm*zb&kc2OZP* zS*dMJml5H=AgV98Q*HXN{iwX0%>;kBqw^DncZb0-heR1$Eu84i7(X`&aR*AQIwovW z>fz)N@L0uBeI%!;>fF*(y?a<c_!g>B?LspSl*h;#V3|hH@lSBCC>z%=##r4vBD?~% zIcaMD#Ep&MMR|QloYSVm4m`6&D~o=K)KUR!2dn`<yN`auN<s+X&^0ReqACJ&1&%`i zS9AJ&$N9ZQ1((R%+~P=Z=oBq)CTZ&h*($ex{G*kzjI$J`=0_pn{>e7}AFYi4ni=M| zwlXp`cKoTc{O?pVGTu@effshzIQL;~Uran3$O8b$6lS*o0s<dgL{S2X9~gc+hAQJw zq&2R+oY;$8l90IT2Jj^}g25Rw!7x3An4zBGKKt|X>T!BoyZd(zz&P7axA%@Nz)_qI zkD$LWxQoOtM=CJA^aux0eMxT|$TTV{XcUf%R6YWWWpb~~Wr+7tk~!$o(-O!M!{#H? z)jCw2taNz0WO)=*Gud<JaW9@fpL3bl$WP$^I7J6|S#A$6nMZmSNyA=+P(gb_ljw{( zpw$3VlU2o9^;u=VQPT<2F$?i*b$!3|=NVHi+<=nB!2{$_ZQWc=G8(7B;yip<TFPR2 zE%GD0>3!7Hi9?DqB;9JQ_pLDASj_PC!c^M|om%q>Zz+S3oK5Y^V&l+!?6vHO@6@c? z%)vqVE`pRD|ItbFC1kt4ApdNC)&9im8NW=RUr><p>@up^y4&I8N>~wvL%f(S2W%NN zf&x46sN${5Gh+I9cd>g-O|x3@x#@hdvU54zx*WtnC#5%quWk43w{;_G!4&;N;wy-O z?urjbDnKfp2u4gknf&*wBJS`YfdzBa#pf^Lo9ei}Z)MCk6MP}h0OYrd8`j<XJ`}!e z0HI@HcE57X35JKili58J7T;t86BZwc4YX1Lws-ENID+Z{zZ+abbPM)lpp3$4gSdHe zY+yBlF;38gng@uH-O8X-xOu*vxG1TCQ1*Q7Z!J+#_K+^F@~!OO5Fa2BIVYrYj-*&} zQ5{3U5obGRh7eY4kqC+XCCGWN`Z$q9BtXdWhc15e!SG{9lk+m783=*fX+!6Y;@X## zKKvSmh#?~y$$_G;1|lov1u={fT%dgXH3}Y62TzFS&!Oy>VipqsRTq}lh>h#|o4yiA zbPQLKXatZ+L=I$?XEGfd7x*_lf|=3xKLi)yj}jQ9pD+OPrv;Mqe+~uywe$sD4D}uV z4@_J6*&E>)?K_L=^<ZCx9>f9)ZpbIb0tyI>qF^OuZ;8LrA_T9JRowWUXNjyBVFxj7 zcFv)I!ZI!9%3&ro1=#}qZ!W@`!*%Do@xlC)>lS-KJPYY3@3mXj^ZUgyXXo8DiZ)0M z@ORv8NQ5xIiv%yy7Wuv<gda;WPv83Mfi2oK*ls5MR^blRR%H&dG-*n(J^fa`4&Kxv z{IR>M3l7ZnaX8M-u4s`LZ2-*e2V%BIin4U@4b=3ps|#~L^v#DXv3G<r4$LkBhj(1C zbl?r<boS9M13ec;-?54><iwXNu=74-#U6_5BaxOTYe03)+cZNzBz=*qSJtTXNK1(h zd)L@OHJQjhyuX$bt-mU;^35ZxR>Dk8H#;lK%qAV<%I5Z8dd3-sIMfqq2WY52;$Y7| zC@8Z_G%EJ3tOhCq_Ad3l4=IN9=Ee$7k#R%^@JPd7SnqL~*a3EWdfPj^Ft)B}bgnkr zBT1I)!g2ha@JU#wQW1op@1SkuaGVJcEJVhstebVvoHV+n`EI?;^p~M~tfk#K1CBi- zF<+3FQvDXkoVE)E6Bj9T)Vlo9rjgCj>S}EH&DnJgn49L@7ZaI=<x<;pRn<=KT z8T)QyTh=O!X-f$Km9us?>v&F?OY*>NLOQ-u43cR-0P{LGZCyKsW{^hNC8iDiqJ{~) zNqU!S?7Gb=jXSc_T>xTosLbq!#)VKVs^hKlReb|!_v(O0B(=A8tA0Fic+K)>Lc!(J zge-eb*cuWjJCE_q)D}kLQ`X73XAD=didg`EDAk|<!CB}ip9-sH7-$E3o;#ynu|z(_ zJW@g6JNly$0rBNIfH}-MdIvmxv(o?)Dn6kkc-3X%aHp8r%~g$Frzq#~m!ODbgAR!+ zoMp>uw*rjJ1Yj*bj<;`v&<aSHn4f_YVQXq??gA_7CW)csCEYaU)8a!nrY7-vi%oc2 z2$LliRrO;6{{&i05pc<71XA765|}Tlu|8!ah?st-nGC}8<Jk8N9U04t@U4ms5N=P! zX1(G!MxoVR`)jG#xwjOhk&P1#_G_@y5E_M%IUGuv+~QKwC=swM0}(W3vTD*=$?+?u zJ6Aob)p9~XWcJ3Ef;@cYIxz6b?{=pV2<uw05TzUTb!O-G+J!3xsJ(Q;wd%IiCo1e9 z1rLnv+#$_6*PNKfNYPFeGk7)4Onjo75mYh+)o$i)t~h4Xbf(J?ue35_f<#I1a_<E8 z#IWl<cgjn2rfl{KY^3V`b4AP^b45&nW{5~fPQQHes{MCD!b`HnKUCG_FTb^9V~0hN zxD7-NF~KLZWNrzLUg!|cI|mK|glJ^zXiN7<{tTHSaT_u};t?blke);ZWYaw!8v=p8 zph&zBA)I-%5xLgPQyR?miErfL7kglurN;N=Vywz{%h^U)elh`mgLEt2vTJ=}3zy0k zj;EOfAra$b2YM2yZbXSz7yotU@QfDx;2p%dB|-8&l0Y4nMe~-uRsN71+E)Ak{7$H; zo{k6+h|ZwD2ps|U91C^fDlU$o<ChkWsHi6UYv&)Q8>pOnps=(g<^CaeJRd*q!NQ`O zTAcA*KCphxtD>M<0l)OpWo@|W=Vs)XFpM7C;96VQR+W3~AXoqC9@yN@7J9kuboR-H zHL8|U?V*D#Jg&`hR95a1#ByH}mfw|kcIP#b2%C}r_nxhIoWdo%k*DB;N)%#~P458H zR&1-?mh?}HxGi(-dh@nkK_H45IB{y)%qwup^p85vZeUpqh|G;9wr%q$_*4*|PS(bw z3$<2M;y;*(WAtHSM--PRyA1<)1Xe^(yuRRaZX9nR0oP5%Wg)P(ak|_q$^7Cd)NP#f zFt*;;hP)je2EkvO_Juc*@6Fd}(xbH@+`c?h1(9yjJzcLY^!{hs3;2?q^IfrF`+D{7 zeAjrrb~tUbxms|met4=I%jCVN6O3DEeY8_%NiNb1EvTu>AI1J!n@36jd$2##c}B>0 z4L;|^v$`6=K#^tk;MTA+ji{smQT)gaODj-((|WI%X2JbpJ46#0RZ&FMJeh+Z<&>04 z)cI;7Dm)CZ1Q9H0Ge@zDXKAsB9dZbg4?1joh3}_)K2k;c^(s6)kl-$}hLll_T0$(y z-4SgpruNv<L+aH!q8IS8MzY-gg?eaOL-SBc(|NiekyEP>#}%R(l@3!%tj5l<!T1a+ zmzd1#!RA2v;r2~Stm-6FOWHj8**5(k!_c-){Ogo@$~19ba2$cgu#Q+WzJiQa_~uJ9 z--DAXeBY@UCoqOU>!d~Np>{BXo}gF5QWAP7*n?JW-N~>|I~-Sokci&_Ho87f;<jMH zf#SudKQ=r{7b2n+Ec|5w;>meu+(2@Yz45X{^W92m`3_^%9FadE5^cGO72ffn`$&G} zGOIPIF?FsLh^0eater8)<@~LjNIyP(W<U$h2l%YS9YU1AkliE19yN#0-#D!bNwB$c zlcdqBzq8al#RLPM6(ys9dr<g5yEjE>7F~ackhd7ase+Gfo@-RBG6$Q+CeDbE-eiO! z66k;0^Ze3P9kEj(yiZ!_vx)K5>+Jrl2af_iKMbiG*Z6y})9{?`w@LyvBpEEC99HEm z94J&4%248p>c%Nb+Y?Mm9%w8P;5(?F8nINf&_*-><^LeQ6{hj_UPeUhLmtxd+Vmgt zX+WF*G|x;d1!gF0D5?$*b6|tDV#m<_?(f{b+Jd?J92?)y8t>gZ+-KQ+Bj*PJW__xR zdf03Su)GBsi{L~F7m?zTiiu`Wk!YO=QO{H#)PP2?loJ6bfRs0oKxO3+aYm9`#}5V$ z`x646$<?I+_|&qB9yVC`3(2AonpGM(C=8yTG=zFgghaCdFhJoFxA6^cH4AquVxU~U zp$tBySaago1O>5C08JvW-c>mV&jy+a+V^zH9IQ#Inj?BmB?I0~jhx7qLD!cSQ9{<) zCB(xvh>|7z&?P1A6fTeZ=vH4`HaRJenyQMrBMl$uNuOX#!uWTr0YsU$pvq9H4wY>t zl^X-E=|ppy073iT6Xv?zU&~*SO<KFj!<^Vw<Y#jSXZX8Re&4&_0RQ)Z)Pi9+<bTv# zv3`#KaEtm+8zriL*(g!{FAGMSpJLX}1pI%gEEJ?;(_)g;WKEJZViKdGi;`2L2jt|F z6r&T8jfVjLsE_=d@_+kJlKuDd+vxuEXBqz3JyKcyJlp@<xBSyO^WRSd^Yh~0JfHL} zO#hqf<l+W*6~|AuB>z)S{s$uTKR(W@_aA<f`VRcomX<%Fk%Xz0;ZN4&^dlqvmwc3{ zplSUdMl67k;pc1kO^sgs+zHWg<kCg3@N*`Nc$IK-1H-zi%a%IHQ2hDcecO37jI#qc zJJIx8STQn54G+4<TdeNat@cM-o7~>sUm!9<t2_YgY);SuHTpcm_dV`#E~;3pSgu&W zK`x7r8mjssM)t)}Yq8t4Xi6AW#yBwUmg)^I?cyS3yXqb8V}TeKBss*~?SMgg{U}nS za2@lF;!4X@i|c@7Ekw~DTG8&AJ{Kd;Q<iv^vbrlR6OWDG+0`Bhd1mE`rEuw1k#Ir% z7W)y|_j1YZQm0sfKoyB-7X_Y1>UD9D`~`uK!3`Buc{%2B4{J%ioRlMx&#kB{e!Avb zJrlj#<)~p=4r6CfO9_3Cn1xhg=x7nk+LY}yn%fvBEBY;q4p`CSxj7W<Dru1=c41fi zjgF{FvXK1BA>fX^CU5+@tJWJi(W&KcO*jj5x;xDLZ*AxFvIAYA@P8yW`o)9#pos(U zSgS*I-N9vd=^11lccI*yNQxzMgJ!_I?64MNHZL9-U_DIfm>8g{k^fj)WeFHM8I_z& zZ3l@3<|n0jQSo~R0*Qcqvf~?+vNohOl*bzy=)XeN;2a3p1~0V$$gAWoVuI=*iPkyO z;E~luur&+0{@(mshrT+g9pcf!^T48w$vch$Nigsv6ylw&q=E-ICa#nDgi$8vmBC($ z=yLuLM0U-^2^S`{_ZwTz$|kB|ZzUr`AM@J;{X1nZJEj`$4skl+fss?6#-GZt`JdU# zvVUW}%8!tF0rBe>`+r}#|FsnVkBs^MUX+ze>dHSpWnWVCqdl~T@Zci3NHq%q1q0&Z zjiRz*rIA75MSd&j>=Hq=uts|mK)cc}S884FYT9`Ym2Gbq-?zNU&7M-!u<)j1^s21K z7oJaB$L#M;cjw#E-oI~{yJTr2o((;6binRCTJm*%J0nr<VUutll)ppFy@>P<k38sr zk8`FBLf|O1--H6-a9#2>f%?1jgigQI5bI~2dsFN451~NyCYYvfVfu5!YwE`!Uv%`& zB-2spw{|p}vcNP<;@k3}sV|3_r|H|Z4JC9~&KtI*)@JhM?U=mg#m<Bq>3PjRVoE+M zVYM5uWSO==K5b<g9k#9ludk65?GmDaKnQ7`*c2Y5HVx9Eh8j6Fcv8tORPf=Svlc1h z&c-6owg(lb3KC4yE*VWPV$~bfsyA0s)yp`6-6<R}t{}`PF%1)GY{2!#sW3=%sbm#g zuE`pUD#yk)R48lq*c1at(x!6fCRVWJU!)EW#3_jhNzWp-#!2$(m_p1|*|roRjSubd zj?!r;^FTD-7ij=rH1TeP`S6l4;g81eGy3Ho9k5U?A{+?So0K7mQ5Z)-X^pt0b%~?* zMMVSy>E81EEz2?F$jdRB^ec45FWK&Dz+e}E=Op=h#{z^;qey2Dx+2Q2qzwA-MpAB% z6U&685w0+}tjouEmcVXOF$U)7w=8u*B7piVzASTr-X|xfrQR1uvc@IZr$CD4MUVF| zMre!R*v|cBT}rB>9#r~c4@(}lBCp$9)X`O$7f_9s)8|{>$Da!Go<Jm-tOz&ASh&&Z z2DkZ2v>_qr=;4rtnr7TgXUpffMV9akHEvEw*Z&g!2Env6(!b;)$Zkq!j9UGy>Zopi zUQ<$5Ex<;<A+9Dl>BxM?&1+E#8>B$er2c?TqH!q^=LX)1lV=@=!xtMbm`$gt70@|} z8AM$V_n1o@=*E15EncO@{D<SVX-=L()z8Fh8{LsQU1^I&WmONXx!p1C`IWx38^d(* zswUB)-7ssxAUa>Fc)hEBSA@Nbk=GkNsF#}_mBtmF20k$-)eOP+G`q*EAP^>>5d@ea zg6^gb37{ol+=uYC3->5=jbqd}&J|19Oh}yYviQ}E@&>94`r85c>mo=XKA{q~2C*8q z1(8IqD#!fuWdW8DT^RfX)ssdyOzHq^sC=mmY``qcE8^g-<WoQ-{q~4g?&D$m<N<fG z6_vZ$?+PM;;DMG>o852h1`FBL)_0fHqqzW%Y(brO+X5H!1sl*7|2>*^XZQ^Um1qp- zj{+=uY~SxwTj1)2rmt7luK=kSptJD<xtPC2BM1x!fzBf^_W{=aF`W1sA0W%%^FQsf zk@IF@C*}h8>qqF#W3sech+R{=RBs5U1mcd@_EU~~8?dsmUjsf7tKBg%yZYVwFEDFu zWWQwnb~$%v)IaYXT;h~afPZz{<k4e=a}VnP?~?q0c1nHOnoi4AC3l-rj=%olW9C^o z<tqHs-y;6AfBp}9=fB;ac<qcGEq@%$e(2MNHvdO$OpKir1EfO?lzwB#Z){Stq&Vxl zYET5-P=dgR=-cT_x|%ml5i)`wohYe3EZgY=y~!OQq*81EGqR0$x4U+h9(f-=$M9ib z6erag53odWM1cl4&VbB%0y_)-;`A)g5)eFjlphpa;Y5c=q&`f6Q}Co-u|$qeL7$N= zNKB&vM29ZjBhC&Fbm&9yL(ndpfkeU*o`A%^(i~$c(zC!tA)nAAo-050;VjSyqxQw9 zC(O+){IcVn(b~IAr%xe$H8@i5AM`N_C0<Ncf=zg%m;c><G-Q2FqhI{9jl)HOBl%5n zYYEo8GksGdkVUWV!BZVP(xfB;(jhoFI4;e*N?l8}GXT5RK2xwIRje%}va2i>4^@br zn<wq%L^w{;R*Yph<{KY8UNx}~%O804Jvq#G1!7H%A=5hlVJIeNt{9YD*L(;1zazE! z?Y%d&pQ~d0b5;H$lKMvg^lw+?ACXL?tfY8953J|>($GS68Obz0BZLqKb0MyvEEp-F z%XZOu9nt29ll<E{#|z+x>>hI<yaa@%iqp|#*K<&6_I9=PuV)tL8Als2n>Y!o7Ulpi znv6Q&d-<Y(Z@m_y{RB{=3rCK_Q1A|NffEjDgfCNrqN6`kU{-{Idc?~aHp(O%q`I-Q za-lk?1GYP>;x1Q#smNV37IAjmqJ`f>4;j)zs}@5Ggb8NHQ&r9}YcFk1=s0qSmfDIT zL}IzQfY+Hb7z3YWw>3^;vPtIw+@lL;+6f0j=R`K1?Rs$3&Ft1)@NM5zV1L&`Vbl&7 zswRx&Edg?U7fqYMBpWQ6jO&vI*KI5odc0(9&B?LUS$lNhs$&T-QLab-p|8suK`a9N zU;>Q)dneC-M2!FT|4RScQqNRUcScY|-Hb2FWK7ixX)w*zIKVgM!)R>CsoYSb9@Lsy zLJk9)H;@1=N~KM;fxCA80PT1w>bSwB_El6JKa7XzdPVs_qfTy_HegHLC>RgUxX-lj zs_$O^k~(_!_WA<u8Gj*;uw)_G_dxxfVJ?W1q-Oiu8uBy`bt`lSmRj%zf;yZxu@;jT z9Stol!nxmsW^)X}R8YhXOt~+kIxG;buZ(3hv=@<IYom)8L|lkBh>Dl_zRBtc0-mj? zs$_XlVRk8UA;TzI%p`NZo^_F0EiGU(u~@&bF!!jgly!a1es#9LBez7Usio}j;#J*M zYwchj{qF*wFL`?T^AP-=5n(>kT+$T_0iGHp4PM3Z+@Rs&k(ghDz;|7e>IBW%Q&>Q* z*|!8m`k0#8(2SfZzjS1JdAS)iL*a3Q>Tt-uHB0^>6;<V$nh@W3O4j^kKfIo8_N%CR z{emGs#-(-)EaqQ^G!Z0Sqp<SvG$xv<fPN!2CS(P16m#eLL5F_uH3~L{j`LM1#iQYR zs@(RuU-RearN`#}XAP69W^ZQ=Y0gz+q+>1Ac&)lXvA#A+^~TF&^<-Px{Arzw?$8;b z6(xcC)ary#!{#M(-LV!}WvwJ94Y}p+dl+)^9$xeZPD9+g#b-y4E)=6{dZvMSy(4bs zQqd@m1o^6YxMp0{hxGGmxj9Cv;|d+QcXE|*vQbI!0Pil2SOuAXlwDZl!rN-01kujv z`f06S5M~gsjn6G_ql(Z9v;Hz>hvm)t+G*Reo}Oz2DoZC~IJYFxV3=*1bcDI#V-ehb z`yS4?O;M_uUKUWRm9-0*%jA%+L}L(ouJ)NW*6>k4H0cLNq(fNgHv4Jnoecj0zTR!} zd#20Z0rVivt#5;(=aRdj<I<fS%aM2UZ3tz;_4Dg=;q4{lQj8JEIPH+}>Zc}W37m&` zO8hf+O$5W$AK*8A8`$z*=vRHy=*QmoFlAg=(s#RhNTHVYC1}1K@hC|GVLZ=F6-*0x z{+sO$vPen^=y*Dt6A!PzJ!}(6LIqT()R5jys9m(YH-ka(Nn?~~Rtl-H*pP{zU-MQ? zlXus*&2qLymA^@KO>Y@ZjhbR)e1(|kVQ~2STn}<nr}~EMrrv&o5vmQJl(b{lz1B=? z`G(`WrTO+e2Uxb3yoO5yxCIAx;BLwNg#ZCF_3#K2DdT<$;e#miQ|jt+_}8+(#-}ea z5Noz5M^J)`U(f5XiCc)yo-iY~fViu$R23efuG=@d8qvm}5`->zH$Hv*3wW<D6X|ct zE%&!$z&zmCy%tEksP)#cTtLo~A*HuY!2E|(!a`BA4w1;r2i+eco4|K^0L=$7Ism3A z`=6O@-7$#cxhb$h|Acl}m$8^MgNIQT!uxPAZ@3D?n{oy8!4wRmFbdmF)t5K_{204B za^`0?t%RF&&2^%f<rZgDVU3u-ETAmop#>t5KBjg$eN#@{G$fcMS8-`5K^IA7m_aM6 z`$)$n`bVh3x<&!)d?X1WLQ9uG9!?;qPGiS*BaH;RE}RifZm9eNEHWtim<ZHESjbbe zo_<btIr?F(=O55waud-trgV4(CJ(K{D;FV}vsPiF!Xb(B^?^Y>)l0DD^SyZww8iac z7r6e^#bzT+IQYWSF&Kq!LAalh*r_;Wzi*>jtu~LuXq%d^sr49_?y34lr!u2w+EXxL ztvGKYoa^y*IC%Ypz%YnJV8{reNW^fpBHc9m`O*l>0iqm+au0Ze=X^~VrnQF?&PU+5 zvDnPzI3)KOpigkw6k+Ys(1~ggta{l}hmoJQoMZf-VJ+IOf#vtk(!25;+d@FGwm{aR zAx2bT?D_&PU}I*Rt}$?_UtrnE;npz+3Wm#cQDminaPZX-ZsD&rZgNMlOP>~lPs)5- z1VY9g@uu8tU)@>Vy33Lo9Nkp)j+fdu6g^!Frwn87+^Rz~KEqI<wPRV2ZBv|i8Izgm ze)kDGLS{?i5iivw>ZNvGPU)wR*jLB$B}I$TO*f~!7t4654oLO6t8V2r?1+T_Q&0K0 z4682u*_{u6j(?P@{;`Y5=-T~Y%Kr<77Z}0&gZ+aQ{5EN9gm5}+3o-ZC$|VI0^CJnl zlu@4piaXoYaQOv8RMg_I3w0k1bN&6lEJ=n~1W@$^LZ*+5?6;J{!0RU%BNqm{<~-t- zYBiVcsKMtWrxI-wsbMy>B;oLhCnBi?O$~EZ4$9!UcL&30S4}6G<>y$P0t(I%#Lna} zX_$_w@IIB}3veH9GP|^0P;_>@eR7vav@g)kd<ftEA?>8j3{^_~v_K#JRObGNy!PKV z%zyn<UZWp%Mab07-a+0`?_Y2KXFu$q(zz6ZEbNz*I*XxtjskB7fl@%z3?x2o2y#L= zA_TAK&30XdW9~)VC4QIR^e&`M9xoBy7sIWr2Z(+~y?Ty{4kX^~G^@SQk%#?i>gxUd z^s@D@xs>D?9|0^XQSe9+5fMBr9-1rL2ipylxZmKI{+KW<K}0~b_`H1tQNx&ML2BoX zN)d!;YxO~?(g%{Rg*n6teo3edOUs6yMCGSv85YQj_8|?yOq%sVsKjiWi{Fbis}zQA z{F>oVU3B__h9-y+tCNq0iyqW8C?N<_=wTWv36hc-;u6_5$-8<-iG^wVX{rs#%*o<0 zP`zZD%9FKz8kA)Pi`QrR2c(!`3^|x4*s*D2BB*E3p1pCB6wSJ(K~r=?GY2zKWbkSM zk97>~<lV6dz^c<E$dvN)_xy<&)XvisHKU-_7Ds}6<ToedXiZ$KipXkJ1MH{k>}>cv zb$Jz&BN$J`J1%`SPSlD!*ydwZh|}u@Dsp<F3<71X!?;wa=|y=_=6N1!<PL5EReoUm ze6V<owj9uUm<X8hyb`-;{ORgus34kHuDR8xLrGo&oDJ9{5PRfR;KN2GF`Cd4IDp%B z89D7^0QL|eYULlK8)-=5QMuO=oJx`sQG*lzA7$?tooUx)jaJ3BS+Q+bY};1Fwv#)y zZQHhO+cqow(*5)}<Mi8ozVV*_*S~A+z2}-(E6K7f*pO2uhSzIe?y_BVHdJ_rTt0I& zEDtR_){j`(+y*sr_ORi!s1OxtK{>A<j-e#;zHD$to|nOXyu8fda+Ai?Zen(W6J@PE z-(-@b!SL@)X_H%Vd78&!-Uny@4o7RBtO8wR&sSpGi@DsaNcX#lJ5G(97z}e>$4$sz zuve=&^SCLUwSd_bGS|G?7q|}mlM8;PN?3s*Qn`LoL_I|_0v+g4G5lm(&>D&~sR6?l znI)Ws=bL^}57Jk}tm&J<?wp~3>ypgNPrn=57ljDoPx5vC%_rIdlHBI-9tCQd3ccs7 z8t-*ywH72aUrR7)OSDPqV2JeQ%}`Fj)8^<7+S({A|0d~}AU_#mFK*xIuPXctHbR_6 z0>4#tdv;L;zy3>@ngEyuC~{UEld$Xby%R!P6GeG0aQ`p@>*JR7p_5+YHPKN^V4fk3 zP=|o0bY4goP@xf7HieU5*Pudrp}QZK@B~{n6cMl7DMdWz@t^;~@D^eU<>!6(45Z(_ zk$+hp^uOOo|9MRR!MG0pHBKn;ANR<Y2Ti9vO+(2qUR4l3DqG($!Xcp>0%BC@7!g<f zx&~8@&a2eR+!w@m+O8NOlGy?HonXc(ooV~IIAFuHi>ZmJPZJXt>$m&mX8a!}cI&=T z^1$X1PVvlD`DVXD#eo%T9Hq`v^hcCB+%v=fj3To3%Z<jfl#{wGHdcn6tI4)nt}GUM zWrG41a7EcawE?lUuFtoOg7%~3NZiFRRO^q@n!NkzwCXYm9Z)XgTAUK_k>Wn%=JZC_ zoex%j4<fH!1xm*SR_sR)BLUK7PW1M~CNY6HQCGzk_fDVQ^E!{M59uO+&)PYv&m>J+ zbQX)n<fsyw2pf9hmWtAYH8f0jZbbf*6yp<%vB{E#6Gd2T+!0)ZLG;-nmE-H6zoy)^ zd!c-bMxSGPwTf1^w|TLST83)8eYnGhrvAJ$&P9vAwb?uqXkdoQnrWz>1VtYQf2U6; zl+lO7)ctA65@v(JWy3f!Jhj+syx9tcQ)P2qi3?*W-Zw#Ork|#Fs{k`fVV_!Mn!xL3 zIk}JIQwGd7Ve?#cLD_l3;B&IP`k1Ad;eT4RS=pW5A1<B+;OgEnx-?%3>i9B3J!lo3 z!WN4Denb)1o>9t<EeviDEih*`m1+W?r1s`FNLGUFWPT##=gQ6xuk6>u9*MQeIgR3$ z0rD%TiSRC-!526-Q_<1bGYn58#9j%95VT-muFHVK2w+EN#G8i;i`sA@UJgGpB~}7x zXT$xV`dKsMX!X;9Ku-Kvd`_&(SCYV;p<-2TVNbPS!mBJ-Wd&_+BDCO7!-z<HhH8*5 zoZItvE?zcukf&x77_&;4QL2%h0tR%rsDKIsju8veS*I`^NUDu2bBOnjQ}BMZ;Psiw zF80VD=wSW<+{^%I$mYMd$_2y2J3qe}*L3I~Ke+#|t@3}pOajIxHum4Ev;Oy|Nnu?C z<#P$Gf+&2TB_*(_0FLFSXYWRwUOF*onx>tt23Z4X=cs@kswD@}xU^1g^h~pu=^6pW ze8CszeDle6mmn7p6^EWdfD|dyNB$<y+i8XkUnUQy&*$4Y^bZHuUxpCjWGAt)h`ofO zGJrr5Om!`|J*X;sPhzxj94ervS{Te__9}4Ofc>Hf%@?7eA4}|ajD2dy<hC37C(YeV zShbjdTF=e00;;4o<;8i8MX~B73zo%=G3+95(MGJcM52c{eXJ)`0CxP=%`#$?TRCiU z`kG#h%DE<IKZU-U&C*z#lPZnsDALq2OJiHE20*R(d%@l~g8D4}0?kL8KFftc{l?vB z&IY6OrbcC1BtWJ{ST?S<D(a+w-wJ<CIAf}w9%f-OuTsN#H`Z!FI%*mNY_k<RoYm^C zkt5Zo#Jjqvyi8pj-D;eks#Rt@f$b4)d!V;k1C>BKnD5ou30#)271<>qDF}GnvD)t$ z2fj&M*=&%VGF>YIAwtb!y?Ie|YWR?x(Xu<S<BqqlBHp8mjA@U73eN$iR%gpFCj7Ce zP<|>T5a+5#3i=W?qc_A~KjWxnJccu=Xz$PiiuHzL7#&Jt#VEx6v~-8J%V@+^q|MYi z{c+eNd4k(vCCT3b1G%D0UknFNZ?%lsqRm{_Bk#15n|;|H)9O&HOroVE-FG(hc4&ZE z(2P$V`Y^c7#KE)tx3Id<0tT%cp7~`AFs#cqf_JH!mS_Fm3^W1T!JXma96S=IrQy{} zb0%%7OB-G)J8g)5WpUWTd10Kg^gMRt${vh%)nB};`vmNAbL>TCRA6}wIE<1qWykbg zPcCUTMV-!d>owCDM3^BD{hCpJcQE*pH$gV#ErC;Wx|Pm9SnipSi4GEzX%cltZ8sf0 z4GJEGTyuxoh}YL_<o$SGkk|NqUnJId>^g{rSCj(Mn9xB&ZpEqiyz-a5H?)=3b8E8s zNV4xhy4<lFeqUr7Z#Q^6vSB=|(Y#H*zuJADM_Hvj0*A@}0+{muNU{Rp?Ya&h=|E;g z^Shu+6U6FpA1a4^0N0qW@zcFtFSvdc%!D6)>dT&cqJb_1$w&<_Ly*<nn}fe8JQZGH zizPmlZZQS8Fg#nsZN)ocv0`-yw%yKfBxZP^WgMA=Si<F#`Y|*G;<QDgv<r{y26MZ2 zkk<374T0i?G$)G8jsy|XLx{wAMa8pFib|cNxxgPkz6T8tAYwrI31wK}Hvd)&6}dVY zetJAdk6O(@X1@}60&@71Aj{>)afAyxX!#R8gU)gG)(#SXrbXZnoP4uq5;X(XFv+a6 zX>3lBn@9^3=&!a@<q#c?@b$p(nU~UoepO~~n$dq1a~deiHKe~^)9df+MdaVPS_JhS zjK4=q8e2P<JASX{Q~b^VTAO}@-~UiP{~x1Tp`!M;Jrjk;<*in(Sz$alj4(vmj33RF zp(wCKS}JWJx*+g57x!$(IeEf5)MxOkC!8+jMbGmIAM<v9>Iy7C*kVuccxvO@qV6GM z%IEWSgV;mL3SA>lp*KOzvB5IVgDpwgX_;?gI5<Q}&|T<>YK6==zNjtGgy=}3pI7Ml z*K=k&-d*&<ErX)jKkCLgNaZMlw0@Qf73m0@FhQCx!MlXeiFiF$#k(5u0X_&#J_k}} z{<+ZFl@NyHd)XRj+woJwiTm88>zJ{n?u+*PW8qBhLLy><lmBL@Eceiy{rPVk$Yo^j zY3Z29U8%-VmR|h=AfNsdOrQ*Ho4UHHwQVwlWt8>UlMZiEIK|oHw$2r<n9LI1j8ays zjp$yYLhFUd`=xXzfkWMyz}u#?zl2yAx0*g_CI}SMABQVTH9J;ClnnuXS0lw^V(FNF znoYuRP;5tgv9!R?Z6OP{OL3$O#=zcQPkg>s9WFwD^(_d8L4@aT5=s?a8<Ckkz5kY+ z&!+e4O=qApdWVr#!w{afUU?6)L-lb`R~sVZ<?yuUKpNJ%<f(A!sFgclv59*CO?JB` z{vnk!5gQR?UTfl*Wawu62$Fi)+B`Ceo9^|LQlFYqYKicG>c%PT*VUVg&tO4QDy2SY zjm2bF%vg0dwTFqL)$eqaDox6HxHo5b<wJD&<$KMD6W*98J5qUf4f1!tJA|C{QbG^> zNFgp5r*h$E+lpT*h%KuH+&3V2#-tv2SyzkL$JGiwZeF>fbV(hQ2BwSr_!rt3?1T{# z<Qw|+BL4Wn^Y0X_q_vHU^*`|MpVv{*QQy({A0W7?_U3}Ji2Jo+6u)W-2H^*Sj3Oc} zR_BIv<7cpz;t#?K&5D6_+grnB4aUl3XTl2EwXR`x{wDwDhaXzPA9GL(B!wL1=*G%m zpZw#82icR|lI`n>3+p)Tl>z*Z!>MQQ>u0C#>Grq9WuFghUm2<38IZ<^qz{5X#CQaF zf*+9#(YJ9s#v$mL$-q)RasrGY`j8?J&3!QZLlA<|;QEREfPSG;1T6Zobq2^_0kt5q z09VRDG;Z8JCf6j{ENFc;@3BBW=)L0zw=Nv`9rTWlU%SG*pCtHSWjNhK_eeShOUWc1 zguBW=S8?nd=TBUyH^szUGwHcZ_085TFwz#|m8>-DLDz_i63t}Q{&1Hz4#&BBM00Rg zVBLmTo3$&AFIBXyzJFV$-LXKdTj9!w1s4u$sTtwJ%L#eIW7Q-qMV*+xeM-%y0(?Xu zYf$T);aSqS%JCFk#=-}_oMlbLI6SL(vsS@VW3P{axttW?Aj^|nTNjt{WwB<@*PDZT z83dbE=PjR;JkTlb_0}gc$vw%DL8IuHL48?t7bk-p_2$2S%@_`iYL2H6r(tbXtG6$H zi1#UpOr)gY$kAjz^D_2qA(d?Drx*fE7c<PPDJ_3{tK3<QFt=3-{ZV7W@$<lT=wEDD zQGzVPbW3dA14%;AztGF(+}pOM7#3*EC}F*dp#Z{-3}0$x&gEEF;_`^!8!7_d97jAB zQ!u1UY@v`!)Z-LPYn-R!aT|a&bx)7i<CuM_7wAhz+KRhr>iOz|S65GQ?@VtM-pB2z zI4+D&hV8ICIAo>$0u9M+c}S<ADzaMS_*~>*w#r~(Y`X!*Ot*s<>_$|Jy`<huD#Y7+ z>Jtq%-UyXuOq-?62R=8(;>I?z9KdCKML;#{YLY$;T>XZm?=UMn_|2rJTDP1Hb8<Fp z<aUbnsQr#8qC6!OWw`~&osnw>tg|jxd^v+7b=!NmtTqBeh&ZS#8&>3NHz5w>{Y4R_ zO^gPq`R-cbRMDwPNbP_#R>)zaj_`d(XF|e#kUT~iLdsnipk{POw`}Y61ZAD0nZ%DK z`9$<-)~~Drk;!X=k_bh1nq3~u>-~rbzMYZ?_?z4aK6~P}R|Rp=V)u!VrbLFxIW+2b z>QCbRY0tN4TkELh&c0Z?EZk3qPr_Z~pM`RmqbUOkJ-FMoK2VOdHC4y-G}8eV+DZWk zX6jN-&=s0$n)ykYm32Cz^-9AHW)kRCfBXP_Rx{TG3mN7#g=+BS3*~Hwshl1}_t0Tr z@>%){i8cncHw7ld83d}Tbd$lY)kp&6w=djR4OnT|iOe!>@!}5DO!8*$5^bG9=g)2C zhntFe*FYJuTv6y}J@zbU^Oo(_A470wLp;z+iI}Hu+#FvD9GC*|JoXx#vUsEWFMWzs zrZu`29dr4^OWAsvC}BUpF4b3865d`bCI=`twM+)7OHA!s+~FKJo5g*Z3)bGBekB6l z{^OH$w2KE<?zf&8@k_6yRIJr}hcudOqE1~y0Eq*_fPs1cky+8)Sv7i7LpNB?Om!yx zM;fItNi@4ZrQ2AmE|%j}vPtG!AqRwCI|OatCMqg7xAqiaR-xma;2N$7gT8N)?LBc= zp8?k3Za4&tOui9P;ck++*zS@zNI#38ctVf`1UBcj#6^)4Eb(s~ezA@KN;{OsJ&dI= z7kRp<eD#c;PN8~45^8*&6`&S`b?pNIOSf9++RLBl2IrC^ZIvz4&9}tn`mbiLP=}&5 zuY?D^V<dj#YMg2~pCAffpw#IigWKuFHQZiWsUA|c=JzlvDEjb_8g5a<Xzk4<#_%DE zF$3mxpI#NnrZXhGzpGznI{6!mc^m@Bn{tya*JW&f2wN;8bO0l6uXzO`KU9)=^-?HF z=Kxryb2RjTBxwy6f3^PwI5<SAjYT2gBQA1~?-{DrUO?WV+PIhp35dCmysUAajtlYY zuCGd2N?^){)%p8({py_ti`FeU(0qDBeYym}GD$t-s3WZ=8h7>i*_gGoh!}k-;;t>d zONzdN&YtPqo8~CDbOb*JqmAK3!_<<xsDfx4-c#JdvbMn))W)>^zKpEMCm1_Aw;5Ap z5mLu5wB~x0{)K=s#@QHe4QB^QHDEk8EK5<Ay(@pqF*Jbwp!5Y!I*`mx`WYm-xBVjE z8RQd2Rn^^h5Z_Dz?INEMZWqe!(w$wZ>WS~XtNf1f;f+>NG|?7@i{z{;oEixJ8NF5> zqrFoEMY^>gJf2r0h7)7!AZa0;Q)Gm-_udiHd6-r+nLkdP8Idjb7YZHg0a|P*pi7<c z=@pcCpP<<n!yO~K<?yqlTpxc;D>*?SHZmWTU_)ek9rzu5jNMxZ1-PQ*8;dpg0KMZ+ zvg<$xcKwT1PCU?+SNM$wAHJ2tf2-A$Hg|CNMu7i3u;2Rm|Lb+l{H9sv<-UiSxL|KC zp<+^oL`w;+0@uOD5|ltr1!It<>CyM9qAyLPU7^`<<=sZwJj}lcAO#Jed;j1|xZP-) z_$diC9(R?o{+&~-z0B_J_6ANFjEe%X=ZqU66Q?A1(h!AWTU?EZ3$shuPcfd!pqaK8 z!fD0;=)T-Z(rPPKxo<FGMidLA)ctW-X3++;rV(Ke0uG$ksjb&kYR{O{wH7Rr=z+UO ziDF2??3a;}T(WcHF2Q3o4MUVOIS-i%U{p0GVHLafuvs%RsyNa&boS>I++8v5w=@#2 zMjXbSXl5Z|#_JGO8fUn|tFn|N+D7@TQwqfCT14gR8eKfo(XD8)29;&w))lNX3C4^C z4_yvO`*Vokel4~CYWw|m?mdP`6}1AN$VtBqzG;7rd!*;vK*TA97s|PqHCZ{xFnm)~ z9s2x4@urFRS56_BvH!qM3*$k#n1pR|IB6|zmWY+93=<3xqmsN1=9s}qAI$)aN{!JH zA_;b-#~mdM`1_d@qW?<#VVuI_28>DS-W;HRhS3j+m07d#0Xp|#ZnIhhr8t)5s_EE` zT3JNF4UnQUH9EOWEO^G^5&wflY#veqIXg;kE-My3<3l<9gfNQkP1q**CvbxQNd9i4 z?}rC`rg%nf{cI18sklEK1$F*5M?}!fAVS$8bbE-G#XWNyeA8y{>>3X2v0d-+Oj2Nm zDM~hDkKQMEUONW4)V08yH^lSkurW|St2O-qg*X|7z@2eK@Q#PRzc^?S&VF!iHkZ9r zQ|_p96s8ueJgP3de8T?u*X4X7*PB1c+u43Z4}DJ|zhVoT0A8Fiv)KyX%2cjV8ZN3c ztL2<cM_koDKzBCbI<+v(4|2eaodkp75tK?F<m^qk4|R?V<yYnl_<v_wlt3hT%f8Eh z;Jf_)Ep+)`b?>5YZ~Q;dWu@}E_5AmW*7O3qy%ypGR;@9T0t)F($+h1UowgLH!l=2w zK!qu7u!lkB2db9ff@F80U3Y&HLxo6uuR{t-k=~4><flcY+saI>KaMap`91+%-=X4x zPIjb`(iwV6mt`gQh|&>5t)M7K(0ED|DJt@k5JMGy`CcbL;4X9eMpYv9y3t4yjy&B0 zXf?}(|7;DEY^&|$+8O=?lHh`ed24Gb-U*!6TTaZ0@pw}Q7YzJ;?~UHyTPQ)J#Zvh? z@zWJEmhvLkp>o(em;{^vHcBnExu;CTR9eB;(I!)lr!hG6E{)ZFyun7Nb=JW@0qs@d zEkQlh4xOnd+KSSjO@HD@I=o=|<+>iix{rdun$Lsk$f(=9m_IWJCWN&~H&6?b*q;D~ z_z1*N#2($~+O|WY^B2XDwT~$_Z>S36GLjfaX(W-3%cth0B?O@ffccd9nP^2UYXi03 z4uGbbTuq5S<T#9jUus3ija01(<T6!rnRkkQO|oX$rb!AX-m!OQiJwL>1&7(wk?e{h zVAQ9y(!U+Xu-73g-D=uy!XCaY0}{*g46Aw(uj3Y^`bK2@ecVX7t+Z{Sba#VZYI$;U za)t(vXQ(p)x&2Z1>e|kteyh;gzRHrGHZFI%Py~Mt0qoEdxHKWd^)3)GmjLTWKW3do zAjEvy9GP>k;}a@@mp%Hf?5FySdRRTR601M)xPFMIdDtwb#x(F{<^lxbF(}O2M7WWp zl2Z1I|46W47x`fC9WM8*U=}&;9?~EtEz$n{MNV}j<ykf&X&JA^Dx1(YK_|Geq6VWt z>hKm(Yw$~vO&R{W4Hb*>XipJ>;XH2Jpx|a+wMXI;lt6wo3Z)Ljs`DHXyJ)$LIq``b zD^gxc6cys%uUQ7+5cWzYV*7mU@Rfg|8&gPjCfdIbLD}~qVEcDktbY!{zmfonO8<HN zdtWWh%5&mWLv{JWY(fPv{zeFcpq-^w?=b=lL>n{L7g&g|Bl-aN0_nVe5{2&8e+`xB zMjki8%CJ(<YEO@QO*vfg96xw}JpP6D6;2>Aq9@AD?tZ1GGLZ5Aq1*=~L5L<yEiUH3 z6-h>@!tSX&ponNexP<A>Dz*N=h8YKH9L-P81rF9<S!RySRe994+co=4a|ff6*=But zS~Yq(Lh*7f6;06YagZLR?VKjsR{j<>{!7(z-F7_b$_<PlsVr(;4!g=*5A)9^qjDds z)0=OxTV;FJu8i*C490-Fo_wC_H`MAAqruBn3Ymv|K<ZcW>>=@tomyjdThM!y<6Bae zY{vdG=_1{p8)N}8ioS;C@(dr@R_)}T5C%c>V|b~c;5LhRi;iAu8)R}ulL@=&s@Zk6 z>}ySWoQ>vDwvcTPx>kHaVbZ+SX}@rki*GH~J4<nV#NhW3SXO9Gsz#^&a=$>+^t9PC z=u|fHt=14)lle{6cYvOX)mZ&GBJ2{g$@KN8b~e?65RAYOh7N;tzih~EAExjN@1q+I z%{fZHMf2P&Y=78aW10S)9?~lu7_`s|<`1A++aoC^NWXxm+jurhppAHvH?dRhvT4g} zhq=&!vD%Yows`SWp3<?__@pggGK}{3Pe@*SBiOjYI3r?3CQ~s_ViG?B_h(zOH-P@! zA%ZXB2EnLnc-{`YP!eG)qes{QM_}^>OsVWit8a_qg>5DDv6w@<i?tMckfVKSCB8V} zXB5E`u-g;UNE;5LsCuh2`m=v##SX7IH)Ak(O3n&5u4NoELA!Lj2gap!qDlyQYU(QV z1L~;{)Zc?NB9lHN_0I#sIF`8365a|AFA>3>Lm9=CAtDXgJv-m&d;~GjW^oz$Nk(#o z1@_a2@uE@10q#}vxN(esT?KbwBA8PA?NrPEpYyT)cg5-dgKbER+m`sAk2Ta?uU_9) zg!RR|*tAsgGaqGH!bakI{!w92PLLRFM>=soXI*OIYUm4;7fv+@-Rlppk~yYy-;f~Y zcJ%Gk`t85CQyCv0$GhmhL<<5aHHdw~BEFM9lm%|p%#Hbwp&mQodTollzGque(8vY{ zR52gtrQ4dcCO!$xA&Ru#v!AX@CL$(HRaHtn!s|1duc@egD!o=UGEWK_r5cS7tNhs` zXU)qVDM>CVNreLwc-GFA*S^Fo;8zo42_DKC(|j8o_}K(;FZ+tK^h}zcEzqyTWWgS@ zh9q-VNo7ZrCv?L8M>F4XBPFc`LGn%7C|ap&BD@1pRflYD?8kcG=Bv?7FhDcF#Y3#* zBRajkVLtbCw0g{{;BLZUXNXE4Z14wHVE*azZ*o4JS@ma$C)d8`c`ZbJk2~_fGvavN z!>{FFkFc8!sb3(TVQQgHCSQ14xZrpu4#;GuWJm0@kuVUqKsRotYGY2ARIOEe##N}v zbX>=47@whw*!`#5H)A98{>QVNI>*K~_FtOT@KY!+UcqjB1B4c-kBRlkrvGYy$QybV zF8{s^o4$h=|CZeN&(Hsd7yXB2N>uui`3|dpKDi%`*(GRz2+1RcH;9hQ4`lzsvXF{^ zASDO;(yU6hckQ&eg3FKILw=zn1_~wR^}Q~zbJj$#j2DQXx|*2syq}!7`gpznAoJzm zJ{9JZ${c8jVh$6aDWuQe$D)R<=VV3+B8O&3?z7tEs@|;vc)&p7En(D+ufG#Db6+i2 zG_pH>tN{ti&V+3C6i?=zx8Hu>Rb89an+j^Ca#Z|_`WR}?UZ%#yU8jLIFGa^8Qht-2 zPIzqsHkga9<B=E<%BeMwf@jd%E`4Fc`6IcC790>3Dl`Ym)3uh<jg<VIQy*nww`sw# z$VW0mia$@&kog?)0mFRNH=Kv9DRhpM4L&qSPr<4k1gB;#(=lNIN3{TO7`kaC7Z-2i zRqVt03It<<BMf`fP{Wh`rb{9DDsDc>-Nbi}_SsrnFPardtK(KG0R0Alo=5;j>-W%a zv;YBaW_n*32D(HTYQ0$f1D}mzt}0b00pREwqaDs63=9t4-W0$vOrgWA$;f-Z?&gN` z#Y@8Jh((?U{Aty(@Y^H#kv>kR!#)il7cQQrqnK(M8+N!FX;TKysz_yWVeZyih+bxz zPFhwq*I9wiJQ<ayh=sx`ASYa64a^);1AIb|c;eKn#KaEYQWgL=N{_1d;GW{Ilk_{S z6od55l?jHZ1!g2utp7lUSiwwo-mEaR0FF9sJI5p*{N%5HE&dEETrAQbx>ZaX@R@Fd zhm)M^g<jf0GU8%9zd`2FezUzMSFOTsFyp&Q5qwh8E8%co;c{E4G;n(7=yD4}OtP3b z>4J!ocM&Sr#Je(})eKrZfmJTtsBOj#%QhS~p?;xq0xat>K!`S6yqJ+fOHe7RiPEXH z=n0VtGLi<r&KQu$p(hH~Bd(Ue3{$Qy=_C4oN5iK4c6ABgweR{}`~N@C@c*s}WGYSn zhbHi8;=CSY42_ygsqwpFM!|^US6~8y7;+q`veX~32i62>buH)7tE89ep3(GVosQpm zp|j;a@eEz7Rpe-uw=-^hN9oU9&rT-Yo*rL_J%lQb4~8PawCJ#I-}SFFF?tvaaBG!b zTBym%9f;9t*5>+-4c`T6gEj75YQhMztT$#gMLkh}wXQgjGilvp^{t|I(d@IA0>GVn zVpcietfni2yDnL&wq|Q@girp$h%7qMbnk`ys)1-$xqmNOeHiRAOobh0h4dia@LIh{ zy#XGd*48bZ$YIF~Nt-&b2;LJ)iLy;M0aw48LMd|`3NK3}exvO<d?E}*z;X2!V}H66 z{k^KhgA%DKJ7C9snK;Dd5v)Q)?P3b03>%Kva$Hkbmypq|qc`#aotE2e&8Cg`t<RqO z7|cUi4Zl-txj$cED@jy)&~)ott=l(9skXbhjrjT{_>oXsxK7lp#v2NQs4T)#v(*T` z4V-l$BJ&{B?HBmT8)3|K-<zm?OhY>ss)<qqV$T;0QqDePXGrX*n=$c(rUBM#M%7Ge zIWENk`o21)P_#jXW-)~E)I{kioj-g;;f4_^#ZwQU<_@rNe^~1UQpev71oH{za@Qzx z2j_M96?FxbSx$UlRhFzOp5&ilB6Vc)#9vV${dogkK)(PACCrVtqRbPD96qi8nbq@4 zmT;U!>Yn$YH3|v82T4{qFo{drP++b-XdQ8sW`iIaxs@bhmv(W2Fxcau^uSMsEK>Rj z73{pi-93B=GkRE^q(gv}Me`lRD$4u##NtahUMW~WV<_G(mZgpxEkT>ktO&T}AiKv) zYPQQC9FaFTI5u-gy3R1+TJ&fCfwY)wTXYdcPDt(be=m1EX>Vna?{aVX*1{P79o+jr zI=)23ZJRl{?>rL)3bcdo`T_?kA{z$wVkc$<DU!6*h>8Dd{}$~`4ejC5hO@{QnXc#T z0QlFBFY^6Xn)J<I{AmrxqTTnI*BR@dpZE9ZzQ7GuM)LKsf;7>?tY@wU`ojVNF&?|( zbnfCK%xS|Q_1F<weSfCouXg_$?UcbA>^Kz7K?C~u(8lI(naxFtb;QU!&?z02`H&FF z!mkS)m6y@=PwvK@>EsMeD+WefGIOsvHuV@0?F+bwogS6kg5}ae=zx=nP;tE?I({Q9 zVRtg!inDjc7#8DG$VPEZA`5Im)BVEC9nv_2iK;;wK}ioH&CPgGb<CbHXDq(lvora2 z!V<&;`*k3^xo>exUQ@(Sj9_!r)kv<GQy;l4&5BxidP|gi!Kdjx2RN`eZo9uOu$j<X z@kk@0-GP+fQd(X$YocigU*uZqXV)}OSaPp*U*f<{ZRiWJt9f4ruI=qsF-u1Io2G=A zxt4Wroe_f7k9DiSz1HcSp!(Vd5CzlJPF{Wb-bUgAv+_A`ij$zM(2@RVD)$|gkc$eX zv_y`BQ^ibcQy%pU{`-hEsUcM#`x_~3r9FrR0l8{lM#>XCJ%encU1>SYu&bJCU4kM% zu&#jOS{6FHo~6ie5+zx|y)N0k&eb>APMu|luTQ!uedH$Hsv?C|)pDP8od%Zf@L%DB z?d11_^zWLo_?E2r{+*gqwzl}c2v(iS;|kx#LLQem@jm+B5D2$HA>`r^fywY7wJ~#Z zlu(rd>NV}eigu2Sg3_d8bT4$Y1!1Cz(0o0K*t*bc)*B~uYR<An0)cV_v>T4w>&?@r zUBxz}*FN1|;CfKaECVr%Gk{uFjmY}Z+SHu@@koWD{1&W1mY<Cm;?p5}fZuOKr%A9b ziNHXw!0W6VB$7$vBI<gct9Ie7c~sCzvE!O1)}s`O1=?z?R{3GrRRPnGfd!f<V$^)` zbVgHg&J4|Gtwq`e`A_dZRrF5i>!%e<_Q}MIwi={u_<O`~jV)znH11DX{BGhDbB@~B zjSCgl=r@M#`x#$EWOOtv=2+bDLHf58<Au(A4EUNezsGw^Pdi?8A8_+S5Br_IW(xPW z(~XB)*D5etMlVPgE>m2rB<#9V4J9>?*vl5oRZfXJTmY|e!7f;(GLTw$3dyXdC-ur& zs_ZQKr0CpVi2L-7ErFzqvnpB^fdXWKiYzKQQQ2%ZnB1O5i8%H>MR9pfj2#q3(f2sp zVrO!56^9YP@>1p*qBZ4b(z8B}iwWo#QPzJfZ2n5J5;l5WWJQ<IBX*k8hhg;q0m7}5 zYiU1hwU^dFU3+G6FNZCON*MU%1-gDBi7DU@E>I2<J@U*<a)(IH%`1nxmS~1fx}A*p zCdZiH4q;r^4q-avoNGPr=TE#!tn}M6kdl`lIeV6*D@WCHkb-ku334Wy$+vsYzfadr zd{Ebpi6AU%ur<dqiQAN7ce#-hF)GA{w_1k>))jQh@YnAnpn|kj!GlSHn`h1%4Pf10 z#$`L|cVl)t_`K}u(j}W>gTh}T{@E_S>wj}-5oWCtG&&=!2_|H?_mnV%zl1v9mRA+J zCMJ^31?>7-WTFszA&y6w3_lSx!8<+n4o@pN{Lvn?<(T0BQ29+UM7(g`QwA~LQZnP4 zU<-r)B?xOkj>kLd9>>fmqNQU{&&ZyHsS0l7`|r20kw*Fg+V}Ep%kOXy>A!Ju{=wRr z>gIY{gR!3yX{l`P-^*cF>v;4mcY)877@BGh6?uPPO0p)^#==jixyOm%O^2i+HnD$i ze?W{vh|)s_^3w|j@ozPP_FI*1=|dX1LRy)u(_anX@r5O@{4qT2{jrrkJ8^;;`Yz`p z>!R$W?6kPNC|ix|@r2;3ey4=Td0YGEQ<bHAxfU(k>?Ht>j(7H!;<Lozl?nE%cvtrC z3oP$)?mjfG+lxZK{&yVW*b}FB*7IVRVG(CJ5Jffog+z21V{~yK->}2=V^6W0W$^`7 zI4ep!?~O!v5~B<=*F@yi7{w_Ts5@e*KyKL4voF&)g4EC{VF$Szr8e2F46~Y@w1hMV zB%|OUt0FB_LN@$5!IPUVer2bGG~Q`Jtd_L+EQLyuIkjw*8Ta0}ElPt!T7GJ#Kxo*& zonOLfp)?We+vTM-Y)^7ym3oj2<t|LQD3PdJwn)pQ?9fJAe*nXhRymsCS&@X*ol!cf z#gb9nRPi|OS@;apO|8_8ZeFJ*$^<%&gmWl%<_a=aVS-sbs?bfX=uER*tE^HotM1LA z>2{2xeP&!pdpt(j%`AtU70i5Ar?K>M$lchY5>M(Uj~|*+YrLz+Z9N3Kui`=?Fe|1= zh!)mB7k+gDHRK;^CKd1GKRWJjSI>*YMszDj=op$RO-x?XI{$YHU5cHrjt6NIvle|B z#L$juDFK31N_xp**g>|YiJyMW_!Wp>UXUE`c<JencEzSf9*vU~B$LVX5Q{llM5D<R z)Zkud(UsMLg(&@;#81h|CbNl&v}Gg1v7b&{0Srur+tU8;5uuYC^qZRg4CTue<+__K zjkQ(!gG($<=S!7p>*Np>XD~WQ6<0EWeTxkBn;XiVq$xQnv48#L<uz9edBidE=Sr~s zwF^cqpc+N}L$5Gsv|?M^dOk7XMApi!e%`AJ8(uD6*6LZTR9Hg>m*K9f1Q8ZhUc3t@ zaByP4iMp@`I;U1fwS$bkGAwxxx!D;{Fr(r!oG;(WaktP|&V_b?=8BQmip6Luj5$0| zhc~53_*^ZlbQ-2(Y8FF)29@X0^xnMcQ5Se~#b*hLhQt+n2DLTSmsT`OMuM0oSz=k* zm^XohSF%XMksLI`ycclL8ia^bIX9+^&a4uqXvT>sPv0wq!P{{4E3DjB=sm@V$Y7%! zC+sm1RYq9hN$~{yN{e7VltX_cA)c|!n;*q?dYXczgf!fg(noPLrn<H#v<5pv%a3<b z7EDhz|Bm(ho}5a61*H#b3uuAfKtNfnPNCGOv9!w7{8_o^=NuRXrVt3R1tQl$#}rF3 zCkX&)4XU<=)R=s?z_x~I55?S!%N*6s<dtbE&hv*theJY~2FW00;s-D>nxesgD==To z8kL8^Xe6-n;aMKLfz8PlRF#MSv?4>??F%vaeY|2;u^2((FqEY{<}^6LdJYlC1ZqB3 z2{oA5)w({3mp4GtYs<#=m=-G}^`WExESws{F`1^KHG35pCaemZYTNP4S&coDVz1)h z8*Z79OCNUVzXp0;MeWe`E?DxliQF|%2gv+p-JXPDdv`g^VtVM@?JFJ?P6J_C73sK& z0ASccOU!}Lgai6b!cl)%Gh6~G=;U>AUOIwkc2>p<plqp!-!7yYUH3ADrk5)8H&?b- zO5;ui@?+C9sw_BLo%v69_<@7ak}GDZUs%U#;1tR0auq73mV#?)Ot^ZkWu!8J&PxJB z{1kL%IoeI&Y^RhnOksi@<kVwP7-U0l=zgVprJqaBUa3J_5Cx6wgNc_Z*u!juX~Jyy zV#97!h-~*>3YGZLOhFEDwM3HA02;!~cRX5T<+xEU;Np547z(7<S_2$Q0L@yHG0Tw_ zPQ@);EUVUHYR(u)u_XlB_6&$5Z#OWZkp1+<b#pO+j?k3B8w{N{O4!;0E0q-+j=Oy{ zhk%QO7J~MI;TXw7MnT$SDhOPX@clx#!M-v^!7c(-$~+q^`$R2i*M_CVI*mcAmLTN_ zCe_x$vIx6uFs;!uOJQoXNKE@k1^4%z28bX{<spd6HkB%-15Nu*0yc8d4RTcs`*_dw znDoOxg4Vs4fDOuK%sX5X%C`-$!8(HGaTj&9)}Df}NOZ<2C+!Jlw<`bnV0AQDZn6Z6 zYq`lxzy^s6S)^kPQ{ASe6Hv4|ht%$BG=^Xo*|SlK0(v;82MQw-F=ZHRM}QB#QL`4E zFM-E_j$jwvvzdLiAKM`~U?Y1l3&=tcPj2@p6)ziaG=vlTC+y!`Ez6OBJA~&{Yuwpr z4B^{7gF(HKe#*h2R>REiT>>AxDj?=02(=YF7$%UbodGTeWgW)mhUq%ohVGsscH}xZ zFvAmi7P59!*J~lG8ifrnwf6T!fOnxnfy+8QVkBu4a81qdeDe<eJCQgh8dhm;#0Ziw z7XT9OAQPpj66On9)$&0xfSWSf{EjIRPQJHDUxGSHq>pEiW>$<4BTR0#DoQW#Xh48w zkOr5#77d`5aa;OS*H+0?*2SoI*}r^XC-_7qOqyh=<N5cfYW%D(!DFy!p~U_?sZK#K zD~9ZJfxs}7<T;KY6yV7_jjb>csx#Lg>hkQ;q_?!}lL-SJD0?H4&BRTO`(T7`&1=fH z0g9@7?8b;wGwu11oSm{o@(2a)+v}dEcFaqdFJr`Tp%QNrqmIDFSa17nefwd?;NaEU z(#gt`FJTu}HP<`XFin|1%8^^}AmpUB1EQQ$c0SzBm)=_Eg<(8417DwupI)rljtaNr zZ!AN8cyEV!L^3VFlg#OVE8?Kq_gdBKK8{@L9YI6kM5O`k4C2vLnrurQ>zRO>*pd){ zz3B0|ccsUkB^<*IiL?N3Kcj2iHMHJbD41!e)8V1H5xSTc=e~^O90+yHjLh1Wa+A!h zsoiZ6;mE2e)6``%fiuL#d5-M={fwoxF9fU!#-A<PEw!f?Y3>*n=IWKM&w6fl-e<0p zdsn$Tzxt~Hkl3`0vvVNwF?<Nq+~1R0%6RKGrE0P;<#d}Za%)O$$Iw}cE<@p{q)vU` z%?cQ>#PRg}gj1OfgXZX(wfV=*t!t0bR$4n!F}W{m&0LlNF>A&2Jm-taK&Yln0GU5z zg!R9P+|Jc4c&$~?;e0^r=y@EmV%*K6r^IyM+Jo+v?U}Zaph@_=ol40*wb0{(PeHbw z>xTsnVu8b9`43^L!`Rw3ZM>{%%-%P=J3nCihI4UopHu_=f*oEV;eU>t>SB?$kzD<z zc3bb;yp1{-j6LMu^6iI_K3?U%wm410tgqS`Mqa9{qqi1S&{)j6<>v;~WH^`S`elYG z*-6@0jA_om<Y`pTwjy<}P0U7o7%357^tsAEV#czco3fhb&Ql6<edNE?chZp6ts6T} zn|*Ib$ytl$i%wQrmYk3CC<53awRpGsylu6Nv{Clz1$nI7zeX(B#ZJ3)`D=k_&#`B} z`qOpnb=Qjb$2QZ5Ti;$sK;;x(3NZZ9o=g->I-bj}^^@vts~0>)LPgL8s+ErVUw*UB zn`>FfTXiWa>Yw|TgrdG!mqU0}+vBytAJ2b>*|<^jXExZ(40s1!Ut^ay;5%C{%nu$2 zbZvhO{fsa>86G*RgW~X&k394u-+}H!zIo7Z&};6f5()C}?n}|IG45FpuWdi9^=+;x zLEm@I&%xhMM?DW5^0LP-2JU1xXOkf`?vdP!_h6`9Lce+3LqXD#@fSzqSMJfQsX>po z@MJYcqzFT;M4JJ6KWrV@<4Ke<jW-V)bSx7-zvV1I!M=G_aE#9$Sl}Tid}LO*=J)0+ zx+j<M@S`R!d!(ob?&6&o$!#B^Q0FxjmE`I;9I0BQmYB@#D67LKK~d6BTMD-q*4he( zT9mDL1b^==*@*1(<uj*M?v?)2RyL~{ubNP-rSkFXXpZtz!5MY=ES1nnv>*#febLn_ z>w@cZkC(cLHm<6wz6*Xncuo@WbSZYya>K>a#F$Q|dc{UKB&?WBzW0e+N)Jg&82PLQ zj>?XA{Sm?dxM?5gAqP{{fM{M1+0cp!ZwQS$68d&|B}{jputRd}xdt{nA9Q$@l1OjN zwPBRPEZM+OjDqt}$}*WW&=}cSj4W?1h_)37eOx+ZRA=B&{?i+b>yYDNWV}UbYk=)Q zP>aH+hvg2lDxPoOodbaFV4spi`Gh}cc6QhgZ_BsdPLKH=`oZCekYCCWnS}93Y+G@} za!L0GzeR8iHDvG>isJs$IH~dIu+43%6sAgXN?`AKa`S4wTD&sOfq!<Oez8ANUPqDY zg>yL+ooa`CK*a5zP0v<5_Vz--GC62C>eyW3Jv6(Yq3-K%NWL6Xy!!|CEm|)Mz%W>E z8o}p}6cv@1RSD1*Et%D)=A1BlM=CzT0YvvVP&fOXK}KZ{D8k`P?nVeeRZiT)*pEM% z=FU_qeKs+p%;7KvQdJQe#e{H?@5!Jesxq)<)e46sH(6w?SKJ)^FkwkxQ^6~{Jy>!L z?-0%cPaPB9Qg7@EGm^=Q4d9)a>IGPIM!an+Kj=s0)XsqsL{vM{mxvH33e!z(xV#6{ z`Ke{~DFS`$k{wC!l};Mz_P4M{A9wg2cg30(J!DExlI6~DOy0jNOTs*m^C+sdVS>|8 zKQbY|-cZxXWaaYAPh&a(6n8nM<Q~jV7H%>C$E#4Ax1dG1^7U`<hJ>kbyP)eNt<$z# zeKqf8_zvmg@OpT5%}K7@-KjUNJ3r7^Rf>FD;loeDy{U_?lNQ`5X<QbN-f@Dz4^)(> zXHyC%i3!D^8iGWLS`tcKhJXqJ60@d+&adg%I-N)y%VpG8B@euw1mA7gj8|K<pv(RP zzr(!V@!@B%_aIaJ0gjCz$_1)gI->2kPH>G~2^m))x1XKx$48W}sSyxP{S^wVRF|HV zSk#xKrLp;$DhJ9vDqaY%EILEM2Ie>ubBPA(l^rv|ENJbGe@9V+j@`0`*N(IrXNb+t z205{qs|n4g|1uYbn6-A<23RGq1$3<Li#1?IZ%?py?1U=8=!}ghoFojpLekGmVv^L? z;9I0*^B<W8o;Jo~+Os(vcn@t746WK=>V8EW-~7xP9?syH(BlAPhezomNa`j4br9Fz z)=~FT)xlItaCuX3-KK2-mJdlf2&(s_-7;NWiW66eC_FeWNyhAkMMLJM8Npo?+Ozl3 zBevk_Vd?ByzGrXwCsVhv6s(Tp+}Ppw3y4LwYlS3-2BbkP8R^(QNOla#O~s?%vbkoe zBg7QnQr#UJByEJVsd2iM+}^v!s~<Pki5#X^j#ewCz0)vEZtY&Pn~tBzj=p%fD;h7u zVz}Wn$~box>Q^P|b?a;Rxpn}(?tsFwEWKETpFp4?3BvCi5gy4)HQYE#UD<JtrVm2l z7*86KP&2s%1`Qu*dto@Bteu@9*C}Rs4Q&m38}p@MGGb$MhmYy{Rofnx)$v+NRHxH# zmZtydEWY5^0qr-x2S7QY+sNl{2){*j_rJ8-{^&15VW08l+uF;rQJi&wpzA)Q`H&r` zcL_D^?nl~clDwsB`1(M}Qm(;z7oBrU)G6><7N|{(C=aHd(2(eQrshhDxlelF8qM>` z?!0>eag8!)0GMz9P1*xxHa$t6>2EWBNqBCD`#9Y24Ad)Tu`6xK*_p{(M;4Dbj0LQy z%O9jFpEv&AJWr7I^R~32?HCc~v6<%wf!D(hX9T6A8GT&3cqG%Ov}t_I^NJRnkCk?) z40aie{3tP3S-krhh($@gBH7JJs$BGY!0`02RLo%7Lxm;5!mS%1%yUC9v`4f>ieE4H z#l!OqX^|s43*g(cuhNd>V;JW(jq>3?_#5Zu!R`cQIIF)&sZ$kIb0@Y*8LZGeMsTds znrK>jN8=W3HoVhJ8%0!N;w!@&QL5YHfg-HJ%tTy__Huju0)K2$Wl{|%)5`w*z1p=m zqk(I6-12zJ=u`GR8QMYSslPAtZ@0EflK#cS$XoUTvUzAD5C{~PM{Op$pD8|ftE~PX z{g+?P+@KCOnx(#?cP%8e!)k;X?=ysdA>^SgL=k26OVx%=wa~L|(d(mYv!{8dcze6j z_h|LI<1^Y<o?RX9oc9=~qD_4`-l$f50?vt6bw@wbFRJejZW_4kU{9-!eQ-}zkSTO- z4?q5eS;7iG<Q@IyV}E?JOaBYA^q;K0(SPN+|6`Kgf2p{t<}TQ#sNN#$BX<MgXC%(? zO45d!NrxD5KW-J8qtav8n-uqkhA3#HDncuimdNvCk((1}<;+%dEzMWifFWa0;`Hp* zx_WoHwqJ&_b22hgj=fBYC6`(lM2{yno~OLBpSO-_nO=uG`93jwe!kQCJEu_IA-?D> z5rl?QRzUbq<^7^<3Nrw4iZW@%LvB%uj&Gr+rJ~GIy%hkFrYABRAUnS$q%D0>;?e0F z*YC*NTZCx#;`B%J6dANYbnJuKuiyJ@rPo1!W(yoV9-N|E*bi?ZPSQpCp{sJ6NZ*CU zkKUycUA-@@e-CT-x2UC~bWalsYqBGg!6Ar<im54aw6HX_BZuxBSePpwH)Za=AL`76 z@ifC4okp;C^sJa@in0874j8WIrog-qd@d<#3=0@~b)qM}O_^R{|7b2QOH$gzeu%<t z?}j`U`z}eI-o7cHQVE~eaD~~eKx5x72c+)18DAAk^uvl6Zz_ydKixyREj26aNu59e zdFYZZqp1-jO4S;|Q=Y-Arf1j3PV%O;fO(#xgosF|5OkfsDGHZ7hB>FWmEw1t)0(NT zZ%ah9P*p#+ogxb4pG<{n=s1{w6yf)5Pnc7k->i4J$D=#<?M$I?U0K?hS7DJ{XmYL1 z$*JUANc5!G=*N2^dUlbO>oy!(LeDbH6emaBR=LFm?bmTzLCYIaUSX9i+(Np3Ech~* zZHTPZ`qMW7@!C0m)ySk|8>=iz9uk3a={c)1BmX_(iy>YbGwBzbB70ITRD;4)n5Re3 zv3feudeh@Wv$Z^3LRkfij>W8`O&Xe0Gm<P9kBEPZ6?L=1+A3nTS%Do>Itv={wt<V` zl9VjgxJc7Rs@2vI6jBy^6GX@Mo7DBpv^8NF%I4Es8Hd%1D4TSGS*bgvsf0_UefSUO zlhOpCjKz9kL+Dras$Sz`H{46fK)!Q*kFUEgzP`l_I}Oh2auXo8ocZOEi0?dqgdyha zlNHO&ThKff+&&cK=C9Kh9W|qHi<9BcG;o~1SX<G+Sa7?({@|=xQR+!ugb+(NKRxC8 zHC;9PU2b_`w};_T2Cj}792$9encork6mAWh`b?IT--Y^RZ<#>BH*eWd&MAov7wPat zRX+eoZInHV$FwzpEE#?ASl&^}UDi!0=un=cDFEG_WE^xJtRnhKeVAkBcPLe5t$F(B zdMxkAZQBM_DexyTjp?KgPItFnTep?d7nJi;%7+2_B3wz#V@$6<-6N=m@0Eb_ma<*2 ztl1m5s--y1ew_AvXWGOBMlS{P^oSw+WJ3-`l?LTUxly?Y@u^I6d#dM}QeckO61;u5 z*oLSY({aV(R;c;E4J-16B^vd3ZXp@#!TXInjaahq0>{!8;$%ZPqW!!dTfeZcQFyZ1 z>`NnKReAcFyh{VoCo(Ecg&r#L7$AT&J50!dWuZCSI$7O<R^@nZTC(dU*s~-ejq6b| z=7#&<8Lf_k9e&8qp3BkqB*I_sr_t!>;2*rs6tQS_bbKP5x$#Btj|uuR!tp8n*%I3T z#I*o#zgxZ75dLNmV{k-117H-Xi89zDKYCfrph%G{*9i8aW)#fi>{Od&bOn&EF~ftt z+7Pq>z)@g8x%{iNrNriHjL8#Tcz|$oqk6D3K2kKbzn0Hlx!8<i`tSJshb+icE8n|p z@)xG2Z!=;3@_!<)1YuqPB6(a<;dfaEZaBrUcB2H};q~)>MjN0IXyEo3x@M3g3*q)7 zf=$>mM3McVz#U|myVoDXx{f+xFGNmwCa95_dZ&z|Bvtyn?%{DPH&dD&SoE3s&_z0x z;~M43AnS-z%h+87s-#;(dqrM5{(uxI-x``q{p*WxUWkEWpcdlud)Nt*NWi7ZdDIrC z_*E;|%V30~wZFY1*p<%<Jk#jCx3s4uJ~7vKN9oQ>OpJEBchiO-F5;>!XwzZz1kddp zLZ#w8zx>=scB@Ztd0c#j?z|9PpBNz*-EK)g4%Ib=AD#i#u%c_fz|}vELP1yJH;%_G zBIz&kcdB@=G(LXklqV+FuusvJHyD%Dgh&vGat^kil{edhO2WkgZP$cFd57ALEfGEm zA{ooH`(!1zw_6z}?LjLUIq8nv7yXTl)rjW5#`YLa&C~01FLasqF-bD~i?@MUFJQU& zSK^=jJ}|QE;-6WsfAZ7xKB+J(n3l$B6d_yYh*tf=XlZKuwE1eZmsuk&H(f!fH*$*- z=8VRBrHYD*9hKoEhI<&FNX$4HtbcL+-fc8Vrj^C=axFkI+|CN6am>_(t&OL%n-LR| zXL0(#i=SzkCh-Z&b)93uyM`NMyhTR&m(~3<4n_DN8BWx=fa0lu|1Wo@HZ_;#WnRA` zFqhUtg=`xdz#g5)lATxmS6KhH?*TGIn9kY;$7<LVWZR956j=3fth1qe-()4}Zw$qa z;8yJPxinL7tqQSn6=zjLjQqO@7}}N)4z@~<GPN|c!IXsknq<)jo0s)p6bSoeBe6}? z)8gz9hYn98@<n3eF!cD9>BRg7*A5X&9B*MBPkOrMH%aA`I`Ybng+8#5_=~W4X{{&s zp|@|-*oP4uBv0IA7toH!!d(J7dy@Ny_DjwVaC~P;D|)N5{HHp?{K9H-kn(a+Nk${B z{~CaG+Xi)9`xa=0zdbJ0|5IlAA7J1gd)GgZAo4rry6_u?XS4cB)X(^@9Ed(@ps{>e z$;(f|5Hm3q2K9j6W_=e0u=dNMOQhZ68_T_L_>>Y5@dZ<#gj*R+J$2&S-1*dXk7=Ic zjqk;++de;1`r?`E$jeg1i2Mzpa9gs94gq1K#1G6!EvdaUQY3boUDqWoRNM3Rt;Ks? z|EIDufroPI<M>d>lu~1>khSb`Z}t=!`zW%eR6~<(n0XDNNTWf@b}bdxZX%T;np@o~ z(jpSKP@+_Hy(&v?mP+^bo{8~rj4|)&GoP_^zP~ePd(Lw_=l4G;fL^t`kw|tiVN}*L z&USsIm7Jk{c%)>R9*x(!@`lVOub%65yrN#sRP#t;S$u}Rid7@pCX|9Mh#q$0D>wVy z`ks^`e)vp6hryw}6~U=;H&Wd3y($#i=Gfb3f0I37m4Co6CP43!Z(x-N`X5osp1tms ze%c3}6kDxdVi;xvDg5Kk=TLkvqlYWfL@LvboWsVW+U`h~6rz383{`x@j1I34O>A9u z(OF!w(7xw%ab7W5$HpM}K%Mf9$YGm+jk=D;r>mTjH9CcgYjXwbLtab1OI>AUy5g{C zP<EL+S(2fy?AM3gen;uP$g=DpcOBb+jj3wGpPx*i$IF%EQIA~w2Yb~!ACk({bG)90 zbX7~HUIl^sVnHyzi+Njd8+yOE-5J5Yd}~r<Q<7xd(#%k4`zY~gjhI6I<L_&Sl+)5j zZTHHq=-iPMGZ?QL!aH=@=iHkHdo|sC(Rpc?5}(w#@rxc!y>+qH{X$!n|DOCvC7Z1h zLb#ijLmCEVe<tV+)Can0+8tPK-@)^|drMlkteoG(iKAxy6}b_=IDgp}rQ+e(VqvKM zpiXgQ;`5^Gk{$yz*Oq&v6GH_9!g1HKZYI5L?iRnhJXtP(T`l>mlBALG`lx+>j-CJM z{h@xv#Js&KqkRhBOy1ko*g1^9E1Qrp(!v^?%anZ^SMoN$#p>Wa#eciXlWFTD1ES($ zH&V4-ltR*P33%k}#G;=mJh;o#As5=>+aU21_EK|k|9@jb19hYPwg}y<lI{MK?5sg9 zbib|9+HP_6bxZlku^ud@Zcl2fp4{^=!JQxD;=e<Og7$>m-xdxYfL#h6fHhz<MgmE` z1kWID41cpzY<AQdi$pi`Eyjj#wYyW$U$Zz<BDhE1K3=szL1Nt0@U)hH?6O6I->qHN zYkcGRSE)zjf>t}WM{V$3mj0`ekRsBM<`vXf`EFyewPD2G@^lO3*a69qCC@P{(GljB zE`En-IER~AWiM9AR!j4{Uk=#yOt;C+#-Op<(;EA!y|FJxLO9WFXBeaS><3EcaP&*( zzo~{Dmbt3xpYxQDABzsC^mB-j_Y4fixsHDJ@(yo#wk?L1;9ELcW8OHntM9o~DYh@8 zuPLcd@fq&(3&k|dQ~tzN!->&}k}9$L;?Dn7wRQCA2?Hg$*v-@qnn$E{Tf&&2xYXs+ z_LD(>AN;Ua#b*3^n-u!hwIU%`r>>7{oU5eb3t#wbl-7!T;3rgjJ92pfS?_rEApy7Y zS9*>cy#}|gS#39hFKYTV!#^#)X~5`sPNONB&!GZCky=_LR?Jg)3KK5)P-{=pn-RD7 z|KV4UFm2h_XU&_LWA-qv&zCnd!%S81{Fg%;N=8@A{_{GzS<i^srr*Har$4t%;ZSrl zZigT{&g_(j)_06WVw&48`d?!_^=&hIp}h@bcQ;x*SxkJVrro=vnbIx4C}7sNZ0oXi ziCVg@CU(^ZAK?;{ySuV}{?z>aQPzz=BLBF>Q^P|%BeNnwjwq79i}r|@D4J&`6WOqN zeY4<!j<3najE8lWc^zKTUAUJkPaZJ{Oxrm`Ib~p~;<{=3-Ah?z$7<|zmv&b2Nf~;( zE&o{nFY~wx^TI-QHNX4d&DOORr$TP%I>?>G@M^Cmc%VrU_17)(9zUH(3Np8iJ<QNg zjtXO3WgK-qqNGeA<M!(kG|Cp+II9VLc61G`FE}|`opun*=a`2w<E2~VN#3=qa}lBT z@L2m__C9*G^!~a{`X&Rup{3UzmkE`&Q0{n-H41sPW)uVn>wT-!F6ng7(=exsw5C*3 z$^`UBU)w+AjcY3CzPctu1(Qyh&@|3*@)ERG>GdpMP7qb49B)w7x`l3AJg7h}x;0XH zOs6_OLo-O7?~z)8VTm_**C=p9U)bW;@Ae%!8vjrG)&fz`lo;@0df-oa--Bn=Is4xK z#g*H=;%p+BqtiVPugD@`558mx$YcUuh-p4BSDQ-0sDU59vNdxwQMcM|u4!j8JDY#` z79(TupPA21fk;WyiB1KNgrKIg*_v#(GB<N@)UY*&3Ct{@fB#6}p}wia6#f-_&2*gQ zlmoc!%*atam1DA2Ic8)wz+_@dy$4^;Ft?owMKA}DuGms^0}RO3V3O5j<p=L{sucJs z8^AUaDTo4G|H-y^p8#;|lIiu&vfqP0mJg5G#dTnXqW~I(8ElP}=u~+i$0dAn(F3Es z?f;D^0K6yQCC}o5cRDozv_2a&7Wgp`N%#Zvl~q~MQ%4W9Ry)|Dne020R63OmIu9ox zmT(XsOblWPfD4jWAb~=`fk@?q09GIbxctr6&|AboC&2;9O|!}`0Gx9<$pL<7m`QMu zH*k#h@kHEDV1*sox$ABN7DgI{lAWbM7UrnHzQV((xPp9uX#g*#oi!_g`T?V!LxH)g z4_W>2B@A%#i?(d?zypHcFT)lO%(98W6yOD8?n5M)czS{wx5WqGz2>X%<bIl37^v_V zP~o%tqSpqt0v3UI5C+u=xJz1+{0TS`$uF49zG^Z&b##kCClL}up;TA}2k&&MD)^R7 z)l8zNf~_&f5qs{}Zi(ItfYS+Ha<jN=K$l^|wPN)__B?%}NVhW>9Wh`BayD<VHhW$G zB?wO>&NpQEt}Go42UWTnwA<_|%>>Wwvn$^e4><WSxu)I(Pe1lWt@tKfMhCO6G2qI~ z`sjFLPH6VDkJScaBv8;zU@iikbvn_hrcP{WIFi@A9f=gMdL@Ggh1w6MFuiFMv$cm@ z*uv~U;1?4Lh2ZZ2qUtK(NS=5i7R(KSJ|4k{**iRXrL5b##lTdw8;oG)ZZRv-sS~>v zR$*TaG$<A@!gRv3Wx~s`S&@O^62p--5jx=@Tl!T02Maqm&L)h8BNrm*{XU$~v*Q@T zR5)l4Lj65(dKtqhgbxg40zfbOk(g@*R-#kaQsw~XU&(O7GGq2kCgwH%0Km=|X3S%O zaAr7y4=X#JnmRW#D~QVc%WfDCM`c0q(jjxo#=>)R%LWU<(G(D&=EHM@W|V)P*a|Qn z4hw+b3E`aZ&|L|Ph28KG?7aw1*qPfsFcbDhMwm-!oR~lMl;&Nk!8XJQb&MP8{HDZk z@nIuXL@4_N7sa1zs|pLiwv~uL@+mF^IG9+%O0bI^qVyq&3ni{R?O;vVhz!xpO5sA2 zlPwu61)H)UQWF_mNO7=eft6tY3q<K_78gpBqs4@+8wM-|y9^*w-*dT^0`m)V`kpo( zghk+^+la`DLas$7$LkDZ8(0NCBaEmlJIA%k<f%#a>jn5ACL*xp{QoJiP>sQd;1H>C zumXmzaWkg(sYz|Yx`GcxA$*%sF8G{}N5KsPpCLiSqRSQ*W8W6=(*p?eRqY(+kLsBF zECF0j_>T|>v%g_sCZ}r@ymgC^g`4J*x!=fzKLNa*i0Hg+o}&Y=W@mJx1uo<878fG( z+vDkl-FzEfaG9BzS*t|m?iMT2se)iLW5(_odEUJ)I~zW5%Y{PefPe47&D?g75rz66 D613UA literal 0 HcmV?d00001 diff --git a/samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..94920145f34e --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/jersey2-experimental/gradlew b/samples/client/petstore/java/jersey2-experimental/gradlew new file mode 100644 index 000000000000..2fe81a7d95e4 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/jersey2-experimental/gradlew.bat b/samples/client/petstore/java/jersey2-experimental/gradlew.bat new file mode 100644 index 000000000000..9618d8d9607c --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/gradlew.bat @@ -0,0 +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 diff --git a/samples/client/petstore/java/jersey2-experimental/pom.xml b/samples/client/petstore/java/jersey2-experimental/pom.xml new file mode 100644 index 000000000000..3affc56f001f --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/pom.xml @@ -0,0 +1,293 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openapitools</groupId> + <artifactId>petstore-jersey2-exp</artifactId> + <packaging>jar</packaging> + <name>petstore-jersey2-exp</name> + <version>1.0.0</version> + <url>https://github.com/openapitools/openapi-generator</url> + <description>OpenAPI Java</description> + <scm> + <connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection> + <developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection> + <url>https://github.com/openapitools/openapi-generator</url> + </scm> + + <licenses> + <license> + <name>Unlicense</name> + <url>https://www.apache.org/licenses/LICENSE-2.0.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <developers> + <developer> + <name>OpenAPI-Generator Contributors</name> + <email>team@openapitools.org</email> + <organization>OpenAPITools.org</organization> + <organizationUrl>http://openapitools.org</organizationUrl> + </developer> + </developers> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <version>3.0.0-M1</version> + <executions> + <execution> + <id>enforce-maven</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireMavenVersion> + <version>2.2.0</version> + </requireMavenVersion> + </rules> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.12</version> + <configuration> + <systemProperties> + <property> + <name>loggerPath</name> + <value>conf/log4j.properties</value> + </property> + </systemProperties> + <argLine>-Xms512m -Xmx1500m</argLine> + <parallel>methods</parallel> + <forkMode>pertest</forkMode> + </configuration> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <!-- attach test jar --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <goals> + <goal>jar</goal> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + <configuration> + </configuration> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.10</version> + <executions> + <execution> + <id>add_sources</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/main/java</source> + </sources> + </configuration> + </execution> + <execution> + <id>add_test_sources</id> + <phase>generate-test-sources</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>src/test/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.6.1</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.1.1</version> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + <configuration> + <doclint>none</doclint> + <tags> + <tag> + <name>http.response.details</name> + <placement>a</placement> + <head>Http Response Details:</head> + </tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>2.2.1</version> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>sign-artifacts</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-gpg-plugin</artifactId> + <version>1.5</version> + <executions> + <execution> + <id>sign-artifacts</id> + <phase>verify</phase> + <goals> + <goal>sign</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger-annotations-version}</version> + </dependency> + + <!-- @Nullable annotation --> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>3.0.2</version> + </dependency> + + <!-- HTTP client: jersey-client --> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey-version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + <version>${jersey-version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-multipart</artifactId> + <version>${jersey-version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-json-jackson</artifactId> + <version>${jersey-version}</version> + </dependency> + + <!-- JSON processing: jackson --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson-databind-version}</version> + </dependency> + <dependency> + <groupId>org.openapitools</groupId> + <artifactId>jackson-databind-nullable</artifactId> + <version>${jackson-databind-nullable-version}</version> + </dependency> + <dependency> + <groupId>com.github.joschi.jackson</groupId> + <artifactId>jackson-datatype-threetenbp</artifactId> + <version>${threetenbp-version}</version> + </dependency> + <!-- Base64 encoding that works in both JVM and Android --> + <dependency> + <groupId>com.brsanthu</groupId> + <artifactId>migbase64</artifactId> + <version>2.2</version> + </dependency> + <!-- test dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit-version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <swagger-annotations-version>1.6.1</swagger-annotations-version> + <jersey-version>2.30.1</jersey-version> + <jackson-version>2.10.3</jackson-version> + <jackson-databind-version>2.10.3</jackson-databind-version> + <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> + <threetenbp-version>2.9.10</threetenbp-version> + <junit-version>4.13</junit-version> + </properties> +</project> diff --git a/samples/client/petstore/java/jersey2-experimental/settings.gradle b/samples/client/petstore/java/jersey2-experimental/settings.gradle new file mode 100644 index 000000000000..03db425dc2b1 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-jersey2-exp" \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/AndroidManifest.xml b/samples/client/petstore/java/jersey2-experimental/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ +<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android"> + <application /> +</manifest> diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..30609a4a8e40 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,995 @@ +package org.openapitools.client; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.glassfish.jersey.client.ClientConfig; +import org.glassfish.jersey.client.ClientProperties; +import org.glassfish.jersey.client.HttpUrlConnectorProvider; +import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.MultiPart; +import org.glassfish.jersey.media.multipart.MultiPartFeature; + +import java.io.IOException; +import java.io.InputStream; + +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +import java.util.TimeZone; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.openapitools.client.auth.Authentication; +import org.openapitools.client.auth.HttpBasicAuth; +import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.model.AbstractOpenApiSchema; + +import org.openapitools.client.auth.OAuth; + + +public class ApiClient { + protected Map<String, String> defaultHeaderMap = new HashMap<String, String>(); + protected Map<String, String> defaultCookieMap = new HashMap<String, String>(); + protected String basePath = "http://petstore.swagger.io:80/v2"; + protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io:80/v2", + "No description provided", + new HashMap<String, ServerVariable>() + ) + )); + protected Integer serverIndex = 0; + protected Map<String, String> serverVariables = null; + protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{ + }}; + protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>(); + protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>(); + protected boolean debugging = false; + protected int connectionTimeout = 0; + private int readTimeout = 0; + + protected Client httpClient; + protected JSON json; + protected String tempFolderPath = null; + + protected Map<String, Authentication> authentications; + protected Map<String, String> authenticationLookup; + + protected DateFormat dateFormat; + + public ApiClient() { + json = new JSON(); + httpClient = buildHttpClient(debugging); + + this.dateFormat = new RFC3339DateFormat(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<String, Authentication>(); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + + // Setup authentication lookup (key: authentication alias, value: authentication name) + authenticationLookup = new HashMap<String, String>(); + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * @return JSON + */ + public JSON getJSON() { + return json; + } + + public Client getHttpClient() { + return httpClient; + } + + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + public List<ServerConfiguration> getServers() { + return servers; + } + + public ApiClient setServers(List<ServerConfiguration> servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map<String, String> getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map<String, String> serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map of authentication object + */ + public Map<String, Authentication> getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure authentications which respects aliases of API keys. + * + * @param secrets Hash map from authentication name to its secret. + */ + public void configureApiKeys(HashMap<String, String> secrets) { + for (Map.Entry<String, Authentication> authEntry : authentications.entrySet()) { + Authentication auth = authEntry.getValue(); + if (auth instanceof ApiKeyAuth) { + String name = authEntry.getKey(); + // respect x-auth-id-alias property + name = authenticationLookup.getOrDefault(name, name); + if (secrets.containsKey(name)) { + ((ApiKeyAuth) auth).setApiKey(secrets.get(name)); + } + } + } + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set bearer token for the first Bearer authentication. + * @param bearerToken Bearer token + */ + public void setBearerToken(String bearerToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBearerAuth) { + ((HttpBearerAuth) auth).setBearerToken(bearerToken); + return; + } + } + throw new RuntimeException("No Bearer authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent Http user agent + * @return API client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return API client + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return API client + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return True if debugging is switched on + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return API client + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(debugging); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is <code>null</code>, i.e. using + * the system's default tempopary folder. + * + * @return Temp folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Connect timeout (in milliseconds). + * @return Connection timeout + */ + public int getConnectTimeout() { + return connectionTimeout; + } + + /** + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + httpClient.property(ClientProperties.CONNECT_TIMEOUT, connectionTimeout); + return this; + } + + /** + * read timeout (in milliseconds). + * @return Read timeout + */ + public int getReadTimeout() { + return readTimeout; + } + + /** + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * @param readTimeout Read timeout in milliseconds + * @return API client + */ + public ApiClient setReadTimeout(int readTimeout) { + this.readTimeout = readTimeout; + httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return Date format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * @param str String + * @return Date + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * @param date Date + * @return Date in string format + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param Object + * @return Object in string format + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(','); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ + public List<Pair> parameterToPairs(String collectionFormat, String name, Object value){ + List<Pair> params = new ArrayList<Pair>(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(new Pair(name, parameterToString(value))); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + + // create the params based on the collection format + if ("multi".equals(format)) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if ("csv".equals(format)) { + delimiter = ","; + } else if ("ssv".equals(format)) { + delimiter = " "; + } else if ("tsv".equals(format)) { + delimiter = "\t"; + } else if ("pipes".equals(format)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME + * @return True if the MIME type is JSON + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * 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) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception + */ + public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) throws ApiException { + Entity<?> entity; + if (contentType.startsWith("multipart/form-data")) { + MultiPart multiPart = new MultiPart(); + for (Entry<String, Object> param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + } else { + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + } + } + entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry<String, Object> param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + entity = Entity.entity(obj == null ? Entity.text("") : obj, contentType); + } + return entity; + } + + public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ + + Object result = null; + int matchCounter = 0; + ArrayList<String> matchSchemas = new ArrayList<>(); + + for (Map.Entry<String, GenericType> entry : schema.getSchemas().entrySet()) { + String schemaName = entry.getKey(); + GenericType schemaType = entry.getValue(); + + if (schemaType instanceof GenericType) { // model + try { + Object deserializedObject = deserialize(response, schemaType); + if (deserializedObject != null) { + result = deserializedObject; + matchCounter++; + + if ("anyOf".equals(schema.getSchemaType())) { + break; + } else if ("oneOf".equals(schema.getSchemaType())) { + matchSchemas.add(schemaName); + } else { + throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); + } + } else { + // failed to deserialize the response in the schema provided, proceed to the next one if any + } + } catch (Exception ex) { + // failed to deserialize, do nothing and try next one (schema) + } + } else {// unknown type + throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); + } + + } + + if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf + throw new ApiException("Response body is invalid as it matches more than one schema (" + String.join(", ", matchSchemas) + ") defined in the oneOf model: " + schema.getClass().getName()); + } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas + throw new ApiException("Response body is invalid as it doens't match any schemas (" + String.join(", ", schema.getSchemas().keySet()) + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + } else { // only one matched + schema.setActualInstance(result); + return schema; + } + + } + + + + /** + * Deserialize response body to Java object according to the Content-Type. + * @param <T> Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception + */ + @SuppressWarnings("unchecked") + public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.getRawType() == File.class) { + // Handle file downloading. + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List<Object> contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + + // read the entity stream multiple times + response.bufferEntity(); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf('.'); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param <T> Type + * @param operation The qualified name of the operation + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @param schema An instance of the response that uses oneOf/anyOf + * @return The response body in type of string + * @throws ApiException API exception + */ + public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + // Not using `.target(targetURL).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + String targetURL; + if (serverIndex != null) { + Integer index; + List<ServerConfiguration> serverConfigurations; + Map<String, String> variables; + + if (operationServers.containsKey(operation)) { + index = operationServerIndex.getOrDefault(operation, serverIndex); + variables = operationServerVariables.getOrDefault(operation, serverVariables); + serverConfigurations = operationServers.get(operation); + } else { + index = serverIndex; + variables = serverVariables; + serverConfigurations = servers; + } + if (index < 0 || index >= serverConfigurations.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size() + )); + } + targetURL = serverConfigurations.get(index).URL(variables) + path; + } else { + targetURL = this.basePath + path; + } + WebTarget target = httpClient.target(targetURL); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), escapeString(queryParam.getValue())); + } + } + } + + Invocation.Builder invocationBuilder = target.request().accept(accept); + + for (Entry<String, String> entry : headerParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(entry.getKey(), value); + } + } + + for (Entry<String, String> entry : cookieParams.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry<String, String> entry : defaultCookieMap.entrySet()) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(entry.getKey(), value); + } + } + + for (Entry<String, String> entry : defaultHeaderMap.entrySet()) { + String key = entry.getKey(); + if (!headerParams.containsKey(key)) { + String value = entry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(key, value); + } + } + } + + Entity<?> entity = serialize(body, formParams, contentType); + + Response response = null; + + try { + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else if ("HEAD".equals(method)) { + response = invocationBuilder.head(); + } else if ("OPTIONS".equals(method)) { + response = invocationBuilder.options(); + } else if ("TRACE".equals(method)) { + response = invocationBuilder.trace(); + } else { + throw new ApiException(500, "unknown method type " + method); + } + + int statusCode = response.getStatusInfo().getStatusCode(); + Map<String, List<String>> responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return new ApiResponse<>(statusCode, responseHeaders); + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { + if (returnType == null) + return new ApiResponse<>(statusCode, responseHeaders); + else + if (schema == null) { + return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + } else { // oneOf/anyOf + return new ApiResponse<>(statusCode, responseHeaders, (T)deserializeSchemas(response, schema)); + } + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } finally { + try { + response.close(); + } catch (Exception e) { + // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue + } + } + } + + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ + @Deprecated + public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema); + } + + /** + * Build the Client used to make HTTP requests. + * @param debugging Debug setting + * @return Client + */ + protected Client buildHttpClient(boolean debugging) { + final ClientConfig clientConfig = new ClientConfig(); + clientConfig.register(MultiPartFeature.class); + clientConfig.register(json); + clientConfig.register(JacksonFeature.class); + clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); + // turn off compliance validation to be able to send payloads with DELETE calls + clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); + if (debugging) { + 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); + } else { + // suppress warnings for payloads with DELETE calls: + java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + } + performAdditionalClientConfiguration(clientConfig); + return ClientBuilder.newClient(clientConfig); + } + + protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { + // No-op extension point + } + + protected Map<String, List<String>> buildResponseHeaders(Response response) { + Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>(); + for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) { + List<Object> values = entry.getValue(); + List<String> headers = new ArrayList<String>(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..6c91e35f27a9 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.Map; +import java.util.List; + + +public class ApiException extends Exception { + private int code = 0; + private Map<String, List<String>> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map<String, List<String>> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java new file mode 100644 index 000000000000..4a3226d1dbb5 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param <T> The type of data that is deserialized from response body + */ +public class ApiResponse<T> { + private final int statusCode; + private final Map<String, List<String>> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map<String, List<String>> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..acbecda489dd --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,39 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java new file mode 100644 index 000000000000..83d4514b071b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer<T extends Temporal> + extends ThreeTenDateTimeDeserializerBase<T> { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function<TemporalAccessor, Instant>() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, Instant>() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function<FromDecimalArguments, Instant>() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function<TemporalAccessor, OffsetDateTime>() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, OffsetDateTime>() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function<FromDecimalArguments, OffsetDateTime>() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function<TemporalAccessor, ZonedDateTime>() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, ZonedDateTime>() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function<FromDecimalArguments, ZonedDateTime>() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function<FromIntegerArguments, T> fromMilliseconds; + + protected final Function<FromDecimalArguments, T> fromNanoseconds; + + protected final Function<TemporalAccessor, T> parsedToValue; + + protected final BiFunction<T, ZoneId, T> adjust; + + protected CustomInstantDeserializer(Class<T> supportedType, + DateTimeFormatter parser, + Function<TemporalAccessor, T> parsedToValue, + Function<FromIntegerArguments, T> fromMilliseconds, + Function<FromDecimalArguments, T> fromNanoseconds, + BiFunction<T, ZoneId, T> adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer<T> base, DateTimeFormatter f) { + super((Class<T>) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer<T>(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java new file mode 100644 index 000000000000..6517dc877a39 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java @@ -0,0 +1,47 @@ +package org.openapitools.client; + +import org.threeten.bp.*; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; + +import java.text.DateFormat; + +import javax.ws.rs.ext.ContextResolver; + + +public class JSON implements ContextResolver<ObjectMapper> { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + mapper.registerModule(module); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class<?> type) { + return mapper; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..ae89aa614543 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 000000000000..9509fd089812 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..a1107a8690e4 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map<String, ServerVariable> variables; + + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map<String, String> variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..c2f13e216662 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,23 @@ +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet<String> enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 000000000000..266c26be3a50 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + * <p> + * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + * </p> + * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..e06e72ecac6a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,104 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class AnotherFakeApi { + private ApiClient apiClient; + + public AnotherFakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public Client call123testSpecialTags(Client body) throws ApiException { + return call123testSpecialTagsWithHttpInfo(body).getData(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags"); + } + + // create path and map variables + String localVarPath = "/another-fake/dummy"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<Client> localVarReturnType = new GenericType<Client>() {}; + + return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..d077830e35f1 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,1198 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +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 java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeApi { + private ApiClient apiClient; + + public FakeApi() { + this(Configuration.getDefaultApiClient()); + } + + public FakeApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void createXmlItem(XmlItem xmlItem) throws ApiException { + createXmlItemWithHttpInfo(xmlItem); + } + + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { + Object localVarPostBody = xmlItem; + + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) { + throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem"); + } + + // create path and map variables + String localVarPath = "/fake/create_xml_item"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> + </table> + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> + </table> + */ + public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> + </table> + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> + </table> + */ + public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output number </td><td> - </td></tr> + </table> + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + return fakeOuterNumberSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output number </td><td> - </td></tr> + </table> + */ + public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output string </td><td> - </td></tr> + </table> + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + return fakeOuterStringSerializeWithHttpInfo(body).getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output string </td><td> - </td></tr> + </table> + */ + public ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<String> localVarReturnType = new GenericType<String>() {}; + + return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> + */ + public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(body); + } + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-file-schema"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * + * + * @param query (required) + * @param body (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> + */ + public void testBodyWithQueryParams(String query, User body) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, body); + } + + /** + * + * + * @param query (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'query' is set + if (query == null) { + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + } + + // create path and map variables + String localVarPath = "/fake/body-with-query-params"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public Client testClientModel(Client body) throws ApiException { + return testClientModelWithHttpInfo(body).getData(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Client> testClientModelWithHttpInfo(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<Client> localVarReturnType = new GenericType<Client>() {}; + + return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'number' is set + if (number == null) { + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + } + + // verify the required parameter '_double' is set + if (_double == null) { + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + } + + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + } + + // verify the required parameter '_byte' is set + if (_byte == null) { + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (patternWithoutDelimiter != null) + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); +if (paramCallback != null) + localVarFormParams.put("callback", paramCallback); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "http_basic_test" }; + + return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> + <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + </table> + */ + public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { + testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> + <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); + + if (enumHeaderStringArray != null) + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); +if (enumHeaderString != null) + localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + + + if (enumFormStringArray != null) + localVarFormParams.put("enum_form_string_array", enumFormStringArray); +if (enumFormString != null) + localVarFormParams.put("enum_form_string", enumFormString); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + +private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + } + + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + } + + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + } + + // create path and map variables + String localVarPath = "/fake"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); + + if (requiredBooleanGroup != null) + localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); +if (booleanGroup != null) + localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + + public class APItestGroupParametersRequest { + private Integer requiredStringGroup; + private Boolean requiredBooleanGroup; + private Long requiredInt64Group; + private Integer stringGroup; + private Boolean booleanGroup; + private Long int64Group; + + private APItestGroupParametersRequest() { + } + + + /** + * Set requiredStringGroup + * @param requiredStringGroup Required String in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredStringGroup(Integer requiredStringGroup) { + this.requiredStringGroup = requiredStringGroup; + return this; + } + + + /** + * Set requiredBooleanGroup + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredBooleanGroup(Boolean requiredBooleanGroup) { + this.requiredBooleanGroup = requiredBooleanGroup; + return this; + } + + + /** + * Set requiredInt64Group + * @param requiredInt64Group Required Integer in group parameters (required) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) { + this.requiredInt64Group = requiredInt64Group; + return this; + } + + + /** + * Set stringGroup + * @param stringGroup String in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest stringGroup(Integer stringGroup) { + this.stringGroup = stringGroup; + return this; + } + + + /** + * Set booleanGroup + * @param booleanGroup Boolean in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { + this.booleanGroup = booleanGroup; + return this; + } + + + /** + * Set int64Group + * @param int64Group Integer in group parameters (optional) + * @return APItestGroupParametersRequest + */ + public APItestGroupParametersRequest int64Group(Long int64Group) { + this.int64Group = int64Group; + return this; + } + + + /** + * Execute testGroupParameters request + + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> + </table> + + */ + + public void execute() throws ApiException { + this.executeWithHttpInfo().getData(); + } + + /** + * Execute testGroupParameters request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> + </table> + + */ + + public ApiResponse<Void> executeWithHttpInfo() throws ApiException { + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @return testGroupParametersRequest + * @throws ApiException if fails to make API call + + + */ + + public APItestGroupParametersRequest testGroupParameters() throws ApiException { + return new APItestGroupParametersRequest(); + } + /** + * test inline additionalProperties + * + * @param param request body (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void testInlineAdditionalProperties(Map<String, String> param) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(param); + } + + /** + * test inline additionalProperties + * + * @param param request body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> param) throws ApiException { + Object localVarPostBody = param; + + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties"); + } + + // create path and map variables + String localVarPath = "/fake/inline-additionalProperties"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void testJsonFormData(String param, String param2) throws ApiException { + testJsonFormDataWithHttpInfo(param, param2); + } + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'param' is set + if (param == null) { + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) { + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + } + + // create path and map variables + String localVarPath = "/fake/jsonFormData"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + if (param != null) + localVarFormParams.put("param", param); +if (param2 != null) + localVarFormParams.put("param2", param2); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> + */ + public void testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { + testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + } + + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'pipe' is set + if (pipe == null) { + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) { + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) { + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) { + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + } + + // create path and map variables + String localVarPath = "/fake/test-query-paramters"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "pipe", pipe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); + localVarQueryParams.addAll(apiClient.parameterToPairs("space", "http", http)); + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..c7c0dcafc019 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,104 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public Client testClassname(Client body) throws ApiException { + return testClassnameWithHttpInfo(body).getData(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Client> testClassnameWithHttpInfo(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key_query" }; + + GenericType<Client> localVarReturnType = new GenericType<Client>() {}; + + return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..01476de66bb7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,692 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class PetApi { + private ApiClient apiClient; + + public PetApi() { + this(Configuration.getDefaultApiClient()); + } + + public PetApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> + */ + public void addPet(Pet body) throws ApiException { + addPetWithHttpInfo(body); + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> + </table> + */ + public void deletePet(Long petId, String apiKey) throws ApiException { + deletePetWithHttpInfo(petId, apiKey); + } + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * 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 (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> + </table> + */ + public List<Pet> findPetsByStatus(List<String> status) throws ApiException { + return findPetsByStatusWithHttpInfo(status).getData(); + } + + /** + * 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 (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> + </table> + */ + public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + // create path and map variables + String localVarPath = "/pet/findByStatus"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; + + return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> + </table> + * @deprecated + */ + @Deprecated + public List<Pet> findPetsByTags(List<String> tags) throws ApiException { + return findPetsByTagsWithHttpInfo(tags).getData(); + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return ApiResponse<List<Pet>> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> + </table> + * @deprecated + */ + @Deprecated + public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + // create path and map variables + String localVarPath = "/pet/findByTags"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; + + return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + </table> + */ + public Pet getPetById(Long petId) throws ApiException { + return getPetByIdWithHttpInfo(petId).getData(); + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return ApiResponse<Pet> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType<Pet> localVarReturnType = new GenericType<Pet>() {}; + + return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> + </table> + */ + public void updatePet(Pet body) throws ApiException { + updatePetWithHttpInfo(body); + } + + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + } + + // create path and map variables + String localVarPath = "/pet"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> + */ + public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + updatePetWithFormWithHttpInfo(petId, name, status); + } + + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + if (name != null) + localVarFormParams.put("name", name); +if (status != null) + localVarFormParams.put("status", status); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); + } + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + } + + // create path and map variables + String localVarPath = "/pet/{petId}/uploadImage" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (file != null) + localVarFormParams.put("file", file); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; + + return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); + } + + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ApiResponse<ModelApiResponse> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + } + + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + } + + // create path and map variables + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + if (additionalMetadata != null) + localVarFormParams.put("additionalMetadata", additionalMetadata); +if (requiredFile != null) + localVarFormParams.put("requiredFile", requiredFile); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; + + return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..11496944ef28 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,305 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class StoreApi { + private ApiClient apiClient; + + public StoreApi() { + this(Configuration.getDefaultApiClient()); + } + + public StoreApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * 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 (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> + */ + public void deleteOrder(String orderId) throws ApiException { + 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 + * @param orderId ID of the order that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public Map<String, Integer> getInventory() throws ApiException { + return getInventoryWithHttpInfo().getData(); + } + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/store/inventory"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {}; + + return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * 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 (required) + * @return Order + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> + */ + public Order getOrderById(Long orderId) throws ApiException { + return getOrderByIdWithHttpInfo(orderId).getData(); + } + + /** + * 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 (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + // create path and map variables + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<Order> localVarReturnType = new GenericType<Order>() {}; + + return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> + </table> + */ + public Order placeOrder(Order body) throws ApiException { + return placeOrderWithHttpInfo(body).getData(); + } + + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return ApiResponse<Order> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> + </table> + */ + public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + } + + // create path and map variables + String localVarPath = "/store/order"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<Order> localVarReturnType = new GenericType<Order>() {}; + + return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..1f9d6afe1169 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,577 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class UserApi { + private ApiClient apiClient; + + public UserApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void createUser(User body) throws ApiException { + createUserWithHttpInfo(body); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + } + + // create path and map variables + String localVarPath = "/user"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void createUsersWithArrayInput(List<User> body) throws ApiException { + createUsersWithArrayInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithArray"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void createUsersWithListInput(List<User> body) throws ApiException { + createUsersWithListInputWithHttpInfo(body); + } + + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + } + + // create path and map variables + String localVarPath = "/user/createWithList"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public void deleteUser(String username) throws ApiException { + deleteUserWithHttpInfo(username); + } + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public User getUserByName(String username) throws ApiException { + return getUserByNameWithHttpInfo(username).getData(); + } + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return ApiResponse<User> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<User> localVarReturnType = new GenericType<User>() {}; + + return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> + <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> + </table> + */ + public String loginUser(String username, String password) throws ApiException { + return loginUserWithHttpInfo(username, password).getData(); + } + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return ApiResponse<String> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> + <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> + </table> + */ + public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + } + + // create path and map variables + String localVarPath = "/user/login"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType<String> localVarReturnType = new GenericType<String>() {}; + + return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public void logoutUser() throws ApiException { + logoutUserWithHttpInfo(); + } + + /** + * Logs out current logged in user session + * + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/user/logout"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public void updateUser(String username, User body) throws ApiException { + updateUserWithHttpInfo(username, body); + } + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> + */ + public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + } + + // create path and map variables + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 000000000000..a9427105d811 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,77 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; + +import java.util.Map; +import java.util.List; + + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 000000000000..5c558b1d5abd --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,30 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams); +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 000000000000..98993417bee7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,58 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; + +import com.migcomponents.migbase64.Base64; + +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + try { + headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java new file mode 100644 index 000000000000..e20259cb94ca --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; + +import java.util.Map; +import java.util.List; + + +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 000000000000..779680c9b2f9 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,39 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +import org.openapitools.client.Pair; + +import java.util.Map; +import java.util.List; + + +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 000000000000..b2d11ff0c4f0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java new file mode 100644 index 000000000000..28cf630a27a5 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -0,0 +1,41 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.openapitools.client.ApiException; +import java.lang.reflect.Type; +import java.util.Map; +import javax.ws.rs.core.GenericType; + + +public abstract class AbstractOpenApiSchema { + + private Object instance; + + public final String schemaType; + + public AbstractOpenApiSchema(String schemaType) { + this.schemaType = schemaType; + } + + public abstract Map<String, GenericType> getSchemas(); + + public Object getActualInstance() {return instance;} + + public void setActualInstance(Object instance) {this.instance = instance;} + + public String getSchemaType() { + return schemaType; + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java new file mode 100644 index 000000000000..0f1223c2bc61 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesAnyType + */ +@JsonPropertyOrder({ + AdditionalPropertiesAnyType.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesAnyType extends HashMap<String, Object> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesAnyType name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; + return Objects.equals(this.name, additionalPropertiesAnyType.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesAnyType {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java new file mode 100644 index 000000000000..c03535ab9471 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesArray + */ +@JsonPropertyOrder({ + AdditionalPropertiesArray.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesArray extends HashMap<String, List> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesArray name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; + return Objects.equals(this.name, additionalPropertiesArray.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesArray {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java new file mode 100644 index 000000000000..4356a4f8c1eb --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesBoolean + */ +@JsonPropertyOrder({ + AdditionalPropertiesBoolean.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesBoolean name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; + return Objects.equals(this.name, additionalPropertiesBoolean.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesBoolean {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..781d4686e981 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,480 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 +}) + +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_STRING = "map_string"; + private Map<String, String> mapString = null; + + public static final String JSON_PROPERTY_MAP_NUMBER = "map_number"; + private Map<String, BigDecimal> mapNumber = null; + + public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer"; + private Map<String, Integer> mapInteger = null; + + public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean"; + private Map<String, Boolean> mapBoolean = null; + + public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer"; + private Map<String, List<Integer>> mapArrayInteger = null; + + public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + private Map<String, List<Object>> mapArrayAnytype = null; + + public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string"; + private Map<String, Map<String, String>> mapMapString = null; + + public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype"; + private Map<String, Map<String, Object>> mapMapAnytype = null; + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + private Object anytype1; + + public static final String JSON_PROPERTY_ANYTYPE2 = "anytype_2"; + private Object anytype2; + + public static final String JSON_PROPERTY_ANYTYPE3 = "anytype_3"; + private Object anytype3; + + + public AdditionalPropertiesClass mapString(Map<String, String> mapString) { + + this.mapString = mapString; + return this; + } + + public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { + if (this.mapString == null) { + this.mapString = new HashMap<String, String>(); + } + this.mapString.put(key, mapStringItem); + return this; + } + + /** + * Get mapString + * @return mapString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, String> getMapString() { + return mapString; + } + + + public void setMapString(Map<String, String> mapString) { + this.mapString = mapString; + } + + + public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) { + + this.mapNumber = mapNumber; + return this; + } + + public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { + if (this.mapNumber == null) { + this.mapNumber = new HashMap<String, BigDecimal>(); + } + this.mapNumber.put(key, mapNumberItem); + return this; + } + + /** + * Get mapNumber + * @return mapNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, BigDecimal> getMapNumber() { + return mapNumber; + } + + + public void setMapNumber(Map<String, BigDecimal> mapNumber) { + this.mapNumber = mapNumber; + } + + + public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) { + + this.mapInteger = mapInteger; + return this; + } + + public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { + if (this.mapInteger == null) { + this.mapInteger = new HashMap<String, Integer>(); + } + this.mapInteger.put(key, mapIntegerItem); + return this; + } + + /** + * Get mapInteger + * @return mapInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Integer> getMapInteger() { + return mapInteger; + } + + + public void setMapInteger(Map<String, Integer> mapInteger) { + this.mapInteger = mapInteger; + } + + + public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) { + + this.mapBoolean = mapBoolean; + return this; + } + + public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { + if (this.mapBoolean == null) { + this.mapBoolean = new HashMap<String, Boolean>(); + } + this.mapBoolean.put(key, mapBooleanItem); + return this; + } + + /** + * Get mapBoolean + * @return mapBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Boolean> getMapBoolean() { + return mapBoolean; + } + + + public void setMapBoolean(Map<String, Boolean> mapBoolean) { + this.mapBoolean = mapBoolean; + } + + + public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) { + + this.mapArrayInteger = mapArrayInteger; + return this; + } + + public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) { + if (this.mapArrayInteger == null) { + this.mapArrayInteger = new HashMap<String, List<Integer>>(); + } + this.mapArrayInteger.put(key, mapArrayIntegerItem); + return this; + } + + /** + * Get mapArrayInteger + * @return mapArrayInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, List<Integer>> getMapArrayInteger() { + return mapArrayInteger; + } + + + public void setMapArrayInteger(Map<String, List<Integer>> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + } + + + public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) { + + this.mapArrayAnytype = mapArrayAnytype; + return this; + } + + public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) { + if (this.mapArrayAnytype == null) { + this.mapArrayAnytype = new HashMap<String, List<Object>>(); + } + this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + return this; + } + + /** + * Get mapArrayAnytype + * @return mapArrayAnytype + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, List<Object>> getMapArrayAnytype() { + return mapArrayAnytype; + } + + + public void setMapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + } + + + public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) { + + this.mapMapString = mapMapString; + return this; + } + + public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) { + if (this.mapMapString == null) { + this.mapMapString = new HashMap<String, Map<String, String>>(); + } + this.mapMapString.put(key, mapMapStringItem); + return this; + } + + /** + * Get mapMapString + * @return mapMapString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Map<String, String>> getMapMapString() { + return mapMapString; + } + + + public void setMapMapString(Map<String, Map<String, String>> mapMapString) { + this.mapMapString = mapMapString; + } + + + public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) { + + this.mapMapAnytype = mapMapAnytype; + return this; + } + + public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) { + if (this.mapMapAnytype == null) { + this.mapMapAnytype = new HashMap<String, Map<String, Object>>(); + } + this.mapMapAnytype.put(key, mapMapAnytypeItem); + return this; + } + + /** + * Get mapMapAnytype + * @return mapMapAnytype + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Map<String, Object>> getMapMapAnytype() { + return mapMapAnytype; + } + + + public void setMapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + } + + + public AdditionalPropertiesClass anytype1(Object anytype1) { + + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype1() { + return anytype1; + } + + + public void setAnytype1(Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass anytype2(Object anytype2) { + + this.anytype2 = anytype2; + return this; + } + + /** + * Get anytype2 + * @return anytype2 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype2() { + return anytype2; + } + + + public void setAnytype2(Object anytype2) { + this.anytype2 = anytype2; + } + + + public AdditionalPropertiesClass anytype3(Object anytype3) { + + this.anytype3 = anytype3; + return this; + } + + /** + * Get anytype3 + * @return anytype3 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE3) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype3() { + return anytype3; + } + + + public void setAnytype3(Object anytype3) { + this.anytype3 = anytype3; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && + Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && + Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && + Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && + Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && + Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && + Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && + Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && + Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && + Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + } + + @Override + public int hashCode() { + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); + sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); + sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); + sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); + sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); + sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); + sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); + sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); + sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); + sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); + sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java new file mode 100644 index 000000000000..2426e7c974c4 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesInteger + */ +@JsonPropertyOrder({ + AdditionalPropertiesInteger.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesInteger extends HashMap<String, Integer> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesInteger name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; + return Objects.equals(this.name, additionalPropertiesInteger.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesInteger {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java new file mode 100644 index 000000000000..da407ccdc473 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesNumber + */ +@JsonPropertyOrder({ + AdditionalPropertiesNumber.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesNumber name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; + return Objects.equals(this.name, additionalPropertiesNumber.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesNumber {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java new file mode 100644 index 000000000000..5e468870311e --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesObject + */ +@JsonPropertyOrder({ + AdditionalPropertiesObject.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesObject extends HashMap<String, Map> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesObject name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; + return Objects.equals(this.name, additionalPropertiesObject.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesObject {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java new file mode 100644 index 000000000000..ed080254966e --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesString + */ +@JsonPropertyOrder({ + AdditionalPropertiesString.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesString extends HashMap<String, String> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesString name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; + return Objects.equals(this.name, additionalPropertiesString.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesString {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..e0ae875483bd --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,141 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), +}) + +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + private String color = "red"; + + + public Animal className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + public Animal color(String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..96f829bc648b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) + +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + private List<List<BigDecimal>> arrayArrayNumber = null; + + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { + + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<List<BigDecimal>>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<List<BigDecimal>> getArrayArrayNumber() { + return arrayArrayNumber; + } + + + public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..37e40dbd3ec8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) + +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + private List<BigDecimal> arrayNumber = null; + + + public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) { + + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<BigDecimal>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<BigDecimal> getArrayNumber() { + return arrayNumber; + } + + + public void setArrayNumber(List<BigDecimal> arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..de7c895ac93a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,191 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) + +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + private List<String> arrayOfString = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + private List<List<Long>> arrayArrayOfInteger = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + private List<List<ReadOnlyFirst>> arrayArrayOfModel = null; + + + public ArrayTest arrayOfString(List<String> arrayOfString) { + + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<String>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<String> getArrayOfString() { + return arrayOfString; + } + + + public void setArrayOfString(List<String> arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { + + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<List<Long>>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<List<Long>> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + + public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { + + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<List<ReadOnlyFirst>> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + + public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 000000000000..84b3f05703b2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 000000000000..7ce0ddb21f5a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..033e97881105 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,257 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Capitalization + */ +@JsonPropertyOrder({ + Capitalization.JSON_PROPERTY_SMALL_CAMEL, + Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, + Capitalization.JSON_PROPERTY_SMALL_SNAKE, + Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, + Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, + Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E +}) + +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + private String ATT_NAME; + + + public Capitalization smallCamel(String smallCamel) { + + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallCamel() { + return smallCamel; + } + + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(String capitalCamel) { + + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalCamel() { + return capitalCamel; + } + + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(String smallSnake) { + + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallSnake() { + return smallSnake; + } + + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(String capitalSnake) { + + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalSnake() { + return capitalSnake; + } + + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(String ATT_NAME) { + + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getATTNAME() { + return ATT_NAME; + } + + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..484725c76fe0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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.CatAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) + +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + + public Cat declawed(Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java new file mode 100644 index 000000000000..3e7b991436aa --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * CatAllOf + */ +@JsonPropertyOrder({ + CatAllOf.JSON_PROPERTY_DECLAWED +}) + +public class CatAllOf { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + + public CatAllOf declawed(Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatAllOf catAllOf = (CatAllOf) o; + return Objects.equals(this.declawed, catAllOf.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatAllOf {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..868ba8750742 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) + +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name = "default-name"; + + + public Category id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Category name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..4de7664b26a7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) + +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + private String propertyClass; + + + public ClassModel propertyClass(String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..02b0aac2247a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) + +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + private String client; + + + public Client client(String client) { + + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClient() { + return client; + } + + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..78044654d500 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) + +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + + public Dog breed(String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java new file mode 100644 index 000000000000..dd42595cf202 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * DogAllOf + */ +@JsonPropertyOrder({ + DogAllOf.JSON_PROPERTY_BREED +}) + +public class DogAllOf { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + + public DogAllOf breed(String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DogAllOf dogAllOf = (DogAllOf) o; + return Objects.equals(this.breed, dogAllOf.breed); + } + + @Override + public int hashCode() { + return Objects.hash(breed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DogAllOf {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..aff182cd4983 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + private List<ArrayEnumEnum> arrayEnum = null; + + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) { + + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<ArrayEnumEnum>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<ArrayEnumEnum> getArrayEnum() { + return arrayEnum; + } + + + public void setArrayEnum(List<ArrayEnumEnum> arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..e9102d974276 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..51a1a645a109 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,370 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumTest + */ +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM +}) + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + private OuterEnum outerEnum; + + + public EnumTest enumString(EnumStringEnum enumString) { + + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumStringEnum getEnumString() { + return enumString; + } + + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(OuterEnum outerEnum) { + + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..8166597792d0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,143 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) + +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + private java.io.File file; + + public static final String JSON_PROPERTY_FILES = "files"; + private List<java.io.File> files = null; + + + public FileSchemaTestClass file(java.io.File file) { + + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public java.io.File getFile() { + return file; + } + + + public void setFile(java.io.File file) { + this.file = file; + } + + + public FileSchemaTestClass files(List<java.io.File> files) { + + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList<java.io.File>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<java.io.File> getFiles() { + return files; + } + + + public void setFiles(List<java.io.File> files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..4dee7f6c9dcc --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,516 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.UUID; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FormatTest + */ +@JsonPropertyOrder({ + FormatTest.JSON_PROPERTY_INTEGER, + FormatTest.JSON_PROPERTY_INT32, + FormatTest.JSON_PROPERTY_INT64, + FormatTest.JSON_PROPERTY_NUMBER, + FormatTest.JSON_PROPERTY_FLOAT, + FormatTest.JSON_PROPERTY_DOUBLE, + FormatTest.JSON_PROPERTY_STRING, + FormatTest.JSON_PROPERTY_BYTE, + FormatTest.JSON_PROPERTY_BINARY, + FormatTest.JSON_PROPERTY_DATE, + FormatTest.JSON_PROPERTY_DATE_TIME, + FormatTest.JSON_PROPERTY_UUID, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_BIG_DECIMAL +}) + +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_BIG_DECIMAL = "BigDecimal"; + private BigDecimal bigDecimal; + + + public FormatTest integer(Integer integer) { + + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(Long int64) { + + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public FormatTest number(BigDecimal number) { + + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(Float _float) { + + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + public void setFloat(Float _float) { + this._float = _float; + } + + + public FormatTest _double(Double _double) { + + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getDouble() { + return _double; + } + + + public void setDouble(Double _double) { + this._double = _double; + } + + + public FormatTest string(String string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + public void setString(String string) { + this.string = string; + } + + + public FormatTest _byte(byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(File binary) { + + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + public void setBinary(File binary) { + this.binary = binary; + } + + + public FormatTest date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest password(String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public FormatTest bigDecimal(BigDecimal bigDecimal) { + + this.bigDecimal = bigDecimal; + return this; + } + + /** + * Get bigDecimal + * @return bigDecimal + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getBigDecimal() { + return bigDecimal; + } + + + public void setBigDecimal(BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.bigDecimal, formatTest.bigDecimal); + } + + @Override + public int hashCode() { + 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(); + sb.append("class FormatTest {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..0a3f0d464360 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,115 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) + +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + private String foo; + + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + /** + * Get foo + * @return foo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FOO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFoo() { + return foo; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..113f92dd9cbe --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,265 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MapTest + */ +@JsonPropertyOrder({ + MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, + MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, + MapTest.JSON_PROPERTY_DIRECT_MAP, + MapTest.JSON_PROPERTY_INDIRECT_MAP +}) + +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + private Map<String, Map<String, String>> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + private Map<String, InnerEnum> mapOfEnumString = null; + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + private Map<String, Boolean> directMap = null; + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + private Map<String, Boolean> indirectMap = null; + + + public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) { + + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<String, Map<String, String>>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Map<String, String>> getMapMapOfString() { + return mapMapOfString; + } + + + public void setMapMapOfString(Map<String, Map<String, String>> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { + + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<String, InnerEnum>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, InnerEnum> getMapOfEnumString() { + return mapOfEnumString; + } + + + public void setMapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(Map<String, Boolean> directMap) { + + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<String, Boolean>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Boolean> getDirectMap() { + return directMap; + } + + + public void setDirectMap(Map<String, Boolean> directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(Map<String, Boolean> indirectMap) { + + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<String, Boolean>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Boolean> getIndirectMap() { + return indirectMap; + } + + + public void setIndirectMap(Map<String, Boolean> indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..d483d69700f8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,178 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.UUID; +import org.openapitools.client.model.Animal; +import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) + +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + private Map<String, Animal> map = null; + + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) { + + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<String, Animal>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Animal> getMap() { + return map; + } + + + public void setMap(Map<String, Animal> map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..dd99468a0059 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,134 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) + +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + private String propertyClass; + + + public Model200Response name(Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getName() { + return name; + } + + + public void setName(Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..383cafdd3a5a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) + +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + + public ModelApiResponse code(Integer code) { + + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCode() { + return code; + } + + + public void setCode(Integer code) { + this.code = code; + } + + + public ModelApiResponse type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ModelApiResponse message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..b62e13a90a0c --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) + +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + private Integer _return; + + + public ModelReturn _return(Integer _return) { + + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getReturn() { + return _return; + } + + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..bd625c5f66f3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) + +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + private Integer _123number; + + + public Name name(Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getName() { + return name; + } + + + public void setName(Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + + public Name property(String property) { + + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getProperty() { + return property; + } + + + public void setProperty(String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer get123number() { + return _123number; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..5ca72a169fe8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) + +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + private BigDecimal justNumber; + + + public NumberOnly justNumber(BigDecimal justNumber) { + + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getJustNumber() { + return justNumber; + } + + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..6e2816302162 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,295 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Order + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) + +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + private Boolean complete = false; + + + public Order id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Order petId(Long petId) { + + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getPetId() { + return petId; + } + + + public void setPetId(Long petId) { + this.petId = petId; + } + + + public Order quantity(Integer quantity) { + + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getQuantity() { + return quantity; + } + + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(OffsetDateTime shipDate) { + + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order Status") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public Order complete(Boolean complete) { + + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getComplete() { + return complete; + } + + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..d4d9ac6ba110 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,165 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) + +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + private Boolean myBoolean; + + + public OuterComposite myNumber(BigDecimal myNumber) { + + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMyNumber() { + return myNumber; + } + + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(String myString) { + + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMyString() { + return myString; + } + + + public void setMyString(String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(Boolean myBoolean) { + + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMyBoolean() { + return myBoolean; + } + + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..308646a320c7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..be74dd5ca081 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,309 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Pet + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) + +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + private List<String> photoUrls = new ArrayList<String>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List<Tag> tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + + public Pet id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Pet category(Category category) { + + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + + public void setCategory(Category category) { + this.category = category; + } + + + public Pet name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Pet photoUrls(List<String> photoUrls) { + + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List<String> getPhotoUrls() { + return photoUrls; + } + + + public void setPhotoUrls(List<String> photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(List<Tag> tags) { + + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<Tag>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Tag> getTags() { + return tags; + } + + + public void setTags(List<Tag> tags) { + this.tags = tags; + } + + + public Pet status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "pet status in the store") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..b3e58ef3d2c5 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) + +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + private String baz; + + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + public ReadOnlyFirst baz(String baz) { + + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBaz() { + return baz; + } + + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..35ad3bf46994 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) + +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + private Long $specialPropertyName; + + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName $specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..a3ecb398faa3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) + +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public Tag id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Tag name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java new file mode 100644 index 000000000000..73f393587944 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -0,0 +1,229 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TypeHolderDefault + */ +@JsonPropertyOrder({ + TypeHolderDefault.JSON_PROPERTY_STRING_ITEM, + TypeHolderDefault.JSON_PROPERTY_NUMBER_ITEM, + TypeHolderDefault.JSON_PROPERTY_INTEGER_ITEM, + TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, + TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM +}) + +public class TypeHolderDefault { + public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + private String stringItem = "what"; + + public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + private BigDecimal numberItem; + + public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + private Integer integerItem; + + public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + private Boolean boolItem = true; + + public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + private List<Integer> arrayItem = new ArrayList<Integer>(); + + + public TypeHolderDefault stringItem(String stringItem) { + + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStringItem() { + return stringItem; + } + + + public void setStringItem(String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderDefault numberItem(BigDecimal numberItem) { + + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumberItem() { + return numberItem; + } + + + public void setNumberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderDefault integerItem(Integer integerItem) { + + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getIntegerItem() { + return integerItem; + } + + + public void setIntegerItem(Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderDefault boolItem(Boolean boolItem) { + + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getBoolItem() { + return boolItem; + } + + + public void setBoolItem(Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderDefault arrayItem(List<Integer> arrayItem) { + + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List<Integer> getArrayItem() { + return arrayItem; + } + + + public void setArrayItem(List<Integer> arrayItem) { + this.arrayItem = arrayItem; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; + return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && + Objects.equals(this.numberItem, typeHolderDefault.numberItem) && + Objects.equals(this.integerItem, typeHolderDefault.integerItem) && + Objects.equals(this.boolItem, typeHolderDefault.boolItem) && + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderDefault {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java new file mode 100644 index 000000000000..e3daa1a3e1cb --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -0,0 +1,259 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TypeHolderExample + */ +@JsonPropertyOrder({ + TypeHolderExample.JSON_PROPERTY_STRING_ITEM, + TypeHolderExample.JSON_PROPERTY_NUMBER_ITEM, + TypeHolderExample.JSON_PROPERTY_FLOAT_ITEM, + TypeHolderExample.JSON_PROPERTY_INTEGER_ITEM, + TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, + TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM +}) + +public class TypeHolderExample { + public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + private String stringItem; + + public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + private BigDecimal numberItem; + + public static final String JSON_PROPERTY_FLOAT_ITEM = "float_item"; + private Float floatItem; + + public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + private Integer integerItem; + + public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + private Boolean boolItem; + + public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + private List<Integer> arrayItem = new ArrayList<Integer>(); + + + public TypeHolderExample stringItem(String stringItem) { + + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + **/ + @ApiModelProperty(example = "what", required = true, value = "") + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStringItem() { + return stringItem; + } + + + public void setStringItem(String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderExample numberItem(BigDecimal numberItem) { + + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + **/ + @ApiModelProperty(example = "1.234", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumberItem() { + return numberItem; + } + + + public void setNumberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderExample floatItem(Float floatItem) { + + this.floatItem = floatItem; + return this; + } + + /** + * Get floatItem + * @return floatItem + **/ + @ApiModelProperty(example = "1.234", required = true, value = "") + @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Float getFloatItem() { + return floatItem; + } + + + public void setFloatItem(Float floatItem) { + this.floatItem = floatItem; + } + + + public TypeHolderExample integerItem(Integer integerItem) { + + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + **/ + @ApiModelProperty(example = "-2", required = true, value = "") + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getIntegerItem() { + return integerItem; + } + + + public void setIntegerItem(Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderExample boolItem(Boolean boolItem) { + + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + **/ + @ApiModelProperty(example = "true", required = true, value = "") + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getBoolItem() { + return boolItem; + } + + + public void setBoolItem(Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderExample arrayItem(List<Integer> arrayItem) { + + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + **/ + @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List<Integer> getArrayItem() { + return arrayItem; + } + + + public void setArrayItem(List<Integer> arrayItem) { + this.arrayItem = arrayItem; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderExample typeHolderExample = (TypeHolderExample) o; + return Objects.equals(this.stringItem, typeHolderExample.stringItem) && + Objects.equals(this.numberItem, typeHolderExample.numberItem) && + Objects.equals(this.floatItem, typeHolderExample.floatItem) && + Objects.equals(this.integerItem, typeHolderExample.integerItem) && + Objects.equals(this.boolItem, typeHolderExample.boolItem) && + Objects.equals(this.arrayItem, typeHolderExample.arrayItem); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderExample {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..b7e74643dab2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,319 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) + +public class User { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + private Integer userStatus; + + + public User id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public User username(String username) { + + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public User firstName(String firstName) { + + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFirstName() { + return firstName; + } + + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + + public User lastName(String lastName) { + + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastName() { + return lastName; + } + + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + + public User email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public User password(String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public User phone(String phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhone() { + return phone; + } + + + public void setPhone(String phone) { + this.phone = phone; + } + + + public User userStatus(Integer userStatus) { + + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "User Status") + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUserStatus() { + return userStatus; + } + + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java new file mode 100644 index 000000000000..f585a625223a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java @@ -0,0 +1,1045 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * XmlItem + */ +@JsonPropertyOrder({ + XmlItem.JSON_PROPERTY_ATTRIBUTE_STRING, + XmlItem.JSON_PROPERTY_ATTRIBUTE_NUMBER, + XmlItem.JSON_PROPERTY_ATTRIBUTE_INTEGER, + XmlItem.JSON_PROPERTY_ATTRIBUTE_BOOLEAN, + XmlItem.JSON_PROPERTY_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_NAME_STRING, + XmlItem.JSON_PROPERTY_NAME_NUMBER, + XmlItem.JSON_PROPERTY_NAME_INTEGER, + XmlItem.JSON_PROPERTY_NAME_BOOLEAN, + XmlItem.JSON_PROPERTY_NAME_ARRAY, + XmlItem.JSON_PROPERTY_NAME_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_STRING, + XmlItem.JSON_PROPERTY_PREFIX_NUMBER, + XmlItem.JSON_PROPERTY_PREFIX_INTEGER, + XmlItem.JSON_PROPERTY_PREFIX_BOOLEAN, + XmlItem.JSON_PROPERTY_PREFIX_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_NAMESPACE_STRING, + XmlItem.JSON_PROPERTY_NAMESPACE_NUMBER, + XmlItem.JSON_PROPERTY_NAMESPACE_INTEGER, + XmlItem.JSON_PROPERTY_NAMESPACE_BOOLEAN, + XmlItem.JSON_PROPERTY_NAMESPACE_ARRAY, + XmlItem.JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_NS_STRING, + XmlItem.JSON_PROPERTY_PREFIX_NS_NUMBER, + XmlItem.JSON_PROPERTY_PREFIX_NS_INTEGER, + XmlItem.JSON_PROPERTY_PREFIX_NS_BOOLEAN, + XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY +}) + +public class XmlItem { + public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; + private String attributeString; + + public static final String JSON_PROPERTY_ATTRIBUTE_NUMBER = "attribute_number"; + private BigDecimal attributeNumber; + + public static final String JSON_PROPERTY_ATTRIBUTE_INTEGER = "attribute_integer"; + private Integer attributeInteger; + + public static final String JSON_PROPERTY_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + private Boolean attributeBoolean; + + public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array"; + private List<Integer> wrappedArray = null; + + public static final String JSON_PROPERTY_NAME_STRING = "name_string"; + private String nameString; + + public static final String JSON_PROPERTY_NAME_NUMBER = "name_number"; + private BigDecimal nameNumber; + + public static final String JSON_PROPERTY_NAME_INTEGER = "name_integer"; + private Integer nameInteger; + + public static final String JSON_PROPERTY_NAME_BOOLEAN = "name_boolean"; + private Boolean nameBoolean; + + public static final String JSON_PROPERTY_NAME_ARRAY = "name_array"; + private List<Integer> nameArray = null; + + public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + private List<Integer> nameWrappedArray = null; + + public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string"; + private String prefixString; + + public static final String JSON_PROPERTY_PREFIX_NUMBER = "prefix_number"; + private BigDecimal prefixNumber; + + public static final String JSON_PROPERTY_PREFIX_INTEGER = "prefix_integer"; + private Integer prefixInteger; + + public static final String JSON_PROPERTY_PREFIX_BOOLEAN = "prefix_boolean"; + private Boolean prefixBoolean; + + public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array"; + private List<Integer> prefixArray = null; + + public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + private List<Integer> prefixWrappedArray = null; + + public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string"; + private String namespaceString; + + public static final String JSON_PROPERTY_NAMESPACE_NUMBER = "namespace_number"; + private BigDecimal namespaceNumber; + + public static final String JSON_PROPERTY_NAMESPACE_INTEGER = "namespace_integer"; + private Integer namespaceInteger; + + public static final String JSON_PROPERTY_NAMESPACE_BOOLEAN = "namespace_boolean"; + private Boolean namespaceBoolean; + + public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array"; + private List<Integer> namespaceArray = null; + + public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + private List<Integer> namespaceWrappedArray = null; + + public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string"; + private String prefixNsString; + + public static final String JSON_PROPERTY_PREFIX_NS_NUMBER = "prefix_ns_number"; + private BigDecimal prefixNsNumber; + + public static final String JSON_PROPERTY_PREFIX_NS_INTEGER = "prefix_ns_integer"; + private Integer prefixNsInteger; + + public static final String JSON_PROPERTY_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + private Boolean prefixNsBoolean; + + public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array"; + private List<Integer> prefixNsArray = null; + + public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + private List<Integer> prefixNsWrappedArray = null; + + + public XmlItem attributeString(String attributeString) { + + this.attributeString = attributeString; + return this; + } + + /** + * Get attributeString + * @return attributeString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAttributeString() { + return attributeString; + } + + + public void setAttributeString(String attributeString) { + this.attributeString = attributeString; + } + + + public XmlItem attributeNumber(BigDecimal attributeNumber) { + + this.attributeNumber = attributeNumber; + return this; + } + + /** + * Get attributeNumber + * @return attributeNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getAttributeNumber() { + return attributeNumber; + } + + + public void setAttributeNumber(BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + } + + + public XmlItem attributeInteger(Integer attributeInteger) { + + this.attributeInteger = attributeInteger; + return this; + } + + /** + * Get attributeInteger + * @return attributeInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getAttributeInteger() { + return attributeInteger; + } + + + public void setAttributeInteger(Integer attributeInteger) { + this.attributeInteger = attributeInteger; + } + + + public XmlItem attributeBoolean(Boolean attributeBoolean) { + + this.attributeBoolean = attributeBoolean; + return this; + } + + /** + * Get attributeBoolean + * @return attributeBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAttributeBoolean() { + return attributeBoolean; + } + + + public void setAttributeBoolean(Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + } + + + public XmlItem wrappedArray(List<Integer> wrappedArray) { + + this.wrappedArray = wrappedArray; + return this; + } + + public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { + if (this.wrappedArray == null) { + this.wrappedArray = new ArrayList<Integer>(); + } + this.wrappedArray.add(wrappedArrayItem); + return this; + } + + /** + * Get wrappedArray + * @return wrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getWrappedArray() { + return wrappedArray; + } + + + public void setWrappedArray(List<Integer> wrappedArray) { + this.wrappedArray = wrappedArray; + } + + + public XmlItem nameString(String nameString) { + + this.nameString = nameString; + return this; + } + + /** + * Get nameString + * @return nameString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_NAME_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNameString() { + return nameString; + } + + + public void setNameString(String nameString) { + this.nameString = nameString; + } + + + public XmlItem nameNumber(BigDecimal nameNumber) { + + this.nameNumber = nameNumber; + return this; + } + + /** + * Get nameNumber + * @return nameNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_NAME_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getNameNumber() { + return nameNumber; + } + + + public void setNameNumber(BigDecimal nameNumber) { + this.nameNumber = nameNumber; + } + + + public XmlItem nameInteger(Integer nameInteger) { + + this.nameInteger = nameInteger; + return this; + } + + /** + * Get nameInteger + * @return nameInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_NAME_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getNameInteger() { + return nameInteger; + } + + + public void setNameInteger(Integer nameInteger) { + this.nameInteger = nameInteger; + } + + + public XmlItem nameBoolean(Boolean nameBoolean) { + + this.nameBoolean = nameBoolean; + return this; + } + + /** + * Get nameBoolean + * @return nameBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getNameBoolean() { + return nameBoolean; + } + + + public void setNameBoolean(Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + } + + + public XmlItem nameArray(List<Integer> nameArray) { + + this.nameArray = nameArray; + return this; + } + + public XmlItem addNameArrayItem(Integer nameArrayItem) { + if (this.nameArray == null) { + this.nameArray = new ArrayList<Integer>(); + } + this.nameArray.add(nameArrayItem); + return this; + } + + /** + * Get nameArray + * @return nameArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNameArray() { + return nameArray; + } + + + public void setNameArray(List<Integer> nameArray) { + this.nameArray = nameArray; + } + + + public XmlItem nameWrappedArray(List<Integer> nameWrappedArray) { + + this.nameWrappedArray = nameWrappedArray; + return this; + } + + public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { + if (this.nameWrappedArray == null) { + this.nameWrappedArray = new ArrayList<Integer>(); + } + this.nameWrappedArray.add(nameWrappedArrayItem); + return this; + } + + /** + * Get nameWrappedArray + * @return nameWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNameWrappedArray() { + return nameWrappedArray; + } + + + public void setNameWrappedArray(List<Integer> nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + } + + + public XmlItem prefixString(String prefixString) { + + this.prefixString = prefixString; + return this; + } + + /** + * Get prefixString + * @return prefixString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPrefixString() { + return prefixString; + } + + + public void setPrefixString(String prefixString) { + this.prefixString = prefixString; + } + + + public XmlItem prefixNumber(BigDecimal prefixNumber) { + + this.prefixNumber = prefixNumber; + return this; + } + + /** + * Get prefixNumber + * @return prefixNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getPrefixNumber() { + return prefixNumber; + } + + + public void setPrefixNumber(BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + } + + + public XmlItem prefixInteger(Integer prefixInteger) { + + this.prefixInteger = prefixInteger; + return this; + } + + /** + * Get prefixInteger + * @return prefixInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getPrefixInteger() { + return prefixInteger; + } + + + public void setPrefixInteger(Integer prefixInteger) { + this.prefixInteger = prefixInteger; + } + + + public XmlItem prefixBoolean(Boolean prefixBoolean) { + + this.prefixBoolean = prefixBoolean; + return this; + } + + /** + * Get prefixBoolean + * @return prefixBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrefixBoolean() { + return prefixBoolean; + } + + + public void setPrefixBoolean(Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + } + + + public XmlItem prefixArray(List<Integer> prefixArray) { + + this.prefixArray = prefixArray; + return this; + } + + public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { + if (this.prefixArray == null) { + this.prefixArray = new ArrayList<Integer>(); + } + this.prefixArray.add(prefixArrayItem); + return this; + } + + /** + * Get prefixArray + * @return prefixArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixArray() { + return prefixArray; + } + + + public void setPrefixArray(List<Integer> prefixArray) { + this.prefixArray = prefixArray; + } + + + public XmlItem prefixWrappedArray(List<Integer> prefixWrappedArray) { + + this.prefixWrappedArray = prefixWrappedArray; + return this; + } + + public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { + if (this.prefixWrappedArray == null) { + this.prefixWrappedArray = new ArrayList<Integer>(); + } + this.prefixWrappedArray.add(prefixWrappedArrayItem); + return this; + } + + /** + * Get prefixWrappedArray + * @return prefixWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixWrappedArray() { + return prefixWrappedArray; + } + + + public void setPrefixWrappedArray(List<Integer> prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + } + + + public XmlItem namespaceString(String namespaceString) { + + this.namespaceString = namespaceString; + return this; + } + + /** + * Get namespaceString + * @return namespaceString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNamespaceString() { + return namespaceString; + } + + + public void setNamespaceString(String namespaceString) { + this.namespaceString = namespaceString; + } + + + public XmlItem namespaceNumber(BigDecimal namespaceNumber) { + + this.namespaceNumber = namespaceNumber; + return this; + } + + /** + * Get namespaceNumber + * @return namespaceNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getNamespaceNumber() { + return namespaceNumber; + } + + + public void setNamespaceNumber(BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + } + + + public XmlItem namespaceInteger(Integer namespaceInteger) { + + this.namespaceInteger = namespaceInteger; + return this; + } + + /** + * Get namespaceInteger + * @return namespaceInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getNamespaceInteger() { + return namespaceInteger; + } + + + public void setNamespaceInteger(Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + } + + + public XmlItem namespaceBoolean(Boolean namespaceBoolean) { + + this.namespaceBoolean = namespaceBoolean; + return this; + } + + /** + * Get namespaceBoolean + * @return namespaceBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getNamespaceBoolean() { + return namespaceBoolean; + } + + + public void setNamespaceBoolean(Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + } + + + public XmlItem namespaceArray(List<Integer> namespaceArray) { + + this.namespaceArray = namespaceArray; + return this; + } + + public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { + if (this.namespaceArray == null) { + this.namespaceArray = new ArrayList<Integer>(); + } + this.namespaceArray.add(namespaceArrayItem); + return this; + } + + /** + * Get namespaceArray + * @return namespaceArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNamespaceArray() { + return namespaceArray; + } + + + public void setNamespaceArray(List<Integer> namespaceArray) { + this.namespaceArray = namespaceArray; + } + + + public XmlItem namespaceWrappedArray(List<Integer> namespaceWrappedArray) { + + this.namespaceWrappedArray = namespaceWrappedArray; + return this; + } + + public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { + if (this.namespaceWrappedArray == null) { + this.namespaceWrappedArray = new ArrayList<Integer>(); + } + this.namespaceWrappedArray.add(namespaceWrappedArrayItem); + return this; + } + + /** + * Get namespaceWrappedArray + * @return namespaceWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNamespaceWrappedArray() { + return namespaceWrappedArray; + } + + + public void setNamespaceWrappedArray(List<Integer> namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + } + + + public XmlItem prefixNsString(String prefixNsString) { + + this.prefixNsString = prefixNsString; + return this; + } + + /** + * Get prefixNsString + * @return prefixNsString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPrefixNsString() { + return prefixNsString; + } + + + public void setPrefixNsString(String prefixNsString) { + this.prefixNsString = prefixNsString; + } + + + public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) { + + this.prefixNsNumber = prefixNsNumber; + return this; + } + + /** + * Get prefixNsNumber + * @return prefixNsNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getPrefixNsNumber() { + return prefixNsNumber; + } + + + public void setPrefixNsNumber(BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + } + + + public XmlItem prefixNsInteger(Integer prefixNsInteger) { + + this.prefixNsInteger = prefixNsInteger; + return this; + } + + /** + * Get prefixNsInteger + * @return prefixNsInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getPrefixNsInteger() { + return prefixNsInteger; + } + + + public void setPrefixNsInteger(Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + } + + + public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) { + + this.prefixNsBoolean = prefixNsBoolean; + return this; + } + + /** + * Get prefixNsBoolean + * @return prefixNsBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrefixNsBoolean() { + return prefixNsBoolean; + } + + + public void setPrefixNsBoolean(Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + } + + + public XmlItem prefixNsArray(List<Integer> prefixNsArray) { + + this.prefixNsArray = prefixNsArray; + return this; + } + + public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { + if (this.prefixNsArray == null) { + this.prefixNsArray = new ArrayList<Integer>(); + } + this.prefixNsArray.add(prefixNsArrayItem); + return this; + } + + /** + * Get prefixNsArray + * @return prefixNsArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixNsArray() { + return prefixNsArray; + } + + + public void setPrefixNsArray(List<Integer> prefixNsArray) { + this.prefixNsArray = prefixNsArray; + } + + + public XmlItem prefixNsWrappedArray(List<Integer> prefixNsWrappedArray) { + + this.prefixNsWrappedArray = prefixNsWrappedArray; + return this; + } + + public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { + if (this.prefixNsWrappedArray == null) { + this.prefixNsWrappedArray = new ArrayList<Integer>(); + } + this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); + return this; + } + + /** + * Get prefixNsWrappedArray + * @return prefixNsWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixNsWrappedArray() { + return prefixNsWrappedArray; + } + + + public void setPrefixNsWrappedArray(List<Integer> prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XmlItem xmlItem = (XmlItem) o; + return Objects.equals(this.attributeString, xmlItem.attributeString) && + Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && + Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && + Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && + Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && + Objects.equals(this.nameString, xmlItem.nameString) && + Objects.equals(this.nameNumber, xmlItem.nameNumber) && + Objects.equals(this.nameInteger, xmlItem.nameInteger) && + Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && + Objects.equals(this.nameArray, xmlItem.nameArray) && + Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && + Objects.equals(this.prefixString, xmlItem.prefixString) && + Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && + Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && + Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && + Objects.equals(this.prefixArray, xmlItem.prefixArray) && + Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && + Objects.equals(this.namespaceString, xmlItem.namespaceString) && + Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && + Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && + Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && + Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && + Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && + Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && + Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && + Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && + Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && + Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); + } + + @Override + public int hashCode() { + 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(); + sb.append("class XmlItem {\n"); + sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); + sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); + sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); + sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); + sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); + sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); + sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); + sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); + sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); + sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); + sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); + sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); + sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); + sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); + sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); + sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); + sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); + sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); + sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); + sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); + sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); + sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); + sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); + sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); + sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); + sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); + sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); + sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); + sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..837b5ea02461 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +@Ignore +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + Client body = null; + Client response = api.call123testSpecialTags(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..b2c8f47fb36e --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,291 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +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.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +@Ignore +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + + /** + * creates an XmlItem + * + * this route creates an XmlItem + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createXmlItemTest() throws ApiException { + XmlItem xmlItem = null; + api.createXmlItem(xmlItem); + // TODO: test validations + } + + /** + * + * + * Test serialization of outer boolean types + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + Boolean body = null; + Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * + * + * Test serialization of object with outer number type + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + OuterComposite body = null; + OuterComposite response = api.fakeOuterCompositeSerialize(body); + // TODO: test validations + } + + /** + * + * + * Test serialization of outer number types + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + BigDecimal body = null; + BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * + * + * Test serialization of outer string types + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + String body = null; + String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * + * + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + FileSchemaTestClass body = null; + api.testBodyWithFileSchema(body); + // TODO: test validations + } + + /** + * + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + String query = null; + User body = null; + api.testBodyWithQueryParams(query, body); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + Client body = null; + Client response = api.testClientModel(body); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + 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); + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + List<String> enumHeaderStringArray = null; + String enumHeaderString = null; + List<String> enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List<String> enumFormStringArray = null; + String enumFormString = null; + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + Integer requiredStringGroup = null; + Boolean requiredBooleanGroup = null; + Long requiredInt64Group = null; + Integer stringGroup = null; + Boolean booleanGroup = null; + Long int64Group = null; + api.testGroupParameters() + .requiredStringGroup(requiredStringGroup) + .requiredBooleanGroup(requiredBooleanGroup) + .requiredInt64Group(requiredInt64Group) + .stringGroup(stringGroup) + .booleanGroup(booleanGroup) + .int64Group(int64Group) + .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + Map<String, String> param = null; + api.testInlineAdditionalProperties(param); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + String param = null; + String param2 = null; + api.testJsonFormData(param, param2); + // TODO: test validations + } + + /** + * + * + * To test the collection format in query parameters + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + List<String> pipe = null; + List<String> ioutil = null; + List<String> http = null; + List<String> url = null; + List<String> context = null; + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..71999316797a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..fd382967f1d2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,179 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Ignore +public class PetApiTest { + + private final PetApi api = new PetApi(); + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + Pet body = null; + api.addPet(body); + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + List<String> status = null; + List<Pet> response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + List<String> tags = null; + List<Pet> response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + Long petId = null; + Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + Pet body = null; + api.updatePet(body); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + Long petId = null; + String additionalMetadata = null; + File file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + // TODO: test validations + } + + /** + * uploads an image (required) + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..cd36a70fece3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Ignore +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + String orderId = null; + api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + Map<String, Integer> response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + Long orderId = null; + Order response = api.getOrderById(orderId); + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + Order body = null; + Order response = api.placeOrder(body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..f7ef9050c955 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,156 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.User; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Ignore +public class UserApiTest { + + private final UserApi api = new UserApi(); + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + User body = null; + api.createUser(body); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + List<User> body = null; + api.createUsersWithArrayInput(body); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + List<User> body = null; + api.createUsersWithListInput(body); + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + String username = null; + api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + String username = null; + User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + String username = null; + String password = null; + String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + api.logoutUser(); + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + String username = null; + User body = null; + api.updateUser(username, body); + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java new file mode 100644 index 000000000000..ec44af783873 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesAnyType + */ +public class AdditionalPropertiesAnyTypeTest { + private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); + + /** + * Model tests for AdditionalPropertiesAnyType + */ + @Test + public void testAdditionalPropertiesAnyType() { + // TODO: test AdditionalPropertiesAnyType + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java new file mode 100644 index 000000000000..ceb024c5620b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesArray + */ +public class AdditionalPropertiesArrayTest { + private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); + + /** + * Model tests for AdditionalPropertiesArray + */ + @Test + public void testAdditionalPropertiesArray() { + // TODO: test AdditionalPropertiesArray + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java new file mode 100644 index 000000000000..517e5a10ae43 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesBoolean + */ +public class AdditionalPropertiesBooleanTest { + private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); + + /** + * Model tests for AdditionalPropertiesBoolean + */ + @Test + public void testAdditionalPropertiesBoolean() { + // TODO: test AdditionalPropertiesBoolean + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..2e3844ba9756 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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; + + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapString' + */ + @Test + public void mapStringTest() { + // TODO: test mapString + } + + /** + * Test the property 'mapNumber' + */ + @Test + public void mapNumberTest() { + // TODO: test mapNumber + } + + /** + * Test the property 'mapInteger' + */ + @Test + public void mapIntegerTest() { + // TODO: test mapInteger + } + + /** + * Test the property 'mapBoolean' + */ + @Test + public void mapBooleanTest() { + // TODO: test mapBoolean + } + + /** + * Test the property 'mapArrayInteger' + */ + @Test + public void mapArrayIntegerTest() { + // TODO: test mapArrayInteger + } + + /** + * Test the property 'mapArrayAnytype' + */ + @Test + public void mapArrayAnytypeTest() { + // TODO: test mapArrayAnytype + } + + /** + * Test the property 'mapMapString' + */ + @Test + public void mapMapStringTest() { + // TODO: test mapMapString + } + + /** + * Test the property 'mapMapAnytype' + */ + @Test + public void mapMapAnytypeTest() { + // TODO: test mapMapAnytype + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'anytype2' + */ + @Test + public void anytype2Test() { + // TODO: test anytype2 + } + + /** + * Test the property 'anytype3' + */ + @Test + public void anytype3Test() { + // TODO: test anytype3 + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java new file mode 100644 index 000000000000..66a7b85623e3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesInteger + */ +public class AdditionalPropertiesIntegerTest { + private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); + + /** + * Model tests for AdditionalPropertiesInteger + */ + @Test + public void testAdditionalPropertiesInteger() { + // TODO: test AdditionalPropertiesInteger + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java new file mode 100644 index 000000000000..4e03485a4484 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesNumber + */ +public class AdditionalPropertiesNumberTest { + private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); + + /** + * Model tests for AdditionalPropertiesNumber + */ + @Test + public void testAdditionalPropertiesNumber() { + // TODO: test AdditionalPropertiesNumber + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java new file mode 100644 index 000000000000..e0c72c586347 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesObject + */ +public class AdditionalPropertiesObjectTest { + private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); + + /** + * Model tests for AdditionalPropertiesObject + */ + @Test + public void testAdditionalPropertiesObject() { + // TODO: test AdditionalPropertiesObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java new file mode 100644 index 000000000000..c84d987e7640 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesString + */ +public class AdditionalPropertiesStringTest { + private final AdditionalPropertiesString model = new AdditionalPropertiesString(); + + /** + * Model tests for AdditionalPropertiesString + */ + @Test + public void testAdditionalPropertiesString() { + // TODO: test AdditionalPropertiesString + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..c0d10ec5a3d8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +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; + + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..e25187a3b608 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..ae1061823991 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..36bd9951cf60 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 000000000000..a9b13011f001 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 000000000000..006c80707427 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..a701b341fc59 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java new file mode 100644 index 000000000000..1d85a0447253 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for CatAllOf + */ +public class CatAllOfTest { + private final CatAllOf model = new CatAllOf(); + + /** + * Model tests for CatAllOf + */ + @Test + public void testCatAllOf() { + // TODO: test CatAllOf + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..dbf40678a2d0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.CatAllOf; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..6027994a2ac3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..8914c9cad43d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..c21b346272d7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java new file mode 100644 index 000000000000..6e4b49108098 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for DogAllOf + */ +public class DogAllOfTest { + private final DogAllOf model = new DogAllOf(); + + /** + * Model tests for DogAllOf + */ + @Test + public void testDogAllOf() { + // TODO: test DogAllOf + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..a46bc508d48c --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..45b8fbbd8220 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..9e45543facd2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..04e7afb19784 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..ef37e666be39 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property 'file' + */ + @Test + public void fileTest() { + // TODO: test file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..710501b51bd4 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,158 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +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; + + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'bigDecimal' + */ + @Test + public void bigDecimalTest() { + // TODO: test bigDecimal + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..e902c100383b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..a0c991bb7588 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..f8a8c734baaf --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +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; + + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..82c7208079db --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..97a1287aa413 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..f884519ebc86 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..cb3a94cf74ab --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..f4fbd5ee8b42 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..d24c8479f5d6 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..ebea3ca304c0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..cf0ebae0faf0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..c3c0d4cc35dd --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..b82a7d0ef561 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..d5a19c371e68 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..5c2cc6f49e05 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java new file mode 100644 index 000000000000..e96ac744439d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for TypeHolderDefault + */ +public class TypeHolderDefaultTest { + private final TypeHolderDefault model = new TypeHolderDefault(); + + /** + * Model tests for TypeHolderDefault + */ + @Test + public void testTypeHolderDefault() { + // TODO: test TypeHolderDefault + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java new file mode 100644 index 000000000000..56641d163a50 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for TypeHolderExample + */ +public class TypeHolderExampleTest { + private final TypeHolderExample model = new TypeHolderExample(); + + /** + * Model tests for TypeHolderExample + */ + @Test + public void testTypeHolderExample() { + // TODO: test TypeHolderExample + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'floatItem' + */ + @Test + public void floatItemTest() { + // TODO: test floatItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..ce40d3a2a637 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,105 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java new file mode 100644 index 000000000000..501c414555f4 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java @@ -0,0 +1,276 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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; + + +/** + * Model tests for XmlItem + */ +public class XmlItemTest { + private final XmlItem model = new XmlItem(); + + /** + * Model tests for XmlItem + */ + @Test + public void testXmlItem() { + // TODO: test XmlItem + } + + /** + * Test the property 'attributeString' + */ + @Test + public void attributeStringTest() { + // TODO: test attributeString + } + + /** + * Test the property 'attributeNumber' + */ + @Test + public void attributeNumberTest() { + // TODO: test attributeNumber + } + + /** + * Test the property 'attributeInteger' + */ + @Test + public void attributeIntegerTest() { + // TODO: test attributeInteger + } + + /** + * Test the property 'attributeBoolean' + */ + @Test + public void attributeBooleanTest() { + // TODO: test attributeBoolean + } + + /** + * Test the property 'wrappedArray' + */ + @Test + public void wrappedArrayTest() { + // TODO: test wrappedArray + } + + /** + * Test the property 'nameString' + */ + @Test + public void nameStringTest() { + // TODO: test nameString + } + + /** + * Test the property 'nameNumber' + */ + @Test + public void nameNumberTest() { + // TODO: test nameNumber + } + + /** + * Test the property 'nameInteger' + */ + @Test + public void nameIntegerTest() { + // TODO: test nameInteger + } + + /** + * Test the property 'nameBoolean' + */ + @Test + public void nameBooleanTest() { + // TODO: test nameBoolean + } + + /** + * Test the property 'nameArray' + */ + @Test + public void nameArrayTest() { + // TODO: test nameArray + } + + /** + * Test the property 'nameWrappedArray' + */ + @Test + public void nameWrappedArrayTest() { + // TODO: test nameWrappedArray + } + + /** + * Test the property 'prefixString' + */ + @Test + public void prefixStringTest() { + // TODO: test prefixString + } + + /** + * Test the property 'prefixNumber' + */ + @Test + public void prefixNumberTest() { + // TODO: test prefixNumber + } + + /** + * Test the property 'prefixInteger' + */ + @Test + public void prefixIntegerTest() { + // TODO: test prefixInteger + } + + /** + * Test the property 'prefixBoolean' + */ + @Test + public void prefixBooleanTest() { + // TODO: test prefixBoolean + } + + /** + * Test the property 'prefixArray' + */ + @Test + public void prefixArrayTest() { + // TODO: test prefixArray + } + + /** + * Test the property 'prefixWrappedArray' + */ + @Test + public void prefixWrappedArrayTest() { + // TODO: test prefixWrappedArray + } + + /** + * Test the property 'namespaceString' + */ + @Test + public void namespaceStringTest() { + // TODO: test namespaceString + } + + /** + * Test the property 'namespaceNumber' + */ + @Test + public void namespaceNumberTest() { + // TODO: test namespaceNumber + } + + /** + * Test the property 'namespaceInteger' + */ + @Test + public void namespaceIntegerTest() { + // TODO: test namespaceInteger + } + + /** + * Test the property 'namespaceBoolean' + */ + @Test + public void namespaceBooleanTest() { + // TODO: test namespaceBoolean + } + + /** + * Test the property 'namespaceArray' + */ + @Test + public void namespaceArrayTest() { + // TODO: test namespaceArray + } + + /** + * Test the property 'namespaceWrappedArray' + */ + @Test + public void namespaceWrappedArrayTest() { + // TODO: test namespaceWrappedArray + } + + /** + * Test the property 'prefixNsString' + */ + @Test + public void prefixNsStringTest() { + // TODO: test prefixNsString + } + + /** + * Test the property 'prefixNsNumber' + */ + @Test + public void prefixNsNumberTest() { + // TODO: test prefixNsNumber + } + + /** + * Test the property 'prefixNsInteger' + */ + @Test + public void prefixNsIntegerTest() { + // TODO: test prefixNsInteger + } + + /** + * Test the property 'prefixNsBoolean' + */ + @Test + public void prefixNsBooleanTest() { + // TODO: test prefixNsBoolean + } + + /** + * Test the property 'prefixNsArray' + */ + @Test + public void prefixNsArrayTest() { + // TODO: test prefixNsArray + } + + /** + * Test the property 'prefixNsWrappedArray' + */ + @Test + public void prefixNsWrappedArrayTest() { + // TODO: test prefixNsWrappedArray + } + +} diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index 07d2aca7a1fe..07a49c8614cb 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -287,7 +287,7 @@ </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <swagger-annotations-version>1.5.22</swagger-annotations-version> + <swagger-annotations-version>1.6.1</swagger-annotations-version> <jersey-version>2.6</jersey-version> <commons_io_version>2.5</commons_io_version> <commons_lang3_version>3.6</commons_lang3_version> diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index 5244287e176a..ae710b33c8d0 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -276,7 +276,7 @@ </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <swagger-annotations-version>1.5.22</swagger-annotations-version> + <swagger-annotations-version>1.6.1</swagger-annotations-version> <jersey-version>2.27</jersey-version> <jackson-version>2.10.3</jackson-version> <jackson-databind-version>2.10.3</jackson-databind-version> diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2/pom.xml index e5f142a41463..a872c647cfc3 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2/pom.xml @@ -282,7 +282,7 @@ </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <swagger-annotations-version>1.5.22</swagger-annotations-version> + <swagger-annotations-version>1.6.1</swagger-annotations-version> <jersey-version>2.27</jersey-version> <jackson-version>2.10.3</jackson-version> <jackson-databind-version>2.10.3</jackson-databind-version> diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml index e44571cb5f14..8f1a907787d2 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/api/openapi.yaml @@ -1919,7 +1919,7 @@ components: properties: color: type: string - x-oneOf-name: Fruit + x-one-of-name: Fruit apple: properties: cultivar: @@ -1939,7 +1939,7 @@ components: oneOf: - $ref: '#/components/schemas/whale' - $ref: '#/components/schemas/zebra' - x-oneOf-name: Mammal + x-one-of-name: Mammal whale: properties: hasBaleen: @@ -1975,7 +1975,7 @@ components: oneOf: - $ref: '#/components/schemas/appleReq' - $ref: '#/components/schemas/bananaReq' - x-oneOf-name: FruitReq + x-one-of-name: FruitReq appleReq: properties: cultivar: From 1e01c380e85cb9fe6449528bf75287dbce07f548 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Thu, 23 Apr 2020 22:59:31 -0700 Subject: [PATCH 10/78] [python-experimental] Minor doc update, code comments and exception handling (#5945) * add support for any type, i.e. when 'type' attribute is not specified in OAS schema * fix typos, add code comments * Handle case when 'type' attribute is not present in the OAS schema * fix python formatting rule * fix python formatting rule * remove 'object' as a type --- .../python-experimental/model_utils.mustache | 14 ++++++++------ .../petstore_api/model_utils.py | 14 ++++++++------ .../petstore_api/model_utils.py | 14 ++++++++------ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache index 8b60618c1daf..58da408a19eb 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache @@ -74,7 +74,7 @@ COERCION_INDEX_BY_TYPE = { ModelComposed: 0, ModelNormal: 1, ModelSimple: 2, - none_type: 3, + none_type: 3, # The type of 'None'. list: 4, dict: 5, float: 6, @@ -83,7 +83,7 @@ COERCION_INDEX_BY_TYPE = { datetime: 9, date: 10, str: 11, - file_type: 12, + file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. } # these are used to limit what type conversions we try to do @@ -352,11 +352,11 @@ def order_response_types(required_types): Args: required_types (list/tuple): collection of classes or instance of - list or dict with classs information inside it + list or dict with class information inside it. Returns: (list): coercion order sorted collection of classes or instance - of list or dict with classs information inside it + of list or dict with class information inside it. """ def index_getter(class_or_instance): @@ -373,7 +373,9 @@ def order_response_types(required_types): elif (inspect.isclass(class_or_instance) and issubclass(class_or_instance, ModelSimple)): return COERCION_INDEX_BY_TYPE[ModelSimple] - return COERCION_INDEX_BY_TYPE[class_or_instance] + elif class_or_instance in COERCION_INDEX_BY_TYPE: + return COERCION_INDEX_BY_TYPE[class_or_instance] + raise ApiValueError("Unsupported type: %s" % class_or_instance) sorted_types = sorted( required_types, @@ -391,7 +393,7 @@ def remove_uncoercible(required_types_classes, current_item, from_server, these should be ordered by COERCION_INDEX_BY_TYPE from_server (bool): a boolean of whether the data is from the server if false, the data is from the client - current_item (any): the current item to be converted + current_item (any): the current item (input data) to be converted Keyword Args: must_convert (bool): if True the item to convert is of the wrong diff --git a/samples/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/client/petstore/python-experimental/petstore_api/model_utils.py index 2f6b690424b4..b905f7d347a5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/client/petstore/python-experimental/petstore_api/model_utils.py @@ -336,7 +336,7 @@ def __eq__(self, other): ModelComposed: 0, ModelNormal: 1, ModelSimple: 2, - none_type: 3, + none_type: 3, # The type of 'None'. list: 4, dict: 5, float: 6, @@ -345,7 +345,7 @@ def __eq__(self, other): datetime: 9, date: 10, str: 11, - file_type: 12, + file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. } # these are used to limit what type conversions we try to do @@ -614,11 +614,11 @@ def order_response_types(required_types): Args: required_types (list/tuple): collection of classes or instance of - list or dict with classs information inside it + list or dict with class information inside it. Returns: (list): coercion order sorted collection of classes or instance - of list or dict with classs information inside it + of list or dict with class information inside it. """ def index_getter(class_or_instance): @@ -635,7 +635,9 @@ def index_getter(class_or_instance): elif (inspect.isclass(class_or_instance) and issubclass(class_or_instance, ModelSimple)): return COERCION_INDEX_BY_TYPE[ModelSimple] - return COERCION_INDEX_BY_TYPE[class_or_instance] + elif class_or_instance in COERCION_INDEX_BY_TYPE: + return COERCION_INDEX_BY_TYPE[class_or_instance] + raise ApiValueError("Unsupported type: %s" % class_or_instance) sorted_types = sorted( required_types, @@ -653,7 +655,7 @@ def remove_uncoercible(required_types_classes, current_item, from_server, these should be ordered by COERCION_INDEX_BY_TYPE from_server (bool): a boolean of whether the data is from the server if false, the data is from the client - current_item (any): the current item to be converted + current_item (any): the current item (input data) to be converted Keyword Args: must_convert (bool): if True the item to convert is of the wrong diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py index 2f6b690424b4..b905f7d347a5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py @@ -336,7 +336,7 @@ def __eq__(self, other): ModelComposed: 0, ModelNormal: 1, ModelSimple: 2, - none_type: 3, + none_type: 3, # The type of 'None'. list: 4, dict: 5, float: 6, @@ -345,7 +345,7 @@ def __eq__(self, other): datetime: 9, date: 10, str: 11, - file_type: 12, + file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. } # these are used to limit what type conversions we try to do @@ -614,11 +614,11 @@ def order_response_types(required_types): Args: required_types (list/tuple): collection of classes or instance of - list or dict with classs information inside it + list or dict with class information inside it. Returns: (list): coercion order sorted collection of classes or instance - of list or dict with classs information inside it + of list or dict with class information inside it. """ def index_getter(class_or_instance): @@ -635,7 +635,9 @@ def index_getter(class_or_instance): elif (inspect.isclass(class_or_instance) and issubclass(class_or_instance, ModelSimple)): return COERCION_INDEX_BY_TYPE[ModelSimple] - return COERCION_INDEX_BY_TYPE[class_or_instance] + elif class_or_instance in COERCION_INDEX_BY_TYPE: + return COERCION_INDEX_BY_TYPE[class_or_instance] + raise ApiValueError("Unsupported type: %s" % class_or_instance) sorted_types = sorted( required_types, @@ -653,7 +655,7 @@ def remove_uncoercible(required_types_classes, current_item, from_server, these should be ordered by COERCION_INDEX_BY_TYPE from_server (bool): a boolean of whether the data is from the server if false, the data is from the client - current_item (any): the current item to be converted + current_item (any): the current item (input data) to be converted Keyword Args: must_convert (bool): if True the item to convert is of the wrong From 6ad5e5fb4537ac5acd06266bbbb50adeb8382b2e Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Thu, 23 Apr 2020 23:16:31 -0700 Subject: [PATCH 11/78] [Python experimental] Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info (#6033) * Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info * Add __setattr__ function to ensure signing_info.host is the same as configuration.host when the user assigns signing info --- .../src/main/resources/python/configuration.mustache | 9 +++++++++ .../python-asyncio/petstore_api/configuration.py | 3 +++ .../python-experimental/petstore_api/configuration.py | 3 +++ .../python-tornado/petstore_api/configuration.py | 3 +++ .../client/petstore/python/petstore_api/configuration.py | 3 +++ .../python-experimental/petstore_api/configuration.py | 7 +++++++ .../client/petstore/python/petstore_api/configuration.py | 3 +++ 7 files changed, 31 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache index 6581e603ad52..7fdcd894277e 100644 --- a/modules/openapi-generator/src/main/resources/python/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache @@ -271,6 +271,15 @@ class Configuration(object): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) +{{#hasHttpSignatureMethods}} + if name == "signing_info" and value is not None: + # Ensure the host paramater from signing info is the same as + # Configuration.host. + value.host = self.host +{{/hasHttpSignatureMethods}} + @classmethod def set_default(cls, default): """Set default instance of configuration. diff --git a/samples/client/petstore/python-asyncio/petstore_api/configuration.py b/samples/client/petstore/python-asyncio/petstore_api/configuration.py index 025188fd17d2..ef96f1bc5cd1 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/configuration.py +++ b/samples/client/petstore/python-asyncio/petstore_api/configuration.py @@ -195,6 +195,9 @@ def __deepcopy__(self, memo): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + @classmethod def set_default(cls, default): """Set default instance of configuration. diff --git a/samples/client/petstore/python-experimental/petstore_api/configuration.py b/samples/client/petstore/python-experimental/petstore_api/configuration.py index 03ac961e1d2c..066665d16fc9 100644 --- a/samples/client/petstore/python-experimental/petstore_api/configuration.py +++ b/samples/client/petstore/python-experimental/petstore_api/configuration.py @@ -199,6 +199,9 @@ def __deepcopy__(self, memo): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + @classmethod def set_default(cls, default): """Set default instance of configuration. diff --git a/samples/client/petstore/python-tornado/petstore_api/configuration.py b/samples/client/petstore/python-tornado/petstore_api/configuration.py index 03ac961e1d2c..066665d16fc9 100644 --- a/samples/client/petstore/python-tornado/petstore_api/configuration.py +++ b/samples/client/petstore/python-tornado/petstore_api/configuration.py @@ -199,6 +199,9 @@ def __deepcopy__(self, memo): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + @classmethod def set_default(cls, default): """Set default instance of configuration. diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 03ac961e1d2c..066665d16fc9 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -199,6 +199,9 @@ def __deepcopy__(self, memo): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + @classmethod def set_default(cls, default): """Set default instance of configuration. diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py index d68709a5d813..d885572339ef 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py @@ -246,6 +246,13 @@ def __deepcopy__(self, memo): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + if name == "signing_info" and value is not None: + # Ensure the host paramater from signing info is the same as + # Configuration.host. + value.host = self.host + @classmethod def set_default(cls, default): """Set default instance of configuration. diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py index 994d4c73fbb6..d0d05b11381f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py @@ -199,6 +199,9 @@ def __deepcopy__(self, memo): result.debug = self.debug return result + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + @classmethod def set_default(cls, default): """Set default instance of configuration. From 649daed9a94e2fc79d384f37f0670dc2528e0544 Mon Sep 17 00:00:00 2001 From: sunn <33183834+etherealjoy@users.noreply.github.com> Date: Fri, 24 Apr 2020 14:44:48 +0200 Subject: [PATCH 12/78] Export valid and set status of properties (#6020) --- .../cpp-qt5-client/model-body.mustache | 8 +++ .../cpp-qt5-client/model-header.mustache | 2 + .../model-body.mustache | 8 +++ .../model-header.mustache | 2 + .../cpp-qt5/client/PFXApiResponse.cpp | 24 +++++++ .../petstore/cpp-qt5/client/PFXApiResponse.h | 6 ++ .../petstore/cpp-qt5/client/PFXCategory.cpp | 16 +++++ .../petstore/cpp-qt5/client/PFXCategory.h | 4 ++ .../petstore/cpp-qt5/client/PFXOrder.cpp | 48 ++++++++++++++ .../client/petstore/cpp-qt5/client/PFXOrder.h | 12 ++++ .../client/petstore/cpp-qt5/client/PFXPet.cpp | 48 ++++++++++++++ .../client/petstore/cpp-qt5/client/PFXPet.h | 12 ++++ .../client/petstore/cpp-qt5/client/PFXTag.cpp | 16 +++++ .../client/petstore/cpp-qt5/client/PFXTag.h | 4 ++ .../petstore/cpp-qt5/client/PFXUser.cpp | 64 +++++++++++++++++++ .../client/petstore/cpp-qt5/client/PFXUser.h | 16 +++++ .../server/src/models/OAIApiResponse.cpp | 24 +++++++ .../server/src/models/OAIApiResponse.h | 6 ++ .../server/src/models/OAICategory.cpp | 16 +++++ .../server/src/models/OAICategory.h | 4 ++ .../server/src/models/OAIOrder.cpp | 48 ++++++++++++++ .../server/src/models/OAIOrder.h | 12 ++++ .../server/src/models/OAIPet.cpp | 48 ++++++++++++++ .../server/src/models/OAIPet.h | 12 ++++ .../server/src/models/OAITag.cpp | 16 +++++ .../server/src/models/OAITag.h | 4 ++ .../server/src/models/OAIUser.cpp | 64 +++++++++++++++++++ .../server/src/models/OAIUser.h | 16 +++++ 28 files changed, 560 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache index 05f22ceb8fb9..e48e1597db1f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-body.mustache @@ -120,6 +120,14 @@ void {{classname}}::{{setter}}(const {{{dataType}}} &{{name}}) { this->m_{{name}}_isSet = true; } +bool {{classname}}::is_{{name}}_Set() const{ + return m_{{name}}_isSet; +} + +bool {{classname}}::is_{{name}}_Valid() const{ + return m_{{name}}_isValid; +} + {{/vars}}{{/isEnum}}{{#isEnum}} {{classname}}::e{{classname}} {{classname}}::getValue() const { return m_value; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache index 8f194ac12f9c..5bbe8c8c20e1 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache @@ -35,6 +35,8 @@ public: {{^isEnum}}{{#vars}} {{{dataType}}} {{getter}}() const; void {{setter}}(const {{{dataType}}} &{{name}}); + bool is_{{name}}_Set() const; + bool is_{{name}}_Valid() const; {{/vars}}{{/isEnum}}{{#isEnum}} {{#allowableValues}} enum class e{{classname}} {{#enumVars}}{{#-first}}{{^isString}}: int {{/isString}}{{/-first}}{{/enumVars}}{ diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache index 05f22ceb8fb9..e48e1597db1f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache @@ -120,6 +120,14 @@ void {{classname}}::{{setter}}(const {{{dataType}}} &{{name}}) { this->m_{{name}}_isSet = true; } +bool {{classname}}::is_{{name}}_Set() const{ + return m_{{name}}_isSet; +} + +bool {{classname}}::is_{{name}}_Valid() const{ + return m_{{name}}_isValid; +} + {{/vars}}{{/isEnum}}{{#isEnum}} {{classname}}::e{{classname}} {{classname}}::getValue() const { return m_value; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache index 8f194ac12f9c..5bbe8c8c20e1 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache @@ -35,6 +35,8 @@ public: {{^isEnum}}{{#vars}} {{{dataType}}} {{getter}}() const; void {{setter}}(const {{{dataType}}} &{{name}}); + bool is_{{name}}_Set() const; + bool is_{{name}}_Valid() const; {{/vars}}{{/isEnum}}{{#isEnum}} {{#allowableValues}} enum class e{{classname}} {{#enumVars}}{{#-first}}{{^isString}}: int {{/isString}}{{/-first}}{{/enumVars}}{ diff --git a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp index 48145317854e..f7b652df2787 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.cpp @@ -91,6 +91,14 @@ void PFXApiResponse::setCode(const qint32 &code) { this->m_code_isSet = true; } +bool PFXApiResponse::is_code_Set() const{ + return m_code_isSet; +} + +bool PFXApiResponse::is_code_Valid() const{ + return m_code_isValid; +} + QString PFXApiResponse::getType() const { return type; } @@ -99,6 +107,14 @@ void PFXApiResponse::setType(const QString &type) { this->m_type_isSet = true; } +bool PFXApiResponse::is_type_Set() const{ + return m_type_isSet; +} + +bool PFXApiResponse::is_type_Valid() const{ + return m_type_isValid; +} + QString PFXApiResponse::getMessage() const { return message; } @@ -107,6 +123,14 @@ void PFXApiResponse::setMessage(const QString &message) { this->m_message_isSet = true; } +bool PFXApiResponse::is_message_Set() const{ + return m_message_isSet; +} + +bool PFXApiResponse::is_message_Valid() const{ + return m_message_isValid; +} + bool PFXApiResponse::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h index 9729da2e07b0..e4ba4d4dd08e 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h +++ b/samples/client/petstore/cpp-qt5/client/PFXApiResponse.h @@ -40,12 +40,18 @@ class PFXApiResponse : public PFXObject { qint32 getCode() const; void setCode(const qint32 &code); + bool is_code_Set() const; + bool is_code_Valid() const; QString getType() const; void setType(const QString &type); + bool is_type_Set() const; + bool is_type_Valid() const; QString getMessage() const; void setMessage(const QString &message); + bool is_message_Set() const; + bool is_message_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp b/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp index 887d11c73e80..f39272a12a30 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXCategory.cpp @@ -82,6 +82,14 @@ void PFXCategory::setId(const qint64 &id) { this->m_id_isSet = true; } +bool PFXCategory::is_id_Set() const{ + return m_id_isSet; +} + +bool PFXCategory::is_id_Valid() const{ + return m_id_isValid; +} + QString PFXCategory::getName() const { return name; } @@ -90,6 +98,14 @@ void PFXCategory::setName(const QString &name) { this->m_name_isSet = true; } +bool PFXCategory::is_name_Set() const{ + return m_name_isSet; +} + +bool PFXCategory::is_name_Valid() const{ + return m_name_isValid; +} + bool PFXCategory::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/client/petstore/cpp-qt5/client/PFXCategory.h b/samples/client/petstore/cpp-qt5/client/PFXCategory.h index 84ce65c6269f..544a946b1d9b 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXCategory.h +++ b/samples/client/petstore/cpp-qt5/client/PFXCategory.h @@ -40,9 +40,13 @@ class PFXCategory : public PFXObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; QString getName() const; void setName(const QString &name); + bool is_name_Set() const; + bool is_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp b/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp index b62979c8fefe..ccafb4c74c6f 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXOrder.cpp @@ -118,6 +118,14 @@ void PFXOrder::setId(const qint64 &id) { this->m_id_isSet = true; } +bool PFXOrder::is_id_Set() const{ + return m_id_isSet; +} + +bool PFXOrder::is_id_Valid() const{ + return m_id_isValid; +} + qint64 PFXOrder::getPetId() const { return pet_id; } @@ -126,6 +134,14 @@ void PFXOrder::setPetId(const qint64 &pet_id) { this->m_pet_id_isSet = true; } +bool PFXOrder::is_pet_id_Set() const{ + return m_pet_id_isSet; +} + +bool PFXOrder::is_pet_id_Valid() const{ + return m_pet_id_isValid; +} + qint32 PFXOrder::getQuantity() const { return quantity; } @@ -134,6 +150,14 @@ void PFXOrder::setQuantity(const qint32 &quantity) { this->m_quantity_isSet = true; } +bool PFXOrder::is_quantity_Set() const{ + return m_quantity_isSet; +} + +bool PFXOrder::is_quantity_Valid() const{ + return m_quantity_isValid; +} + QDateTime PFXOrder::getShipDate() const { return ship_date; } @@ -142,6 +166,14 @@ void PFXOrder::setShipDate(const QDateTime &ship_date) { this->m_ship_date_isSet = true; } +bool PFXOrder::is_ship_date_Set() const{ + return m_ship_date_isSet; +} + +bool PFXOrder::is_ship_date_Valid() const{ + return m_ship_date_isValid; +} + QString PFXOrder::getStatus() const { return status; } @@ -150,6 +182,14 @@ void PFXOrder::setStatus(const QString &status) { this->m_status_isSet = true; } +bool PFXOrder::is_status_Set() const{ + return m_status_isSet; +} + +bool PFXOrder::is_status_Valid() const{ + return m_status_isValid; +} + bool PFXOrder::isComplete() const { return complete; } @@ -158,6 +198,14 @@ void PFXOrder::setComplete(const bool &complete) { this->m_complete_isSet = true; } +bool PFXOrder::is_complete_Set() const{ + return m_complete_isSet; +} + +bool PFXOrder::is_complete_Valid() const{ + return m_complete_isValid; +} + bool PFXOrder::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/client/petstore/cpp-qt5/client/PFXOrder.h b/samples/client/petstore/cpp-qt5/client/PFXOrder.h index 1c100268235e..6ff0993304c7 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXOrder.h +++ b/samples/client/petstore/cpp-qt5/client/PFXOrder.h @@ -41,21 +41,33 @@ class PFXOrder : public PFXObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; qint64 getPetId() const; void setPetId(const qint64 &pet_id); + bool is_pet_id_Set() const; + bool is_pet_id_Valid() const; qint32 getQuantity() const; void setQuantity(const qint32 &quantity); + bool is_quantity_Set() const; + bool is_quantity_Valid() const; QDateTime getShipDate() const; void setShipDate(const QDateTime &ship_date); + bool is_ship_date_Set() const; + bool is_ship_date_Valid() const; QString getStatus() const; void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; bool isComplete() const; void setComplete(const bool &complete); + bool is_complete_Set() const; + bool is_complete_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/client/petstore/cpp-qt5/client/PFXPet.cpp b/samples/client/petstore/cpp-qt5/client/PFXPet.cpp index 1f124957497f..0d06a35c39b8 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPet.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPet.cpp @@ -118,6 +118,14 @@ void PFXPet::setId(const qint64 &id) { this->m_id_isSet = true; } +bool PFXPet::is_id_Set() const{ + return m_id_isSet; +} + +bool PFXPet::is_id_Valid() const{ + return m_id_isValid; +} + PFXCategory PFXPet::getCategory() const { return category; } @@ -126,6 +134,14 @@ void PFXPet::setCategory(const PFXCategory &category) { this->m_category_isSet = true; } +bool PFXPet::is_category_Set() const{ + return m_category_isSet; +} + +bool PFXPet::is_category_Valid() const{ + return m_category_isValid; +} + QString PFXPet::getName() const { return name; } @@ -134,6 +150,14 @@ void PFXPet::setName(const QString &name) { this->m_name_isSet = true; } +bool PFXPet::is_name_Set() const{ + return m_name_isSet; +} + +bool PFXPet::is_name_Valid() const{ + return m_name_isValid; +} + QList<QString> PFXPet::getPhotoUrls() const { return photo_urls; } @@ -142,6 +166,14 @@ void PFXPet::setPhotoUrls(const QList<QString> &photo_urls) { this->m_photo_urls_isSet = true; } +bool PFXPet::is_photo_urls_Set() const{ + return m_photo_urls_isSet; +} + +bool PFXPet::is_photo_urls_Valid() const{ + return m_photo_urls_isValid; +} + QList<PFXTag> PFXPet::getTags() const { return tags; } @@ -150,6 +182,14 @@ void PFXPet::setTags(const QList<PFXTag> &tags) { this->m_tags_isSet = true; } +bool PFXPet::is_tags_Set() const{ + return m_tags_isSet; +} + +bool PFXPet::is_tags_Valid() const{ + return m_tags_isValid; +} + QString PFXPet::getStatus() const { return status; } @@ -158,6 +198,14 @@ void PFXPet::setStatus(const QString &status) { this->m_status_isSet = true; } +bool PFXPet::is_status_Set() const{ + return m_status_isSet; +} + +bool PFXPet::is_status_Valid() const{ + return m_status_isValid; +} + bool PFXPet::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/client/petstore/cpp-qt5/client/PFXPet.h b/samples/client/petstore/cpp-qt5/client/PFXPet.h index 4d20e3d8a5d1..b84bfc6d93e9 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPet.h +++ b/samples/client/petstore/cpp-qt5/client/PFXPet.h @@ -43,21 +43,33 @@ class PFXPet : public PFXObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; PFXCategory getCategory() const; void setCategory(const PFXCategory &category); + bool is_category_Set() const; + bool is_category_Valid() const; QString getName() const; void setName(const QString &name); + bool is_name_Set() const; + bool is_name_Valid() const; QList<QString> getPhotoUrls() const; void setPhotoUrls(const QList<QString> &photo_urls); + bool is_photo_urls_Set() const; + bool is_photo_urls_Valid() const; QList<PFXTag> getTags() const; void setTags(const QList<PFXTag> &tags); + bool is_tags_Set() const; + bool is_tags_Valid() const; QString getStatus() const; void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/client/petstore/cpp-qt5/client/PFXTag.cpp b/samples/client/petstore/cpp-qt5/client/PFXTag.cpp index 4a046506c6bc..2f3e76a34ad8 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXTag.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXTag.cpp @@ -82,6 +82,14 @@ void PFXTag::setId(const qint64 &id) { this->m_id_isSet = true; } +bool PFXTag::is_id_Set() const{ + return m_id_isSet; +} + +bool PFXTag::is_id_Valid() const{ + return m_id_isValid; +} + QString PFXTag::getName() const { return name; } @@ -90,6 +98,14 @@ void PFXTag::setName(const QString &name) { this->m_name_isSet = true; } +bool PFXTag::is_name_Set() const{ + return m_name_isSet; +} + +bool PFXTag::is_name_Valid() const{ + return m_name_isValid; +} + bool PFXTag::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/client/petstore/cpp-qt5/client/PFXTag.h b/samples/client/petstore/cpp-qt5/client/PFXTag.h index 6b80e1312ef2..93d8a08b82d9 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXTag.h +++ b/samples/client/petstore/cpp-qt5/client/PFXTag.h @@ -40,9 +40,13 @@ class PFXTag : public PFXObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; QString getName() const; void setName(const QString &name); + bool is_name_Set() const; + bool is_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/client/petstore/cpp-qt5/client/PFXUser.cpp b/samples/client/petstore/cpp-qt5/client/PFXUser.cpp index 3a8e4eef1c77..a3e9c648369b 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUser.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUser.cpp @@ -136,6 +136,14 @@ void PFXUser::setId(const qint64 &id) { this->m_id_isSet = true; } +bool PFXUser::is_id_Set() const{ + return m_id_isSet; +} + +bool PFXUser::is_id_Valid() const{ + return m_id_isValid; +} + QString PFXUser::getUsername() const { return username; } @@ -144,6 +152,14 @@ void PFXUser::setUsername(const QString &username) { this->m_username_isSet = true; } +bool PFXUser::is_username_Set() const{ + return m_username_isSet; +} + +bool PFXUser::is_username_Valid() const{ + return m_username_isValid; +} + QString PFXUser::getFirstName() const { return first_name; } @@ -152,6 +168,14 @@ void PFXUser::setFirstName(const QString &first_name) { this->m_first_name_isSet = true; } +bool PFXUser::is_first_name_Set() const{ + return m_first_name_isSet; +} + +bool PFXUser::is_first_name_Valid() const{ + return m_first_name_isValid; +} + QString PFXUser::getLastName() const { return last_name; } @@ -160,6 +184,14 @@ void PFXUser::setLastName(const QString &last_name) { this->m_last_name_isSet = true; } +bool PFXUser::is_last_name_Set() const{ + return m_last_name_isSet; +} + +bool PFXUser::is_last_name_Valid() const{ + return m_last_name_isValid; +} + QString PFXUser::getEmail() const { return email; } @@ -168,6 +200,14 @@ void PFXUser::setEmail(const QString &email) { this->m_email_isSet = true; } +bool PFXUser::is_email_Set() const{ + return m_email_isSet; +} + +bool PFXUser::is_email_Valid() const{ + return m_email_isValid; +} + QString PFXUser::getPassword() const { return password; } @@ -176,6 +216,14 @@ void PFXUser::setPassword(const QString &password) { this->m_password_isSet = true; } +bool PFXUser::is_password_Set() const{ + return m_password_isSet; +} + +bool PFXUser::is_password_Valid() const{ + return m_password_isValid; +} + QString PFXUser::getPhone() const { return phone; } @@ -184,6 +232,14 @@ void PFXUser::setPhone(const QString &phone) { this->m_phone_isSet = true; } +bool PFXUser::is_phone_Set() const{ + return m_phone_isSet; +} + +bool PFXUser::is_phone_Valid() const{ + return m_phone_isValid; +} + qint32 PFXUser::getUserStatus() const { return user_status; } @@ -192,6 +248,14 @@ void PFXUser::setUserStatus(const qint32 &user_status) { this->m_user_status_isSet = true; } +bool PFXUser::is_user_status_Set() const{ + return m_user_status_isSet; +} + +bool PFXUser::is_user_status_Valid() const{ + return m_user_status_isValid; +} + bool PFXUser::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/client/petstore/cpp-qt5/client/PFXUser.h b/samples/client/petstore/cpp-qt5/client/PFXUser.h index df23a4734c2c..a8ce7f8356a2 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUser.h +++ b/samples/client/petstore/cpp-qt5/client/PFXUser.h @@ -40,27 +40,43 @@ class PFXUser : public PFXObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; QString getUsername() const; void setUsername(const QString &username); + bool is_username_Set() const; + bool is_username_Valid() const; QString getFirstName() const; void setFirstName(const QString &first_name); + bool is_first_name_Set() const; + bool is_first_name_Valid() const; QString getLastName() const; void setLastName(const QString &last_name); + bool is_last_name_Set() const; + bool is_last_name_Valid() const; QString getEmail() const; void setEmail(const QString &email); + bool is_email_Set() const; + bool is_email_Valid() const; QString getPassword() const; void setPassword(const QString &password); + bool is_password_Set() const; + bool is_password_Valid() const; QString getPhone() const; void setPhone(const QString &phone); + bool is_phone_Set() const; + bool is_phone_Valid() const; qint32 getUserStatus() const; void setUserStatus(const qint32 &user_status); + bool is_user_status_Set() const; + bool is_user_status_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp index 1099e88df0eb..4d14b56749cb 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp @@ -91,6 +91,14 @@ void OAIApiResponse::setCode(const qint32 &code) { this->m_code_isSet = true; } +bool OAIApiResponse::is_code_Set() const{ + return m_code_isSet; +} + +bool OAIApiResponse::is_code_Valid() const{ + return m_code_isValid; +} + QString OAIApiResponse::getType() const { return type; } @@ -99,6 +107,14 @@ void OAIApiResponse::setType(const QString &type) { this->m_type_isSet = true; } +bool OAIApiResponse::is_type_Set() const{ + return m_type_isSet; +} + +bool OAIApiResponse::is_type_Valid() const{ + return m_type_isValid; +} + QString OAIApiResponse::getMessage() const { return message; } @@ -107,6 +123,14 @@ void OAIApiResponse::setMessage(const QString &message) { this->m_message_isSet = true; } +bool OAIApiResponse::is_message_Set() const{ + return m_message_isSet; +} + +bool OAIApiResponse::is_message_Valid() const{ + return m_message_isValid; +} + bool OAIApiResponse::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h index 1dc044d47d61..f24fb1acba6c 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h @@ -40,12 +40,18 @@ class OAIApiResponse : public OAIObject { qint32 getCode() const; void setCode(const qint32 &code); + bool is_code_Set() const; + bool is_code_Valid() const; QString getType() const; void setType(const QString &type); + bool is_type_Set() const; + bool is_type_Valid() const; QString getMessage() const; void setMessage(const QString &message); + bool is_message_Set() const; + bool is_message_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp index 1945693f1533..40876b885449 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp @@ -82,6 +82,14 @@ void OAICategory::setId(const qint64 &id) { this->m_id_isSet = true; } +bool OAICategory::is_id_Set() const{ + return m_id_isSet; +} + +bool OAICategory::is_id_Valid() const{ + return m_id_isValid; +} + QString OAICategory::getName() const { return name; } @@ -90,6 +98,14 @@ void OAICategory::setName(const QString &name) { this->m_name_isSet = true; } +bool OAICategory::is_name_Set() const{ + return m_name_isSet; +} + +bool OAICategory::is_name_Valid() const{ + return m_name_isValid; +} + bool OAICategory::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h index e091b32946d2..8cda3322adcc 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h @@ -40,9 +40,13 @@ class OAICategory : public OAIObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; QString getName() const; void setName(const QString &name); + bool is_name_Set() const; + bool is_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp index 296e9589d05d..28536d66f27b 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp @@ -118,6 +118,14 @@ void OAIOrder::setId(const qint64 &id) { this->m_id_isSet = true; } +bool OAIOrder::is_id_Set() const{ + return m_id_isSet; +} + +bool OAIOrder::is_id_Valid() const{ + return m_id_isValid; +} + qint64 OAIOrder::getPetId() const { return pet_id; } @@ -126,6 +134,14 @@ void OAIOrder::setPetId(const qint64 &pet_id) { this->m_pet_id_isSet = true; } +bool OAIOrder::is_pet_id_Set() const{ + return m_pet_id_isSet; +} + +bool OAIOrder::is_pet_id_Valid() const{ + return m_pet_id_isValid; +} + qint32 OAIOrder::getQuantity() const { return quantity; } @@ -134,6 +150,14 @@ void OAIOrder::setQuantity(const qint32 &quantity) { this->m_quantity_isSet = true; } +bool OAIOrder::is_quantity_Set() const{ + return m_quantity_isSet; +} + +bool OAIOrder::is_quantity_Valid() const{ + return m_quantity_isValid; +} + QDateTime OAIOrder::getShipDate() const { return ship_date; } @@ -142,6 +166,14 @@ void OAIOrder::setShipDate(const QDateTime &ship_date) { this->m_ship_date_isSet = true; } +bool OAIOrder::is_ship_date_Set() const{ + return m_ship_date_isSet; +} + +bool OAIOrder::is_ship_date_Valid() const{ + return m_ship_date_isValid; +} + QString OAIOrder::getStatus() const { return status; } @@ -150,6 +182,14 @@ void OAIOrder::setStatus(const QString &status) { this->m_status_isSet = true; } +bool OAIOrder::is_status_Set() const{ + return m_status_isSet; +} + +bool OAIOrder::is_status_Valid() const{ + return m_status_isValid; +} + bool OAIOrder::isComplete() const { return complete; } @@ -158,6 +198,14 @@ void OAIOrder::setComplete(const bool &complete) { this->m_complete_isSet = true; } +bool OAIOrder::is_complete_Set() const{ + return m_complete_isSet; +} + +bool OAIOrder::is_complete_Valid() const{ + return m_complete_isValid; +} + bool OAIOrder::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h index 983c947855ce..0812753b8f19 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h @@ -41,21 +41,33 @@ class OAIOrder : public OAIObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; qint64 getPetId() const; void setPetId(const qint64 &pet_id); + bool is_pet_id_Set() const; + bool is_pet_id_Valid() const; qint32 getQuantity() const; void setQuantity(const qint32 &quantity); + bool is_quantity_Set() const; + bool is_quantity_Valid() const; QDateTime getShipDate() const; void setShipDate(const QDateTime &ship_date); + bool is_ship_date_Set() const; + bool is_ship_date_Valid() const; QString getStatus() const; void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; bool isComplete() const; void setComplete(const bool &complete); + bool is_complete_Set() const; + bool is_complete_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp index 9c3fca7c83b1..41535649f831 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp @@ -118,6 +118,14 @@ void OAIPet::setId(const qint64 &id) { this->m_id_isSet = true; } +bool OAIPet::is_id_Set() const{ + return m_id_isSet; +} + +bool OAIPet::is_id_Valid() const{ + return m_id_isValid; +} + OAICategory OAIPet::getCategory() const { return category; } @@ -126,6 +134,14 @@ void OAIPet::setCategory(const OAICategory &category) { this->m_category_isSet = true; } +bool OAIPet::is_category_Set() const{ + return m_category_isSet; +} + +bool OAIPet::is_category_Valid() const{ + return m_category_isValid; +} + QString OAIPet::getName() const { return name; } @@ -134,6 +150,14 @@ void OAIPet::setName(const QString &name) { this->m_name_isSet = true; } +bool OAIPet::is_name_Set() const{ + return m_name_isSet; +} + +bool OAIPet::is_name_Valid() const{ + return m_name_isValid; +} + QList<QString> OAIPet::getPhotoUrls() const { return photo_urls; } @@ -142,6 +166,14 @@ void OAIPet::setPhotoUrls(const QList<QString> &photo_urls) { this->m_photo_urls_isSet = true; } +bool OAIPet::is_photo_urls_Set() const{ + return m_photo_urls_isSet; +} + +bool OAIPet::is_photo_urls_Valid() const{ + return m_photo_urls_isValid; +} + QList<OAITag> OAIPet::getTags() const { return tags; } @@ -150,6 +182,14 @@ void OAIPet::setTags(const QList<OAITag> &tags) { this->m_tags_isSet = true; } +bool OAIPet::is_tags_Set() const{ + return m_tags_isSet; +} + +bool OAIPet::is_tags_Valid() const{ + return m_tags_isValid; +} + QString OAIPet::getStatus() const { return status; } @@ -158,6 +198,14 @@ void OAIPet::setStatus(const QString &status) { this->m_status_isSet = true; } +bool OAIPet::is_status_Set() const{ + return m_status_isSet; +} + +bool OAIPet::is_status_Valid() const{ + return m_status_isValid; +} + bool OAIPet::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h index 73d40aed2860..688d824c892a 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h @@ -43,21 +43,33 @@ class OAIPet : public OAIObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; OAICategory getCategory() const; void setCategory(const OAICategory &category); + bool is_category_Set() const; + bool is_category_Valid() const; QString getName() const; void setName(const QString &name); + bool is_name_Set() const; + bool is_name_Valid() const; QList<QString> getPhotoUrls() const; void setPhotoUrls(const QList<QString> &photo_urls); + bool is_photo_urls_Set() const; + bool is_photo_urls_Valid() const; QList<OAITag> getTags() const; void setTags(const QList<OAITag> &tags); + bool is_tags_Set() const; + bool is_tags_Valid() const; QString getStatus() const; void setStatus(const QString &status); + bool is_status_Set() const; + bool is_status_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp index 636bda52af6c..44444ed4369a 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp @@ -82,6 +82,14 @@ void OAITag::setId(const qint64 &id) { this->m_id_isSet = true; } +bool OAITag::is_id_Set() const{ + return m_id_isSet; +} + +bool OAITag::is_id_Valid() const{ + return m_id_isValid; +} + QString OAITag::getName() const { return name; } @@ -90,6 +98,14 @@ void OAITag::setName(const QString &name) { this->m_name_isSet = true; } +bool OAITag::is_name_Set() const{ + return m_name_isSet; +} + +bool OAITag::is_name_Valid() const{ + return m_name_isValid; +} + bool OAITag::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h index aa7c60078047..daef5db28530 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h @@ -40,9 +40,13 @@ class OAITag : public OAIObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; QString getName() const; void setName(const QString &name); + bool is_name_Set() const; + bool is_name_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp index a20a60929deb..b039d4fc1240 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp @@ -136,6 +136,14 @@ void OAIUser::setId(const qint64 &id) { this->m_id_isSet = true; } +bool OAIUser::is_id_Set() const{ + return m_id_isSet; +} + +bool OAIUser::is_id_Valid() const{ + return m_id_isValid; +} + QString OAIUser::getUsername() const { return username; } @@ -144,6 +152,14 @@ void OAIUser::setUsername(const QString &username) { this->m_username_isSet = true; } +bool OAIUser::is_username_Set() const{ + return m_username_isSet; +} + +bool OAIUser::is_username_Valid() const{ + return m_username_isValid; +} + QString OAIUser::getFirstName() const { return first_name; } @@ -152,6 +168,14 @@ void OAIUser::setFirstName(const QString &first_name) { this->m_first_name_isSet = true; } +bool OAIUser::is_first_name_Set() const{ + return m_first_name_isSet; +} + +bool OAIUser::is_first_name_Valid() const{ + return m_first_name_isValid; +} + QString OAIUser::getLastName() const { return last_name; } @@ -160,6 +184,14 @@ void OAIUser::setLastName(const QString &last_name) { this->m_last_name_isSet = true; } +bool OAIUser::is_last_name_Set() const{ + return m_last_name_isSet; +} + +bool OAIUser::is_last_name_Valid() const{ + return m_last_name_isValid; +} + QString OAIUser::getEmail() const { return email; } @@ -168,6 +200,14 @@ void OAIUser::setEmail(const QString &email) { this->m_email_isSet = true; } +bool OAIUser::is_email_Set() const{ + return m_email_isSet; +} + +bool OAIUser::is_email_Valid() const{ + return m_email_isValid; +} + QString OAIUser::getPassword() const { return password; } @@ -176,6 +216,14 @@ void OAIUser::setPassword(const QString &password) { this->m_password_isSet = true; } +bool OAIUser::is_password_Set() const{ + return m_password_isSet; +} + +bool OAIUser::is_password_Valid() const{ + return m_password_isValid; +} + QString OAIUser::getPhone() const { return phone; } @@ -184,6 +232,14 @@ void OAIUser::setPhone(const QString &phone) { this->m_phone_isSet = true; } +bool OAIUser::is_phone_Set() const{ + return m_phone_isSet; +} + +bool OAIUser::is_phone_Valid() const{ + return m_phone_isValid; +} + qint32 OAIUser::getUserStatus() const { return user_status; } @@ -192,6 +248,14 @@ void OAIUser::setUserStatus(const qint32 &user_status) { this->m_user_status_isSet = true; } +bool OAIUser::is_user_status_Set() const{ + return m_user_status_isSet; +} + +bool OAIUser::is_user_status_Valid() const{ + return m_user_status_isValid; +} + bool OAIUser::isSet() const { bool isObjectUpdated = false; do { diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h index fee30755c250..7508a79d1daa 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h @@ -40,27 +40,43 @@ class OAIUser : public OAIObject { qint64 getId() const; void setId(const qint64 &id); + bool is_id_Set() const; + bool is_id_Valid() const; QString getUsername() const; void setUsername(const QString &username); + bool is_username_Set() const; + bool is_username_Valid() const; QString getFirstName() const; void setFirstName(const QString &first_name); + bool is_first_name_Set() const; + bool is_first_name_Valid() const; QString getLastName() const; void setLastName(const QString &last_name); + bool is_last_name_Set() const; + bool is_last_name_Valid() const; QString getEmail() const; void setEmail(const QString &email); + bool is_email_Set() const; + bool is_email_Valid() const; QString getPassword() const; void setPassword(const QString &password); + bool is_password_Set() const; + bool is_password_Valid() const; QString getPhone() const; void setPhone(const QString &phone); + bool is_phone_Set() const; + bool is_phone_Valid() const; qint32 getUserStatus() const; void setUserStatus(const qint32 &user_status); + bool is_user_status_Set() const; + bool is_user_status_Valid() const; virtual bool isSet() const override; virtual bool isValid() const override; From 234053fed9885ea00d2f20d61117d94914154c1f Mon Sep 17 00:00:00 2001 From: sunn <33183834+etherealjoy@users.noreply.github.com> Date: Fri, 24 Apr 2020 14:46:25 +0200 Subject: [PATCH 13/78] Export response code to worker (#6021) --- .../cpp-qt5-client/HttpRequest.cpp.mustache | 13 ++++++++++++- .../resources/cpp-qt5-client/HttpRequest.h.mustache | 12 +++++++++--- .../petstore/cpp-qt5/client/PFXHttpRequest.cpp | 13 ++++++++++++- .../client/petstore/cpp-qt5/client/PFXHttpRequest.h | 12 +++++++++--- 4 files changed, 42 insertions(+), 8 deletions(-) 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 b75d14275a98..6ec3d67bcae3 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 @@ -45,7 +45,7 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f } {{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent) - : QObject(parent), manager(nullptr), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false) { + : QObject(parent), manager(nullptr), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { qsrand(QDateTime::currentDateTime().toTime_t()); manager = new QNetworkAccessManager(this); workingDirectory = QDir::currentPath(); @@ -110,6 +110,10 @@ void {{prefix}}HttpRequestWorker::setRequestCompressionEnabled(bool enable) { isRequestCompressionEnabled = enable; } +int {{prefix}}HttpRequestWorker::getHttpResponseCode() const{ + return httpResponseCode; +} + QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; @@ -360,6 +364,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { } void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { + bool codeSts = false; if(timeOutTimer.isActive()) { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); timeOutTimer.stop(); @@ -371,6 +376,12 @@ void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { headers.insert(item.first, item.second); } } + auto rescode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&codeSts); + if(codeSts){ + httpResponseCode = rescode; + } else{ + httpResponseCode = -1; + } process_response(reply); reply->deleteLater(); emit on_execution_finished(this); 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 247f5906841a..efd352568855 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 @@ -50,11 +50,12 @@ class {{prefix}}HttpRequestWorker : public QObject { Q_OBJECT public: + explicit {{prefix}}HttpRequestWorker(QObject *parent = nullptr); + virtual ~{{prefix}}HttpRequestWorker(); + QByteArray response; QNetworkReply::NetworkError error_type; QString error_str; - explicit {{prefix}}HttpRequestWorker(QObject *parent = nullptr); - virtual ~{{prefix}}HttpRequestWorker(); QMap<QString, QString> getResponseHeaders() const; QString http_attribute_encode(QString attribute_name, QString input); @@ -66,6 +67,8 @@ public: QByteArray *getMultiPartField(const QString &fieldname = QString()); void setResponseCompressionEnabled(bool enable); void setRequestCompressionEnabled(bool enable); + int getHttpResponseCode() const; + signals: void on_execution_finished({{prefix}}HttpRequestWorker *worker); @@ -82,10 +85,13 @@ private: QTimer timeOutTimer; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; + int httpResponseCode; + void on_manager_timeout(QNetworkReply *reply); void process_response(QNetworkReply *reply); QByteArray decompress(const QByteArray& data); - QByteArray compress(const QByteArray& input, int level, {{prefix}}CompressionType compressType); + QByteArray compress(const QByteArray& input, int level, {{prefix}}CompressionType compressType); + private slots: void on_manager_finished(QNetworkReply *reply); }; diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp index ce71caf6a68d..746bd57086f6 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp @@ -52,7 +52,7 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename } PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent) - : QObject(parent), manager(nullptr), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false) { + : QObject(parent), manager(nullptr), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { qsrand(QDateTime::currentDateTime().toTime_t()); manager = new QNetworkAccessManager(this); workingDirectory = QDir::currentPath(); @@ -117,6 +117,10 @@ void PFXHttpRequestWorker::setRequestCompressionEnabled(bool enable) { isRequestCompressionEnabled = enable; } +int PFXHttpRequestWorker::getHttpResponseCode() const{ + return httpResponseCode; +} + QString PFXHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; @@ -367,6 +371,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { } void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { + bool codeSts = false; if(timeOutTimer.isActive()) { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); timeOutTimer.stop(); @@ -378,6 +383,12 @@ void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { headers.insert(item.first, item.second); } } + auto rescode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(&codeSts); + if(codeSts){ + httpResponseCode = rescode; + } else{ + httpResponseCode = -1; + } process_response(reply); reply->deleteLater(); emit on_execution_finished(this); diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h index acbb0a8d01ad..aa5743be304c 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h @@ -58,11 +58,12 @@ class PFXHttpRequestWorker : public QObject { Q_OBJECT public: + explicit PFXHttpRequestWorker(QObject *parent = nullptr); + virtual ~PFXHttpRequestWorker(); + QByteArray response; QNetworkReply::NetworkError error_type; QString error_str; - explicit PFXHttpRequestWorker(QObject *parent = nullptr); - virtual ~PFXHttpRequestWorker(); QMap<QString, QString> getResponseHeaders() const; QString http_attribute_encode(QString attribute_name, QString input); @@ -74,6 +75,8 @@ class PFXHttpRequestWorker : public QObject { QByteArray *getMultiPartField(const QString &fieldname = QString()); void setResponseCompressionEnabled(bool enable); void setRequestCompressionEnabled(bool enable); + int getHttpResponseCode() const; + signals: void on_execution_finished(PFXHttpRequestWorker *worker); @@ -90,10 +93,13 @@ class PFXHttpRequestWorker : public QObject { QTimer timeOutTimer; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; + int httpResponseCode; + void on_manager_timeout(QNetworkReply *reply); void process_response(QNetworkReply *reply); QByteArray decompress(const QByteArray& data); - QByteArray compress(const QByteArray& input, int level, PFXCompressionType compressType); + QByteArray compress(const QByteArray& input, int level, PFXCompressionType compressType); + private slots: void on_manager_finished(QNetworkReply *reply); }; From 45bbe4922b7a8370988b1291d6a68384a88dde5a Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 24 Apr 2020 23:41:42 +0800 Subject: [PATCH 14/78] Add test for allOf without object type (#6042) * add test for allof without object type * add comments to test cases --- .../org/openapitools/codegen/DefaultCodegenTest.java | 8 ++++++++ .../src/test/resources/3_0/allOf_composition.yaml | 10 ++++++++++ 2 files changed, 18 insertions(+) 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 93ddc121dfa7..28fff725bb8a 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 @@ -611,15 +611,23 @@ public void testAllOfSingleAndDoubleRefWithOwnPropsNoDiscriminator() { codegen.setOpenAPI(openAPI); + // to test allOf with double refs Schema supermanSchema = openAPI.getComponents().getSchemas().get("SuperMan"); CodegenModel supermanModel = codegen.fromModel("SuperMan", supermanSchema); Assert.assertEquals(supermanModel.parent, null); Assert.assertEquals(supermanModel.allParents, null); + // to test allOf with single ref Schema superboySchema = openAPI.getComponents().getSchemas().get("SuperBoy"); CodegenModel superboyModel = codegen.fromModel("SuperBoy", superboySchema); Assert.assertEquals(superboyModel.parent, null); Assert.assertEquals(superboyModel.allParents, null); + + // to test allOf with single ref and no "type: object" in the (last) inline schema + Schema superbabySchema = openAPI.getComponents().getSchemas().get("SuperBaby"); + CodegenModel superbabyModel = codegen.fromModel("SuperBaby", superbabySchema); + Assert.assertEquals(superbabyModel.parent, null); + Assert.assertEquals(superbabyModel.allParents, null); } @Test diff --git a/modules/openapi-generator/src/test/resources/3_0/allOf_composition.yaml b/modules/openapi-generator/src/test/resources/3_0/allOf_composition.yaml index 89f132c1ef2f..3b2c6a1be5d6 100644 --- a/modules/openapi-generator/src/test/resources/3_0/allOf_composition.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/allOf_composition.yaml @@ -26,6 +26,16 @@ paths: $ref: "#/components/schemas/SuperMan" components: schemas: + SuperBaby: # to test single ref (Human) only + allOf: + - $ref: '#/components/schemas/Human' + - required: # without type: object + - level + properties: + gender: + type: string + age: + type: integer SuperBoy: # to test single ref (Human) only allOf: - $ref: '#/components/schemas/Human' From 8e8471c1fd6a25b032dcf3ba43968777d59b7322 Mon Sep 17 00:00:00 2001 From: Justin Black <spacether@users.noreply.github.com> Date: Fri, 24 Apr 2020 09:01:02 -0700 Subject: [PATCH 15/78] [CORE] Fixes composed schema discriminator map (#4906) * Adds addComposedMappedModels and testComposedSchemaOneOfDiscriminatorMap * Requires that discriminators be required properties * Strengthens discriminaotr validation, adds better error messages, adds schema oneof samples * Adds oneOf and anyOf invalidDiscriminator tests * Updates incorrect addOneOfInterfaceModel invocation * Runs ensure-up-to-date * Adds updates from Sebastien Rosset * Removes newlines * Uses df.isString * Fixes tests be correctly setting df.isString * Updates discriminatorExplicitMappingVerbose description per PR feedback * Adds description of how mappedModels is populated * Adds the suggestion exception raising when a MappedModel mappingName is null * Actually resolves merge conflicts * Switches two methods to package private because they are needed for testing * Allow nulls in MappedModel.getMappingName * Updates CLI flag name to legacyDiscriminatorBehavior, default=true Co-authored-by: William Cheng <wing328hk@gmail.com> --- docs/generators/ada-server.md | 10 + docs/generators/ada.md | 10 + docs/generators/android.md | 10 + docs/generators/apache2.md | 10 + docs/generators/apex.md | 10 + docs/generators/asciidoc.md | 10 + docs/generators/avro-schema.md | 10 + docs/generators/bash.md | 10 + docs/generators/c.md | 10 + docs/generators/clojure.md | 10 + docs/generators/cpp-qt5-client.md | 10 + docs/generators/cpp-qt5-qhttpengine-server.md | 10 + docs/generators/cpp-tizen.md | 10 + docs/generators/cwiki.md | 10 + docs/generators/dart-dio.md | 10 + docs/generators/dart-jaguar.md | 10 + docs/generators/dart.md | 10 + docs/generators/dynamic-html.md | 10 + docs/generators/elixir.md | 10 + docs/generators/fsharp-functions.md | 10 + docs/generators/groovy.md | 10 + docs/generators/haskell-http-client.md | 10 + docs/generators/haskell.md | 10 + docs/generators/html.md | 10 + docs/generators/html2.md | 10 + docs/generators/java-inflector.md | 10 + docs/generators/java-msf4j.md | 10 + docs/generators/java-pkmst.md | 10 + docs/generators/java-play-framework.md | 10 + docs/generators/java-undertow-server.md | 10 + docs/generators/java-vertx-web.md | 10 + docs/generators/java-vertx.md | 10 + docs/generators/java.md | 10 + docs/generators/javascript-apollo.md | 10 + docs/generators/javascript-closure-angular.md | 10 + docs/generators/javascript-flowtyped.md | 10 + docs/generators/javascript.md | 10 + docs/generators/jaxrs-cxf-cdi.md | 10 + docs/generators/jaxrs-cxf-client.md | 10 + docs/generators/jaxrs-cxf-extended.md | 10 + docs/generators/jaxrs-cxf.md | 10 + docs/generators/jaxrs-jersey.md | 10 + docs/generators/jaxrs-resteasy-eap.md | 10 + docs/generators/jaxrs-resteasy.md | 10 + docs/generators/jaxrs-spec.md | 10 + docs/generators/jmeter.md | 10 + docs/generators/k6.md | 10 + docs/generators/markdown.md | 10 + docs/generators/nim.md | 10 + docs/generators/nodejs-express-server.md | 10 + docs/generators/nodejs-server-deprecated.md | 10 + docs/generators/ocaml.md | 10 + docs/generators/openapi-yaml.md | 10 + docs/generators/openapi.md | 10 + docs/generators/php-laravel.md | 10 + docs/generators/php-lumen.md | 10 + docs/generators/php-silex.md | 10 + docs/generators/php-slim-deprecated.md | 10 + docs/generators/php-slim4.md | 10 + docs/generators/php-symfony.md | 10 + docs/generators/php-ze-ph.md | 10 + docs/generators/php.md | 10 + docs/generators/python-aiohttp.md | 10 + docs/generators/python-blueplanet.md | 10 + docs/generators/python-flask.md | 10 + docs/generators/ruby.md | 10 + docs/generators/scala-akka-http-server.md | 10 + docs/generators/scala-akka.md | 10 + docs/generators/scala-gatling.md | 10 + .../generators/scala-httpclient-deprecated.md | 10 + docs/generators/scala-lagom-server.md | 10 + docs/generators/scala-play-server.md | 10 + docs/generators/scala-sttp.md | 10 + docs/generators/scalatra.md | 10 + docs/generators/scalaz.md | 10 + docs/generators/spring.md | 10 + docs/generators/swift2-deprecated.md | 10 + docs/generators/swift3-deprecated.md | 10 + docs/generators/swift4.md | 10 + docs/generators/swift5.md | 10 + docs/generators/typescript-angular.md | 10 + docs/generators/typescript-angularjs.md | 10 + docs/generators/typescript-aurelia.md | 10 + docs/generators/typescript-axios.md | 10 + docs/generators/typescript-fetch.md | 10 + docs/generators/typescript-inversify.md | 10 + docs/generators/typescript-jquery.md | 10 + docs/generators/typescript-node.md | 10 + docs/generators/typescript-redux-query.md | 10 + docs/generators/typescript-rxjs.md | 10 + .../openapitools/codegen/cmd/Generate.java | 3 + .../codegen/CodegenConstants.java | 13 + .../codegen/CodegenDiscriminator.java | 56 +- .../openapitools/codegen/CodegenModel.java | 11 + .../openapitools/codegen/CodegenProperty.java | 5 +- .../openapitools/codegen/DefaultCodegen.java | 387 +++++++++++- .../codegen/DefaultGenerator.java | 4 +- .../GoClientExperimentalCodegen.java | 1 + .../PythonClientExperimentalCodegen.java | 2 + .../src/main/resources/Java/pojo.mustache | 2 +- .../main/resources/python/api_client.mustache | 9 +- .../src/main/resources/python/model.mustache | 5 +- .../model_templates/classvars.mustache | 16 +- .../codegen/DefaultCodegenTest.java | 578 +++++++++++++++++- .../options/BashClientOptionsProvider.java | 1 + .../options/DartClientOptionsProvider.java | 1 + .../options/DartDioClientOptionsProvider.java | 1 + .../options/ElixirClientOptionsProvider.java | 1 + .../HaskellServantOptionsProvider.java | 1 + .../options/PhpClientOptionsProvider.java | 1 + .../PhpLumenServerOptionsProvider.java | 1 + .../PhpSilexServerOptionsProvider.java | 1 + .../PhpSlim4ServerOptionsProvider.java | 1 + .../options/PhpSlimServerOptionsProvider.java | 1 + .../options/RubyClientOptionsProvider.java | 1 + .../ScalaAkkaClientOptionsProvider.java | 1 + .../ScalaHttpClientOptionsProvider.java | 1 + .../options/Swift3OptionsProvider.java | 1 + .../options/Swift4OptionsProvider.java | 1 + .../options/Swift5OptionsProvider.java | 1 + ...ypeScriptAngularClientOptionsProvider.java | 1 + ...eScriptAngularJsClientOptionsProvider.java | 1 + ...ypeScriptAureliaClientOptionsProvider.java | 1 + .../TypeScriptFetchClientOptionsProvider.java | 1 + .../TypeScriptNodeClientOptionsProvider.java | 1 + .../codegen/ruby/RubyClientCodegenTest.java | 28 +- ...ith-fake-endpoints-models-for-testing.yaml | 3 +- .../resources/2_0/x-discriminator-value.yaml | 66 ++ .../3_0/allOf_composition_discriminator.yaml | 103 ++++ .../resources/3_0/anyOfDiscriminator.yaml | 244 ++++++++ .../resources/3_0/oneOfDiscriminator.yaml | 268 ++++++++ .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../org/openapitools/client/model/Animal.java | 2 +- .../python-asyncio/petstore_api/api_client.py | 9 +- .../petstore_api/models/animal.py | 11 +- .../petstore_api/models/cat.py | 19 +- .../petstore_api/models/child_cat.py | 19 +- .../petstore_api/models/child_dog.py | 19 +- .../petstore_api/models/child_lizard.py | 19 +- .../petstore_api/models/dog.py | 19 +- .../petstore_api/models/grandparent_animal.py | 43 +- .../petstore_api/models/parent_pet.py | 13 +- .../python-tornado/petstore_api/api_client.py | 9 +- .../python/petstore_api/api_client.py | 9 +- .../petstore_api/models/animal.py | 11 +- .../petstore_api/models/cat.py | 19 +- .../petstore_api/models/dog.py | 19 +- .../petstore_api/models/mammal.py | 11 +- .../python/petstore_api/api_client.py | 9 +- 171 files changed, 2905 insertions(+), 126 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/2_0/x-discriminator-value.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/allOf_composition_discriminator.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/anyOfDiscriminator.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/oneOfDiscriminator.yaml diff --git a/docs/generators/ada-server.md b/docs/generators/ada-server.md index 9a86032ec7e6..7f804ddf0dff 100644 --- a/docs/generators/ada-server.md +++ b/docs/generators/ada-server.md @@ -7,6 +7,16 @@ sidebar_label: ada-server | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|GNAT project name| |defaultProject| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/ada.md b/docs/generators/ada.md index 2b382b4c4fc2..c5d73461dc2a 100644 --- a/docs/generators/ada.md +++ b/docs/generators/ada.md @@ -7,6 +7,16 @@ sidebar_label: ada | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|GNAT project name| |defaultProject| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/android.md b/docs/generators/android.md index 4eeeec214b62..430500d9e6a4 100644 --- a/docs/generators/android.md +++ b/docs/generators/android.md @@ -15,6 +15,16 @@ sidebar_label: android |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |groupId|groupId for use in the generated build.gradle and pom.xml| |null| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template) to use|<dl><dt>**volley**</dt><dd>HTTP client: Volley 1.0.19 (default)</dd><dt>**httpclient**</dt><dd>HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1. IMPORTANT: Android client using HttpClient is not actively maintained and will be depecreated in the next major release.</dd></dl>|null| |modelPackage|package for generated models| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/apache2.md b/docs/generators/apache2.md index cfa9756c7d58..8b92e02dd19f 100644 --- a/docs/generators/apache2.md +++ b/docs/generators/apache2.md @@ -7,6 +7,16 @@ sidebar_label: apache2 | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/apex.md b/docs/generators/apex.md index 06c54e3b9722..80ac5bd24fba 100644 --- a/docs/generators/apex.md +++ b/docs/generators/apex.md @@ -10,6 +10,16 @@ sidebar_label: apex |buildMethod|The build method for this package.| |null| |classPrefix|Prefix for generated classes. Set this to avoid overwriting existing classes in your org.| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |namedCredential|The named credential name for the HTTP callouts| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/asciidoc.md b/docs/generators/asciidoc.md index 66a175518bc9..777a62080c7b 100644 --- a/docs/generators/asciidoc.md +++ b/docs/generators/asciidoc.md @@ -16,6 +16,16 @@ sidebar_label: asciidoc |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/avro-schema.md b/docs/generators/avro-schema.md index 13ca849949a9..6f0621b74774 100644 --- a/docs/generators/avro-schema.md +++ b/docs/generators/avro-schema.md @@ -7,6 +7,16 @@ sidebar_label: avro-schema | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |packageName|package for generated classes (where supported)| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/bash.md b/docs/generators/bash.md index b91eb990a6d9..3d626eff7209 100644 --- a/docs/generators/bash.md +++ b/docs/generators/bash.md @@ -13,6 +13,16 @@ sidebar_label: bash |generateBashCompletion|Whether to generate the Bash completion script| |false| |generateZshCompletion|Whether to generate the Zsh completion script| |false| |hostEnvironmentVariable|Name of environment variable where host can be defined (e.g. PETSTORE_HOST='http://api.openapitools.org:8080')| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |processMarkdown|Convert all Markdown Markup into terminal formatting| |false| |scriptName|The name of the script that will be generated (e.g. petstore-cli)| |null| diff --git a/docs/generators/c.md b/docs/generators/c.md index ee9b2586696e..8ebc3221faee 100644 --- a/docs/generators/c.md +++ b/docs/generators/c.md @@ -8,6 +8,16 @@ sidebar_label: c |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/clojure.md b/docs/generators/clojure.md index b2f3a6a4d912..e42936d9f86c 100644 --- a/docs/generators/clojure.md +++ b/docs/generators/clojure.md @@ -8,6 +8,16 @@ sidebar_label: clojure |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |baseNamespace|the base/top namespace (Default: generated from projectName)| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectDescription|description of the project (Default: using info.description or "Client library of <projectName>")| |null| |projectLicenseName|name of the license the project uses (Default: using info.license.name or not included in project.clj)| |null| diff --git a/docs/generators/cpp-qt5-client.md b/docs/generators/cpp-qt5-client.md index bc55db14523d..9a043e53237e 100644 --- a/docs/generators/cpp-qt5-client.md +++ b/docs/generators/cpp-qt5-client.md @@ -9,6 +9,16 @@ sidebar_label: cpp-qt5-client |contentCompression|Enable Compressed Content Encoding for requests and responses| |false| |cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelNamePrefix|Prefix that will be prepended to all model names.| |OAI| |optionalProjectFile|Generate client.pri.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/cpp-qt5-qhttpengine-server.md b/docs/generators/cpp-qt5-qhttpengine-server.md index 2b2cd4e9f15f..574a019f13be 100644 --- a/docs/generators/cpp-qt5-qhttpengine-server.md +++ b/docs/generators/cpp-qt5-qhttpengine-server.md @@ -9,6 +9,16 @@ sidebar_label: cpp-qt5-qhttpengine-server |contentCompression|Enable Compressed Content Encoding for requests and responses| |false| |cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelNamePrefix|Prefix that will be prepended to all model names.| |OAI| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| diff --git a/docs/generators/cpp-tizen.md b/docs/generators/cpp-tizen.md index f805721b5770..16022f8f5370 100644 --- a/docs/generators/cpp-tizen.md +++ b/docs/generators/cpp-tizen.md @@ -7,6 +7,16 @@ sidebar_label: cpp-tizen | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/cwiki.md b/docs/generators/cwiki.md index f2d5342f8f36..bf7949015bd0 100644 --- a/docs/generators/cwiki.md +++ b/docs/generators/cwiki.md @@ -15,6 +15,16 @@ sidebar_label: cwiki |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index 05514b9a1e4e..fd16331b9a15 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -9,6 +9,16 @@ sidebar_label: dart-dio |browserClient|Is the client browser based (for Dart 1.x only)| |null| |dateLibrary|Option. Date library to use|<dl><dt>**core**</dt><dd>Dart core library (DateTime)</dd><dt>**timemachine**</dt><dd>Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.</dd></dl>|core| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |nullableFields|Is the null fields should be in the JSON payload| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |pubAuthor|Author name in generated pubspec| |null| diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md index 5e81f82025f3..995676b9a134 100644 --- a/docs/generators/dart-jaguar.md +++ b/docs/generators/dart-jaguar.md @@ -8,6 +8,16 @@ sidebar_label: dart-jaguar |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |browserClient|Is the client browser based (for Dart 1.x only)| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |nullableFields|Is the null fields should be in the JSON payload| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |pubAuthor|Author name in generated pubspec| |null| diff --git a/docs/generators/dart.md b/docs/generators/dart.md index 993c31cf4477..7cad220b66ea 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -8,6 +8,16 @@ sidebar_label: dart |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |browserClient|Is the client browser based (for Dart 1.x only)| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |pubAuthor|Author name in generated pubspec| |null| |pubAuthorEmail|Email address of the author in generated pubspec| |null| diff --git a/docs/generators/dynamic-html.md b/docs/generators/dynamic-html.md index b252e414bdc8..6d120dd987bd 100644 --- a/docs/generators/dynamic-html.md +++ b/docs/generators/dynamic-html.md @@ -11,6 +11,16 @@ sidebar_label: dynamic-html |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |groupId|groupId in generated pom.xml| |null| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/elixir.md b/docs/generators/elixir.md index 14afa95bc9fd..9dc1c27d1893 100644 --- a/docs/generators/elixir.md +++ b/docs/generators/elixir.md @@ -8,6 +8,16 @@ sidebar_label: elixir |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay.Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseHeader|The license header to prepend to the top of all source files.| |null| |packageName|Elixir package name (convention: lowercase).| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/fsharp-functions.md b/docs/generators/fsharp-functions.md index a7e28602b33e..456a7daaa424 100644 --- a/docs/generators/fsharp-functions.md +++ b/docs/generators/fsharp-functions.md @@ -7,6 +7,16 @@ sidebar_label: fsharp-functions | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |NoLicense| |licenseUrl|The URL of the license| |http://localhost| |packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI| diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index 32699d5a12c1..dbdec2603134 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -25,6 +25,16 @@ sidebar_label: groovy |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/haskell-http-client.md b/docs/generators/haskell-http-client.md index 41163e8fa883..9b9a848ae683 100644 --- a/docs/generators/haskell-http-client.md +++ b/docs/generators/haskell-http-client.md @@ -24,6 +24,16 @@ sidebar_label: haskell-http-client |generateModelConstructors|Generate smart constructors (only supply required fields) for models| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |inlineMimeTypes|Inline (hardcode) the content-type and accept parameters on operations, when there is only 1 option| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelDeriving|Additional classes to include in the deriving() clause of Models| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |requestType|Set the name of the type used to generate requests| |null| diff --git a/docs/generators/haskell.md b/docs/generators/haskell.md index 2e35a073d890..6bb19ea0f864 100644 --- a/docs/generators/haskell.md +++ b/docs/generators/haskell.md @@ -8,6 +8,16 @@ sidebar_label: haskell |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |serveStatic|serve will serve files from the directory 'static'.| |true| diff --git a/docs/generators/html.md b/docs/generators/html.md index 78cef65b33b9..dd8c9fa9d651 100644 --- a/docs/generators/html.md +++ b/docs/generators/html.md @@ -15,6 +15,16 @@ sidebar_label: html |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/html2.md b/docs/generators/html2.md index 51d39c72a7d4..7201bdc24963 100644 --- a/docs/generators/html2.md +++ b/docs/generators/html2.md @@ -15,6 +15,16 @@ sidebar_label: html2 |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |packageName|C# package name| |null| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index f34df4d7a136..4d9c6bfe7e4a 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -27,6 +27,16 @@ sidebar_label: java-inflector |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.controllers| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index 27017264e1c8..bedc76b14d88 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -28,6 +28,16 @@ sidebar_label: java-msf4j |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template)|<dl><dt>**jersey1**</dt><dd>Jersey core 1.x</dd><dt>**jersey2**</dt><dd>Jersey core 2.x</dd></dl>|jersey2| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index c8df6eb88723..95b92bbb1116 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -29,6 +29,16 @@ sidebar_label: java-pkmst |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |com.prokarma.pkmst.controller| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |com.prokarma.pkmst.model| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 3066a14a7224..6801838e4a48 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -31,6 +31,16 @@ sidebar_label: java-play-framework |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |apimodels| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 34544a236c38..94bf4e39cc1a 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -27,6 +27,16 @@ sidebar_label: java-undertow-server |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.handler| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |null| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index cd6c3ee4e9e6..a3fff5103861 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -27,6 +27,16 @@ sidebar_label: java-vertx-web |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.vertxweb.server| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.vertxweb.server.model| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 58c68915ade5..13e7bb94c420 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -27,6 +27,16 @@ sidebar_label: java-vertx |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.server.api.model| diff --git a/docs/generators/java.md b/docs/generators/java.md index 8cdcd9dc4e3d..289ad4405093 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -29,6 +29,16 @@ sidebar_label: java |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.client| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>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.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey2-experimental**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[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'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/javascript-apollo.md b/docs/generators/javascript-apollo.md index 44cad073fd8d..51a0421dcd72 100644 --- a/docs/generators/javascript-apollo.md +++ b/docs/generators/javascript-apollo.md @@ -11,6 +11,16 @@ sidebar_label: javascript-apollo |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|name of the license the project uses (Default: using info.license.name)| |null| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/javascript-closure-angular.md b/docs/generators/javascript-closure-angular.md index 89b3bd9b0ffe..4cf42f33a9c5 100644 --- a/docs/generators/javascript-closure-angular.md +++ b/docs/generators/javascript-closure-angular.md @@ -8,6 +8,16 @@ sidebar_label: javascript-closure-angular |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md index 6ecd6654d10d..8efe8bba9bed 100644 --- a/docs/generators/javascript-flowtyped.md +++ b/docs/generators/javascript-flowtyped.md @@ -9,6 +9,16 @@ sidebar_label: javascript-flowtyped |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |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| diff --git a/docs/generators/javascript.md b/docs/generators/javascript.md index 1181fffa500f..139499823d60 100644 --- a/docs/generators/javascript.md +++ b/docs/generators/javascript.md @@ -12,6 +12,16 @@ sidebar_label: javascript |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|root package for generated code| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|name of the license the project uses (Default: using info.license.name)| |null| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index ccd6d823c1e3..13378c214443 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -31,6 +31,16 @@ sidebar_label: jaxrs-cxf-cdi |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index 0d1c841f153d..052caa1f2927 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -27,6 +27,16 @@ sidebar_label: jaxrs-cxf-client |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index b83a1d55e4f9..28756d164f85 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -34,6 +34,16 @@ sidebar_label: jaxrs-cxf-extended |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |loadTestDataFromFile|Load test data from a generated JSON file| |false| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index d3dd5e448267..343374b3c249 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -33,6 +33,16 @@ sidebar_label: jaxrs-cxf |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 9183a75d65f7..ef5a852acf60 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -28,6 +28,16 @@ sidebar_label: jaxrs-jersey |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template)|<dl><dt>**jersey1**</dt><dd>Jersey core 1.x</dd><dt>**jersey2**</dt><dd>Jersey core 2.x</dd></dl>|jersey2| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 3a7623db6796..1d5f312382e0 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -29,6 +29,16 @@ sidebar_label: jaxrs-resteasy-eap |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 724c15e9289d..60e52043dc4a 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -29,6 +29,16 @@ sidebar_label: jaxrs-resteasy |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 3bd0accada9b..98cbb0c96c3b 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -31,6 +31,16 @@ sidebar_label: jaxrs-spec |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jmeter.md b/docs/generators/jmeter.md index 142f826d7938..e8cbb38e5fd5 100644 --- a/docs/generators/jmeter.md +++ b/docs/generators/jmeter.md @@ -7,6 +7,16 @@ sidebar_label: jmeter | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/k6.md b/docs/generators/k6.md index 4ff51c7527fb..2f6d321b14f4 100644 --- a/docs/generators/k6.md +++ b/docs/generators/k6.md @@ -7,6 +7,16 @@ sidebar_label: k6 | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/markdown.md b/docs/generators/markdown.md index 2cba7bc698ef..465504f69446 100644 --- a/docs/generators/markdown.md +++ b/docs/generators/markdown.md @@ -7,6 +7,16 @@ sidebar_label: markdown | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/nim.md b/docs/generators/nim.md index 61ba1d00f1f5..0340561b620a 100644 --- a/docs/generators/nim.md +++ b/docs/generators/nim.md @@ -7,6 +7,16 @@ sidebar_label: nim | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/nodejs-express-server.md b/docs/generators/nodejs-express-server.md index 76b0893f9a33..8cc7b8af1fcf 100644 --- a/docs/generators/nodejs-express-server.md +++ b/docs/generators/nodejs-express-server.md @@ -7,6 +7,16 @@ sidebar_label: nodejs-express-server | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |serverPort|TCP port to listen on.| |null| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/nodejs-server-deprecated.md b/docs/generators/nodejs-server-deprecated.md index 84a3b1319439..b2b09ce303c0 100644 --- a/docs/generators/nodejs-server-deprecated.md +++ b/docs/generators/nodejs-server-deprecated.md @@ -9,6 +9,16 @@ sidebar_label: nodejs-server-deprecated |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null| |googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |serverPort|TCP port to listen on.| |null| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/ocaml.md b/docs/generators/ocaml.md index d8cda30ed802..ab9a3bd7fd19 100644 --- a/docs/generators/ocaml.md +++ b/docs/generators/ocaml.md @@ -7,6 +7,16 @@ sidebar_label: ocaml | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/openapi-yaml.md b/docs/generators/openapi-yaml.md index 7eda9d44be0d..3d7b5af16037 100644 --- a/docs/generators/openapi-yaml.md +++ b/docs/generators/openapi-yaml.md @@ -7,6 +7,16 @@ sidebar_label: openapi-yaml | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |outputFile|Output filename| |openapi/openapi.yaml| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/openapi.md b/docs/generators/openapi.md index 5d46dccf4fd9..7625d70cb8b9 100644 --- a/docs/generators/openapi.md +++ b/docs/generators/openapi.md @@ -7,6 +7,16 @@ sidebar_label: openapi | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md index 57b9191b6012..e2bbcaaab030 100644 --- a/docs/generators/php-laravel.md +++ b/docs/generators/php-laravel.md @@ -10,6 +10,16 @@ sidebar_label: php-laravel |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md index 2414dda65c72..1e69867a13a4 100644 --- a/docs/generators/php-lumen.md +++ b/docs/generators/php-lumen.md @@ -10,6 +10,16 @@ sidebar_label: php-lumen |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-silex.md b/docs/generators/php-silex.md index 81f5e6cb38c8..2557c8f15166 100644 --- a/docs/generators/php-silex.md +++ b/docs/generators/php-silex.md @@ -7,6 +7,16 @@ sidebar_label: php-silex | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/php-slim-deprecated.md b/docs/generators/php-slim-deprecated.md index 98381616b95b..16b5a34e7614 100644 --- a/docs/generators/php-slim-deprecated.md +++ b/docs/generators/php-slim-deprecated.md @@ -10,6 +10,16 @@ sidebar_label: php-slim-deprecated |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-slim4.md b/docs/generators/php-slim4.md index b0e79e02ae71..86f9a6efbc52 100644 --- a/docs/generators/php-slim4.md +++ b/docs/generators/php-slim4.md @@ -10,6 +10,16 @@ sidebar_label: php-slim4 |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md index 1d3e71d39265..e645d1c0a2dd 100644 --- a/docs/generators/php-symfony.md +++ b/docs/generators/php-symfony.md @@ -15,6 +15,16 @@ sidebar_label: php-symfony |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |phpLegacySupport|Should the generated code be compatible with PHP 5.x?| |true| diff --git a/docs/generators/php-ze-ph.md b/docs/generators/php-ze-ph.md index 93a1d3f6adf7..6afc5d2a291c 100644 --- a/docs/generators/php-ze-ph.md +++ b/docs/generators/php-ze-ph.md @@ -10,6 +10,16 @@ sidebar_label: php-ze-ph |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php.md b/docs/generators/php.md index 413996804eb0..ba90aa92d7c9 100644 --- a/docs/generators/php.md +++ b/docs/generators/php.md @@ -11,6 +11,16 @@ sidebar_label: php |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md index ee337d2e5bb2..0904e15e29c3 100644 --- a/docs/generators/python-aiohttp.md +++ b/docs/generators/python-aiohttp.md @@ -9,6 +9,16 @@ sidebar_label: python-aiohttp |controllerPackage|controller package| |controllers| |defaultController|default controller| |default_controller| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |packageName|python package name (convention: snake_case).| |openapi_server| |packageVersion|python package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md index 0382237eef5c..ba1613ebe21c 100644 --- a/docs/generators/python-blueplanet.md +++ b/docs/generators/python-blueplanet.md @@ -9,6 +9,16 @@ sidebar_label: python-blueplanet |controllerPackage|controller package| |controllers| |defaultController|default controller| |default_controller| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |packageName|python package name (convention: snake_case).| |openapi_server| |packageVersion|python package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md index c8ab554adeba..a09e1dd88945 100644 --- a/docs/generators/python-flask.md +++ b/docs/generators/python-flask.md @@ -9,6 +9,16 @@ sidebar_label: python-flask |controllerPackage|controller package| |controllers| |defaultController|default controller| |default_controller| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |packageName|python package name (convention: snake_case).| |openapi_server| |packageVersion|python package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/ruby.md b/docs/generators/ruby.md index 2475a797ec6c..9bc917daa983 100644 --- a/docs/generators/ruby.md +++ b/docs/generators/ruby.md @@ -17,6 +17,16 @@ sidebar_label: ruby |gemSummary|gem summary. | |A ruby wrapper for the REST APIs| |gemVersion|gem version.| |1.0.0| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|HTTP library template (sub-template) to use|<dl><dt>**faraday**</dt><dd>Faraday (https://github.com/lostisland/faraday) (Beta support)</dd><dt>**typhoeus**</dt><dd>Typhoeus >= 1.0.1 (https://github.com/typhoeus/typhoeus)</dd></dl>|typhoeus| |moduleName|top module name (convention: CamelCase, usually corresponding to gem name).| |OpenAPIClient| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-akka-http-server.md b/docs/generators/scala-akka-http-server.md index ecd656979e35..5b293ffbc327 100644 --- a/docs/generators/scala-akka-http-server.md +++ b/docs/generators/scala-akka-http-server.md @@ -14,6 +14,16 @@ sidebar_label: scala-akka-http-server |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |groupId|groupId in generated pom.xml| |org.openapitools| |invokerPackage|root package for generated code| |org.openapitools.server| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-akka.md b/docs/generators/scala-akka.md index ad8c5d485cf1..d023156775e9 100644 --- a/docs/generators/scala-akka.md +++ b/docs/generators/scala-akka.md @@ -9,6 +9,16 @@ sidebar_label: scala-akka |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |mainPackage|Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage'| |org.openapitools.client| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/scala-gatling.md b/docs/generators/scala-gatling.md index 0e1e748245e1..1b711480df22 100644 --- a/docs/generators/scala-gatling.md +++ b/docs/generators/scala-gatling.md @@ -9,6 +9,16 @@ sidebar_label: scala-gatling |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-httpclient-deprecated.md b/docs/generators/scala-httpclient-deprecated.md index febeca9a6900..a6ee24cc4479 100644 --- a/docs/generators/scala-httpclient-deprecated.md +++ b/docs/generators/scala-httpclient-deprecated.md @@ -9,6 +9,16 @@ sidebar_label: scala-httpclient-deprecated |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-lagom-server.md b/docs/generators/scala-lagom-server.md index 99b43af7d58c..da97ad1ee7df 100644 --- a/docs/generators/scala-lagom-server.md +++ b/docs/generators/scala-lagom-server.md @@ -9,6 +9,16 @@ sidebar_label: scala-lagom-server |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-play-server.md b/docs/generators/scala-play-server.md index 57bdf5d70ed8..ef8b2db4e746 100644 --- a/docs/generators/scala-play-server.md +++ b/docs/generators/scala-play-server.md @@ -10,6 +10,16 @@ sidebar_label: scala-play-server |basePackage|Base package in which supporting classes are generated.| |org.openapitools| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |generateCustomExceptions|If set, generates custom exception types.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-sttp.md b/docs/generators/scala-sttp.md index 5c277bf9dcc2..2d1584633b9c 100644 --- a/docs/generators/scala-sttp.md +++ b/docs/generators/scala-sttp.md @@ -9,6 +9,16 @@ sidebar_label: scala-sttp |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |mainPackage|Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage'| |org.openapitools.client| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/scalatra.md b/docs/generators/scalatra.md index af71e32aa463..bb05a8f35e89 100644 --- a/docs/generators/scalatra.md +++ b/docs/generators/scalatra.md @@ -9,6 +9,16 @@ sidebar_label: scalatra |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scalaz.md b/docs/generators/scalaz.md index aa2f6121ca13..48ecb1bdfa70 100644 --- a/docs/generators/scalaz.md +++ b/docs/generators/scalaz.md @@ -9,6 +9,16 @@ sidebar_label: scalaz |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 98b896d8f262..c2a43de8ceaf 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -35,6 +35,16 @@ sidebar_label: spring |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application using the SpringFox integration.</dd><dt>**spring-mvc**</dt><dd>Spring-MVC Server application using the SpringFox integration.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/swift2-deprecated.md b/docs/generators/swift2-deprecated.md index fe739bc109a2..34894b89301e 100644 --- a/docs/generators/swift2-deprecated.md +++ b/docs/generators/swift2-deprecated.md @@ -8,6 +8,16 @@ sidebar_label: swift2-deprecated |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |podAuthors|Authors used for Podspec| |null| |podDescription|Description used for Podspec| |null| |podDocsetURL|Docset URL used for Podspec| |null| diff --git a/docs/generators/swift3-deprecated.md b/docs/generators/swift3-deprecated.md index 7f1997eaef95..ed484208b2ce 100644 --- a/docs/generators/swift3-deprecated.md +++ b/docs/generators/swift3-deprecated.md @@ -8,6 +8,16 @@ sidebar_label: swift3-deprecated |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false| |objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null| |podAuthors|Authors used for Podspec| |null| diff --git a/docs/generators/swift4.md b/docs/generators/swift4.md index f4c589c02eab..4030c9a11f31 100644 --- a/docs/generators/swift4.md +++ b/docs/generators/swift4.md @@ -8,6 +8,16 @@ sidebar_label: swift4 |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false| |nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null| |objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null| diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md index 52a75bd93b1a..c7beb3e39abf 100644 --- a/docs/generators/swift5.md +++ b/docs/generators/swift5.md @@ -9,6 +9,16 @@ sidebar_label: swift5 |apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false| |library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd></dl>|urlsession| |nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null| diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md index f382194df4ab..4d9191a91f0c 100644 --- a/docs/generators/typescript-angular.md +++ b/docs/generators/typescript-angular.md @@ -11,6 +11,16 @@ sidebar_label: typescript-angular |enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |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|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |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| diff --git a/docs/generators/typescript-angularjs.md b/docs/generators/typescript-angularjs.md index fbfd828ba323..0c5f755640ba 100644 --- a/docs/generators/typescript-angularjs.md +++ b/docs/generators/typescript-angularjs.md @@ -9,6 +9,16 @@ sidebar_label: typescript-angularjs |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |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| diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md index 955079117b0e..f5f0e764b665 100644 --- a/docs/generators/typescript-aurelia.md +++ b/docs/generators/typescript-aurelia.md @@ -9,6 +9,16 @@ sidebar_label: typescript-aurelia |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null| |npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0| diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 5e65684a0e6e..575d2e17bbca 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -9,6 +9,16 @@ sidebar_label: typescript-axios |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |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 of your private npmRepo in the package.json| |null| diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index 40e7ff4eb2cc..2662e2adefa5 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -9,6 +9,16 @@ sidebar_label: typescript-fetch |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |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| diff --git a/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md index 5d68c9f08399..6829b64eee83 100644 --- a/docs/generators/typescript-inversify.md +++ b/docs/generators/typescript-inversify.md @@ -9,6 +9,16 @@ sidebar_label: typescript-inversify |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |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| diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md index 91d61cf31e10..262578ce207a 100644 --- a/docs/generators/typescript-jquery.md +++ b/docs/generators/typescript-jquery.md @@ -10,6 +10,16 @@ sidebar_label: typescript-jquery |enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| |jqueryAlreadyImported|When using this in legacy app using mix of typescript and javascript, this will only declare jquery and not import it| |false| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |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| diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md index d4bdee29bcc8..06a4853986a9 100644 --- a/docs/generators/typescript-node.md +++ b/docs/generators/typescript-node.md @@ -9,6 +9,16 @@ sidebar_label: typescript-node |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |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| diff --git a/docs/generators/typescript-redux-query.md b/docs/generators/typescript-redux-query.md index e5674a4c302c..14fbe4c85434 100644 --- a/docs/generators/typescript-redux-query.md +++ b/docs/generators/typescript-redux-query.md @@ -9,6 +9,16 @@ sidebar_label: typescript-redux-query |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |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| diff --git a/docs/generators/typescript-rxjs.md b/docs/generators/typescript-rxjs.md index 9a210f4934b9..e9638e2fbdd3 100644 --- a/docs/generators/typescript-rxjs.md +++ b/docs/generators/typescript-rxjs.md @@ -9,6 +9,16 @@ sidebar_label: typescript-rxjs |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. + +When this flag is set to 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. +- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. +When this flag is set to true: + +- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. +Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| |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| |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| diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index e40f3c624acc..084026f5552e 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -240,6 +240,9 @@ public class Generate extends OpenApiGeneratorCommand { @Option(name = {"--generate-alias-as-model"}, title = "generate alias (array, map) as model", description = CodegenConstants.GENERATE_ALIAS_AS_MODEL_DESC) private Boolean generateAliasAsModel; + @Option(name = {"--legacy-discriminator-behavior"}, title = "Support legacy logic for evaluating discriminators", description = CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC) + private Boolean legacyDiscriminatorBehavior; + @Option(name = {"--minimal-update"}, title = "Minimal update", description = "Only write output files that have changed.") 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 14e1fe5fce33..5b2cc91645b5 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 @@ -351,4 +351,17 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, public static final String REMOVE_ENUM_VALUE_PREFIX = "removeEnumValuePrefix"; public static final String REMOVE_ENUM_VALUE_PREFIX_DESC = "Remove the common prefix of enum values"; + + public static final String LEGACY_DISCRIMINATOR_BEHAVIOR = "legacyDiscriminatorBehavior"; + public static final String LEGACY_DISCRIMINATOR_BEHAVIOR_DESC = "This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.\n" + + "\n" + + "When this flag is set to false:\n" + + "\n" + + "- 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.\n" + + "- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.\n" + + "When this flag is set to true:\n" + + "\n" + + "- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.\n" + + "Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}."; + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java index 73d85052e70d..4e30df0c9ea4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenDiscriminator.java @@ -7,12 +7,39 @@ import java.util.Objects; import java.util.Set; +/** + * This class encapsulates the OpenAPI discriminator construct, as specified at + * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#discriminatorObject. + * + * When request bodies or response payloads may be one of a number of different schemas, + * a discriminator object can be used to aid in serialization, deserialization, and validation. + * The discriminator is a specific object in a schema which is used to inform the consumer of + * the specification of an alternative schema based on the value associated with it. + */ public class CodegenDiscriminator { + // The name of the property in the payload that will hold the discriminator value. + // This is the propertyName as specified in the OpenAPI discriminator object. private String propertyName; private String propertyBaseName; private String propertyGetter; private String propertyType; private Map<String, String> mapping; + + // mappedModels is populated differently if discriminatorExplicitMappingVerbose is + // True or False. When: + // + // discriminatorExplicitMappingVerbose == False, this contains: + // - the name to schema map info in the discriminator mapping entry in your openapi spec OR + // - child schemas that allOf inherit self schema + // + // discriminatorExplicitMappingVerbose == True, this contains: + // - the name to schema map info in the discriminMappedModelator mapping entry in your openapi spec AND + // - x-discriminator-value mappings in child oneOf + anyOf schemas + descendant schemas that allOf inherit self schema AND + // - descendant schemas that allOf inherit self schema AND + // - child oneOf + anyOf schemas + // + // see the method createDiscriminator in DefaultCodegen.java + private Set<MappedModel> mappedModels = new LinkedHashSet<>(); public String getPropertyName() { @@ -63,8 +90,21 @@ public void setMappedModels(Set<MappedModel> mappedModels) { this.mappedModels = mappedModels; } - public static class MappedModel { + /** + * An object to hold discriminator mappings between payload values and schema names or + * references. + * + * In the OpenAPI document, the discriminator "mapping" attribute is optional. + * In scenarios where the value of the discriminator field does not match the schema name + * or implicit mapping is not possible, an optional mapping definition MAY be used. + * In OpenAPITools codegen, the MappedModel is the union of all the discriminator mappings, + * both explicitly defined in the OpenAPI document and inherited from oneOf/allOf/anyOf. + */ + public static class MappedModel implements Comparable<MappedModel>{ + // The value of the discriminator property in the payload. private String mappingName; + // The OAS schema name. It is obtained from the OAS document, and the string value + // is converted to a sanitized, internal representation within codegen. private String modelName; public MappedModel(String mappingName, String modelName) { @@ -72,6 +112,18 @@ public MappedModel(String mappingName, String modelName) { this.modelName = modelName; } + @Override + public int compareTo(MappedModel other) { + if (getMappingName() == null && other.getMappingName() == null) { + return 0; + } else if (getMappingName() == null) { + return 1; + } else if (other.getMappingName() == null) { + return -1; + } + return getMappingName().compareTo(other.getMappingName()); + } + public String getMappingName() { return mappingName; } @@ -130,4 +182,4 @@ public String toString() { sb.append('}'); return sb.toString(); } -} +} \ No newline at end of file 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 16a296f84e1f..e9d25fd5ca74 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 @@ -696,6 +696,17 @@ public String toString() { return sb.toString(); } + public void addDiscriminatorMappedModelsImports(){ + if (discriminator == null || discriminator.getMappedModels() == null) { + return; + } + for (CodegenDiscriminator.MappedModel mm : discriminator.getMappedModels()) { + if (!"".equals(mm.getModelName())) { + imports.add(mm.getModelName()); + } + } + } + public boolean isEmptyVars() { return emptyVars; } 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 b6255e1fe02d..bc1101c015e9 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 @@ -150,6 +150,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti public boolean isNullable; public boolean isSelfReference; public boolean isCircularReference; + public boolean isDiscriminator; public List<String> _enum; public Map<String, Object> allowableValues; public CodegenProperty items; @@ -651,6 +652,7 @@ public String toString() { sb.append(", isNullable=").append(isNullable); sb.append(", isSelfReference=").append(isSelfReference); sb.append(", isCircularReference=").append(isCircularReference); + sb.append(", isDiscriminator=").append(isDiscriminator); sb.append(", _enum=").append(_enum); sb.append(", allowableValues=").append(allowableValues); sb.append(", items=").append(items); @@ -717,6 +719,7 @@ public boolean equals(Object o) { isNullable == that.isNullable && isSelfReference == that.isSelfReference && isCircularReference == that.isCircularReference && + isDiscriminator == that.isDiscriminator && hasValidation == that.hasValidation && isInherited == that.isInherited && isXmlAttribute == that.isXmlAttribute && @@ -775,7 +778,7 @@ public int hashCode() { isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isListContainer, isMapContainer, isEnum, isReadOnly, isWriteOnly, isNullable, - isSelfReference, isCircularReference, _enum, allowableValues, items, mostInnerItems, + isSelfReference, isCircularReference, isDiscriminator, _enum, allowableValues, items, mostInnerItems, vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase, nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName, xmlNamespace, isXmlWrapped); 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 6f5990074ce4..91edad3cd514 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 @@ -215,6 +215,9 @@ apiTemplateFiles are for API outputs only (controllers/handlers). // flag to indicate whether enum value prefixes are removed protected boolean removeEnumValuePrefix = true; + // Support legacy logic for evaluating discriminators + protected boolean legacyDiscriminatorBehavior = true; + // make openapi available to all methods protected OpenAPI openAPI; @@ -306,6 +309,11 @@ public void processOpts() { this.setRemoveEnumValuePrefix(Boolean.valueOf(additionalProperties .get(CodegenConstants.REMOVE_ENUM_VALUE_PREFIX).toString())); } + + if (additionalProperties.containsKey(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR)) { + this.setLegacyDiscriminatorBehavior(Boolean.valueOf(additionalProperties + .get(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR).toString())); + } } /*** @@ -468,7 +476,8 @@ public Map<String, Object> updateAllModels(Map<String, Object> objs) { } parent.getChildren().add(cm); parent.hasChildren = true; - if (parent.getDiscriminator() == null) { + Schema parentSchema = this.openAPI.getComponents().getSchemas().get(parent.name); + if (parentSchema.getDiscriminator() == null) { parent = allModels.get(parent.getParent()); } else { parent = null; @@ -765,7 +774,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) { if (e.getKey().contains("/")) { // if this is property schema, we also need to generate the oneOf interface model addOneOfNameExtension((ComposedSchema) s, nOneOf); - addOneOfInterfaceModel((ComposedSchema) s, nOneOf); + addOneOfInterfaceModel((ComposedSchema) s, nOneOf, openAPI); } else { // else this is a component schema, so we will just use that as the oneOf interface model addOneOfNameExtension((ComposedSchema) s, n); @@ -774,13 +783,13 @@ public void preprocessOpenAPI(OpenAPI openAPI) { Schema items = ((ArraySchema) s).getItems(); if (ModelUtils.isComposedSchema(items)) { addOneOfNameExtension((ComposedSchema) items, nOneOf); - addOneOfInterfaceModel((ComposedSchema) items, nOneOf); + addOneOfInterfaceModel((ComposedSchema) items, nOneOf, openAPI); } } else if (ModelUtils.isMapSchema(s)) { Schema addProps = ModelUtils.getAdditionalProperties(s); if (addProps != null && ModelUtils.isComposedSchema(addProps)) { addOneOfNameExtension((ComposedSchema) addProps, nOneOf); - addOneOfInterfaceModel((ComposedSchema) addProps, nOneOf); + addOneOfInterfaceModel((ComposedSchema) addProps, nOneOf, openAPI); } } } @@ -1109,6 +1118,14 @@ public void setEnsureUniqueParams(Boolean ensureUniqueParams) { this.ensureUniqueParams = ensureUniqueParams; } + public Boolean getLegacyDiscriminatorBehavior() { + return legacyDiscriminatorBehavior; + } + + public void setLegacyDiscriminatorBehavior(boolean val){ + this.legacyDiscriminatorBehavior = val; + } + public Boolean getAllowUnicodeIdentifiers() { return allowUnicodeIdentifiers; } @@ -1423,6 +1440,9 @@ public DefaultCodegen() { // option to change the order of form/body parameter cliOptions.add(CliOption.newBoolean(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC).defaultValue(Boolean.FALSE.toString())); + cliOptions.add(CliOption.newBoolean(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, + CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC).defaultValue(Boolean.TRUE.toString())); + // initialize special character mapping initalizeSpecialCharacterMapping(); @@ -2115,7 +2135,10 @@ public CodegenModel fromModel(String name, Schema schema) { } m.isAlias = (typeAliases.containsKey(name) || isAliasOfSimpleTypes(schema)); // check if the unaliased schema is an alias of simple OAS types - m.discriminator = createDiscriminator(name, schema); + m.discriminator = createDiscriminator(name, schema, this.openAPI); + if (!this.getLegacyDiscriminatorBehavior()) { + m.addDiscriminatorMappedModelsImports(); + } if (schema.getDeprecated() != null) { m.isDeprecated = schema.getDeprecated(); @@ -2161,7 +2184,10 @@ public CodegenModel fromModel(String name, Schema schema) { for (Schema innerSchema : composed.getAllOf()) { // TODO need to work with anyOf, oneOf as well if (m.discriminator == null && innerSchema.getDiscriminator() != null) { LOGGER.debug("discriminator is set to null (not correctly set earlier): {}", name); - m.discriminator = createDiscriminator(name, innerSchema); + m.discriminator = createDiscriminator(name, innerSchema, this.openAPI); + if (!this.getLegacyDiscriminatorBehavior()) { + m.addDiscriminatorMappedModelsImports(); + } modelDiscriminators++; } @@ -2285,6 +2311,7 @@ public CodegenModel fromModel(String name, Schema schema) { required.addAll(composed.getRequired()); allRequired.addAll(composed.getRequired()); } + addVars(m, unaliasPropertySchema(properties), required, unaliasPropertySchema(allProperties), allRequired); // end of code block for composed schema @@ -2353,6 +2380,22 @@ public CodegenModel fromModel(String name, Schema schema) { } } + // set isDiscriminator on the discriminator property + if (m.discriminator != null) { + String discPropName = m.discriminator.getPropertyBaseName(); + List<List<CodegenProperty>> listOLists = new ArrayList<List<CodegenProperty>>(); + listOLists.add(m.requiredVars); + listOLists.add(m.vars); + listOLists.add(m.allVars); + for (List<CodegenProperty> theseVars: listOLists) { + for (CodegenProperty requiredVar: theseVars) { + if (discPropName.equals(requiredVar.baseName)) { + requiredVar.isDiscriminator = true; + } + } + } + } + if (sortModelPropertiesByRequiredFlag) { Comparator<CodegenProperty> comparator = new Comparator<CodegenProperty>() { @Override @@ -2369,36 +2412,316 @@ public int compare(CodegenProperty one, CodegenProperty another) { return m; } - protected CodegenDiscriminator createDiscriminator(String schemaName, Schema schema) { - if (schema.getDiscriminator() == null) { + /** + * Recursively look in Schema sc for the discriminator discPropName + * and return a CodegenProperty with the dataType and required params set + * the returned CodegenProperty may not be required and it may not be of type string + * @param composedSchemaName The name of the sc Schema + * @param sc The Schema that may contain the discriminator + * @param discPropName The String that is the discriminator propertyName in the schema + */ + private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, String discPropName, OpenAPI openAPI) { + Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc); + if (refSchema.getProperties() != null && refSchema.getProperties().get(discPropName) != null) { + Schema discSchema = (Schema) refSchema.getProperties().get(discPropName); + CodegenProperty cp = new CodegenProperty(); + if (ModelUtils.isStringSchema(discSchema)) { + cp.isString = true; + } + cp.setRequired(false); + if (refSchema.getRequired() != null && refSchema.getRequired().contains(discPropName)) { + cp.setRequired(true); + } + return cp; + } + if (ModelUtils.isComposedSchema(refSchema)) { + ComposedSchema composedSchema = (ComposedSchema) refSchema; + if (composedSchema.getAllOf() != null) { + // If our discriminator is in one of the allOf schemas break when we find it + for (Schema allOf: composedSchema.getAllOf()) { + CodegenProperty cp = discriminatorFound(composedSchemaName, allOf, discPropName, openAPI); + if (cp != null) { + return cp; + } + } + } + if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) { + // All oneOf definitions must contain the discriminator + CodegenProperty cp = new CodegenProperty(); + for (Schema oneOf: composedSchema.getOneOf()) { + String modelName = ModelUtils.getSimpleRef(oneOf.get$ref()); + CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI); + if (thisCp == null) { + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing "+discPropName); + } + if (cp.dataType == null) { + cp = thisCp; + continue; + } + if (cp != thisCp) { + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different "+discPropName+" definition than the prior OneOf schema's. Make sure the "+discPropName+" type and required values are the same"); + } + } + return cp; + } + if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) { + // All anyOf definitions must contain the discriminator because a min of one must be selected + CodegenProperty cp = new CodegenProperty(); + for (Schema anyOf: composedSchema.getAnyOf()) { + String modelName = ModelUtils.getSimpleRef(anyOf.get$ref()); + CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI); + if (thisCp == null) { + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing "+discPropName); + } + if (cp.dataType == null) { + cp = thisCp; + continue; + } + if (cp != thisCp) { + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different "+discPropName+" definition than the prior AnyOf schema's. Make sure the "+discPropName+" type and required values are the same"); + } + } + return cp; + + } + } + return null; + } + + /** + * Recursively look in Schema sc for the discriminator and return it + * Schema sc location + * OpenAPI openAPI the spec where we are searching for the discriminator + * @param sc The Schema that may contain the discriminator + */ + private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { + Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc); + Discriminator foundDisc = refSchema.getDiscriminator(); + if (foundDisc != null) { + return foundDisc; + } + if (!!this.getLegacyDiscriminatorBehavior()) { + return null; + } + Discriminator disc = new Discriminator(); + if (ModelUtils.isComposedSchema(refSchema)) { + ComposedSchema composedSchema = (ComposedSchema) refSchema; + if (composedSchema.getAllOf() != null) { + // If our discriminator is in one of the allOf schemas break when we find it + for (Schema allOf: composedSchema.getAllOf()) { + foundDisc = recursiveGetDiscriminator(allOf, openAPI); + if (foundDisc != null) { + disc.setPropertyName(foundDisc.getPropertyName()); + disc.setMapping(foundDisc.getMapping()); + return disc; + } + } + } + if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) { + // All oneOf definitions must contain the discriminator + Integer hasDiscriminatorCnt = 0; + Set<String> discriminatorsPropNames = new HashSet<>(); + for (Schema oneOf: composedSchema.getOneOf()) { + foundDisc = recursiveGetDiscriminator(oneOf, openAPI); + if (foundDisc != null) { + discriminatorsPropNames.add(foundDisc.getPropertyName()); + hasDiscriminatorCnt++; + } + } + if (hasDiscriminatorCnt == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) { + disc.setPropertyName(foundDisc.getPropertyName()); + disc.setMapping(foundDisc.getMapping()); + return disc; + } + } + if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) { + // All anyOf definitions must contain the discriminator because a min of one must be selected + Integer hasDiscriminatorCnt = 0; + Set<String> discriminatorsPropNames = new HashSet<>(); + for (Schema anyOf: composedSchema.getAnyOf()) { + foundDisc = recursiveGetDiscriminator(anyOf, openAPI); + if (foundDisc != null) { + discriminatorsPropNames.add(foundDisc.getPropertyName()); + hasDiscriminatorCnt++; + } + } + if (hasDiscriminatorCnt == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) { + disc.setPropertyName(foundDisc.getPropertyName()); + disc.setMapping(foundDisc.getMapping()); + return disc; + } + } + } + return null; + } + + /** + * This function is only used for composed schemas which have a discriminator + * Process oneOf and anyOf models in a composed schema and adds them into + * a list if the oneOf and anyOf models contain + * the required discriminator. If they don't contain the required + * discriminator or the discriminator is the wrong type then an error is + * thrown + * @param composedSchemaName The String model name of the composed schema where we are setting the discriminator map + * @param discPropName The String that is the discriminator propertyName in the schema + * @param c The ComposedSchema that contains the discriminator and oneOf/anyOf schemas + * @param openAPI The OpenAPI spec that we are using + * @return the list of oneOf and anyOf MappedModel that need to be added to the discriminator map + */ + protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, ComposedSchema c, OpenAPI openAPI) { + ArrayList<List<Schema>> listOLists = new ArrayList<List<Schema>>(); + listOLists.add(c.getOneOf()); + listOLists.add(c.getAnyOf()); + List<MappedModel> descendentSchemas = new ArrayList(); + for (List<Schema> schemaList: listOLists) { + if (schemaList == null) { + continue; + } + for (Schema sc: schemaList) { + String ref = sc.get$ref(); + if (ref == null) { + // for schemas with no ref, it is not possible to build the discriminator map + // because ref is how we get the model name + // we only hit this use case for a schema with inline composed schemas, and one of those + // schemas also has inline composed schemas + // Note: if it is only inline one level, then the inline model resolver will move it into its own + // schema and make it a $ref schema in the oneOf/anyOf location + throw new RuntimeException("Invalid inline schema defined in oneOf/anyOf in '" + composedSchemaName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition"); + } + CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI); + String modelName = ModelUtils.getSimpleRef(ref); + if (df == null || !df.isString || df.required != true) { + String msgSuffix = ""; + if (df == null) { + msgSuffix += discPropName+" is missing from the schema, define it as required and type string"; + } else { + if (!df.isString) { + msgSuffix += "invalid type for "+discPropName+", set it to string"; + } + if (df.required != true) { + String spacer = ""; + if (msgSuffix.length() != 0) { + spacer = ". "; + } + msgSuffix += spacer+"invalid optional definition of "+discPropName+", include it in required"; + } + } + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. "+msgSuffix); + } + MappedModel mm = new MappedModel(modelName, toModelName(modelName)); + descendentSchemas.add(mm); + Schema cs = ModelUtils.getSchema(openAPI, modelName); + Map<String, Object> vendorExtensions = cs.getExtensions(); + if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) { + String xDiscriminatorValue = (String) vendorExtensions.get("x-discriminator-value"); + mm = new MappedModel(xDiscriminatorValue, toModelName(modelName)); + descendentSchemas.add(mm); + } + + } + } + return descendentSchemas; + } + + protected List<MappedModel> getAllOfDescendants(String thisSchemaName, OpenAPI openAPI) { + ArrayList<String> queue = new ArrayList();; + List<MappedModel> descendentSchemas = new ArrayList(); + Map<String, Schema> schemas = ModelUtils.getSchemas(openAPI); + String currentSchemaName = thisSchemaName; + while (true) { + for (String childName : schemas.keySet()) { + if (childName == thisSchemaName) { + continue; + } + Schema child = schemas.get(childName); + if (ModelUtils.isComposedSchema(child)) { + ComposedSchema composedChild = (ComposedSchema) child; + List<Schema> parents = composedChild.getAllOf(); + if (parents != null) { + for (Schema parent: parents) { + String ref = parent.get$ref(); + if (ref == null) { + // for schemas with no ref, it is not possible to build the discriminator map + // because ref is how we get the model name + // we only hit this use case for a schema with inline composed schemas, and one of those + // schemas also has inline composed schemas + throw new RuntimeException("Invalid inline schema defined in allOf in '" + childName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the allOf schemas must use $ref. Change this inline definition to a $ref definition"); + } + String parentName = ModelUtils.getSimpleRef(ref); + if (parentName.equals(currentSchemaName)) { + if (queue.contains(childName) || descendentSchemas.contains(childName)) { + throw new RuntimeException("Stack overflow hit when looking for "+thisSchemaName+" an infinite loop starting and ending at "+childName+" was seen"); + } + queue.add(childName); + break; + } + } + } + } + } + if (queue.size() == 0) { + break; + } + currentSchemaName = queue.remove(0); + MappedModel mm = new MappedModel(currentSchemaName, toModelName(currentSchemaName)); + descendentSchemas.add(mm); + Schema cs = schemas.get(currentSchemaName); + Map<String, Object> vendorExtensions = cs.getExtensions(); + if (vendorExtensions != null && !vendorExtensions.isEmpty() && vendorExtensions.containsKey("x-discriminator-value")) { + String xDiscriminatorValue = (String) vendorExtensions.get("x-discriminator-value"); + mm = new MappedModel(xDiscriminatorValue, toModelName(currentSchemaName)); + descendentSchemas.add(mm); + } + } + return descendentSchemas; + } + + protected CodegenDiscriminator createDiscriminator(String schemaName, Schema schema, OpenAPI openAPI) { + Discriminator sourceDiscriminator = recursiveGetDiscriminator(schema, openAPI); + if (sourceDiscriminator == null) { return null; } CodegenDiscriminator discriminator = new CodegenDiscriminator(); - discriminator.setPropertyName(toVarName(schema.getDiscriminator().getPropertyName())); - discriminator.setPropertyBaseName(schema.getDiscriminator().getPropertyName()); + String discPropName = sourceDiscriminator.getPropertyName(); + discriminator.setPropertyName(toVarName(discPropName)); + discriminator.setPropertyBaseName(sourceDiscriminator.getPropertyName()); discriminator.setPropertyGetter(toGetter(discriminator.getPropertyName())); // FIXME: for now, we assume that the discriminator property is String discriminator.setPropertyType(typeMapping.get("string")); - discriminator.setMapping(schema.getDiscriminator().getMapping()); - if (schema.getDiscriminator().getMapping() != null && !schema.getDiscriminator().getMapping().isEmpty()) { - for (Entry<String, String> e : schema.getDiscriminator().getMapping().entrySet()) { + discriminator.setMapping(sourceDiscriminator.getMapping()); + List<MappedModel> uniqueDescendants = new ArrayList(); + if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) { + for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) { String nameOrRef = e.getValue(); String name = nameOrRef.indexOf('/') >= 0 ? ModelUtils.getSimpleRef(nameOrRef) : nameOrRef; String modelName = toModelName(name); - discriminator.getMappedModels().add(new MappedModel(e.getKey(), modelName)); + uniqueDescendants.add(new MappedModel(e.getKey(), modelName)); } - } else { - Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI); - allDefinitions.forEach((childName, child) -> { - if (child instanceof ComposedSchema && ((ComposedSchema) child).getAllOf() != null) { + } - final List<String> parentSchemas = ModelUtils.getAllParentsName((ComposedSchema) child, allDefinitions, true); - if (parentSchemas.contains(schemaName)) { - discriminator.getMappedModels().add(new MappedModel(childName, toModelName(childName))); - } + boolean legacyUseCase = (this.getLegacyDiscriminatorBehavior() && uniqueDescendants.isEmpty()); + if (!this.getLegacyDiscriminatorBehavior() || legacyUseCase) { + // for schemas that allOf inherit from this schema, add those descendants to this discriminator map + List<MappedModel> otherDescendants = getAllOfDescendants(schemaName, openAPI); + for (MappedModel otherDescendant: otherDescendants) { + if (!uniqueDescendants.contains(otherDescendant)) { + uniqueDescendants.add(otherDescendant); } - }); + } } + // if there are composed oneOf/anyOf schemas, add them to this discriminator + if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) { + List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discPropName, (ComposedSchema) schema, openAPI); + for (MappedModel otherDescendant: otherDescendants) { + if (!uniqueDescendants.contains(otherDescendant)) { + uniqueDescendants.add(otherDescendant); + } + } + } + if (!this.getLegacyDiscriminatorBehavior()) { + Collections.sort(uniqueDescendants); + } + discriminator.getMappedModels().addAll(uniqueDescendants); return discriminator; } @@ -2428,11 +2751,15 @@ protected void addProperties(Map<String, Schema> properties, List<String> requir } if (composedSchema.getOneOf() != null) { - throw new RuntimeException("Please report the issue: Cannot process oneOf (Composed Scheme) in addProperties: " + schema); + for (Schema component : composedSchema.getOneOf()) { + addProperties(properties, required, component); + } } if (composedSchema.getAnyOf() != null) { - throw new RuntimeException("Please report the issue: Cannot process anyOf (Composed Schema) in addProperties: " + schema); + for (Schema component : composedSchema.getAnyOf()) { + addProperties(properties, required, component); + } } return; @@ -5830,15 +6157,19 @@ public void addOneOfNameExtension(ComposedSchema s, String name) { * * @param cs ComposedSchema object to create as interface model * @param type name to use for the generated interface model + * @param openAPI OpenAPI spec that we are using */ - public void addOneOfInterfaceModel(ComposedSchema cs, String type) { + public void addOneOfInterfaceModel(ComposedSchema cs, String type, OpenAPI openAPI) { if (cs.getOneOf() == null) { return; } - CodegenModel cm = new CodegenModel(); - cm.discriminator = createDiscriminator("", (Schema) cs); + CodegenModel cm = new CodegenModel(); + cm.discriminator = createDiscriminator("", (Schema) cs, openAPI); + if (!this.getLegacyDiscriminatorBehavior()) { + cm.addDiscriminatorMappedModelsImports(); + } for (Schema o : Optional.ofNullable(cs.getOneOf()).orElse(Collections.emptyList())) { if (o.get$ref() == null) { if (cm.discriminator != null && o.get$ref() == null) { 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 e8dab26d05f9..1681434c4424 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 @@ -156,7 +156,7 @@ private Boolean getGeneratorPropertyDefaultSwitch(final String key, final Boolea return defaultValue; } - private void configureGeneratorProperties() { + void configureGeneratorProperties() { // allows generating only models by specifying a CSV of models to generate, or empty for all // NOTE: Boolean.TRUE is required below rather than `true` because of JVM boxing constraints and type inference. generateApis = GlobalSettings.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null); @@ -394,7 +394,7 @@ private void generateModel(List<File> files, Map<String, Object> models, String } @SuppressWarnings("unchecked") - private void generateModels(List<File> files, List<Object> allModels, List<String> unusedModels) { + void generateModels(List<File> files, List<Object> allModels, List<String> unusedModels) { if (!generateModels) { // TODO: Process these anyway and add to dryRun info LOGGER.info("Skipping generation of models."); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java index 56c63ec0c630..89e189c8c388 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java @@ -77,6 +77,7 @@ public String getHelp() { @Override public void processOpts() { + this.setLegacyDiscriminatorBehavior(false); super.processOpts(); supportingFiles.add(new SupportingFile("utils.mustache", "", "utils.go")); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java index 8d2544c6af7f..6aa9c08250c9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java @@ -111,6 +111,8 @@ public PythonClientExperimentalCodegen() { @Override public void processOpts() { + this.setLegacyDiscriminatorBehavior(false); + super.processOpts(); supportingFiles.remove(new SupportingFile("api_client.mustache", packagePath(), "api_client.py")); diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index c438cd43eb72..653f44062d14 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -69,7 +69,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#vendorE private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vendorExtensions.x-is-jackson-optional-nullable}} diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index c69e7d5945ef..de25b7cf9754 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -643,9 +643,12 @@ class ApiClient(object): :param klass: class literal. :return: model object. """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and has_discriminator is False: return data kwargs = {} @@ -659,7 +662,7 @@ class ApiClient(object): instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if has_discriminator: klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/modules/openapi-generator/src/main/resources/python/model.mustache b/modules/openapi-generator/src/main/resources/python/model.mustache index 70f6e7489a7e..112246604dc5 100644 --- a/modules/openapi-generator/src/main/resources/python/model.mustache +++ b/modules/openapi-generator/src/main/resources/python/model.mustache @@ -52,8 +52,9 @@ class {{classname}}(object): {{#discriminator}} discriminator_value_class_map = { - {{#children}}'{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}}, - {{/-last}}{{/children}} +{{#children}} + '{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}},{{/-last}} +{{/children}} } {{/discriminator}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache index 60fff484ef40..8b49e58edbf2 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache @@ -115,15 +115,11 @@ @staticmethod def discriminator(): - return {{^discriminator}}None{{/discriminator}}{{#discriminator}}{ - '{{{discriminatorName}}}': { -{{#children}} - '{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': {{{classname}}}, -{{/children}} -{{^children}} + {{^discriminator}}return None{{/discriminator}}{{#discriminator}}val = { {{#mappedModels}} - '{{mappingName}}': {{{modelName}}}, + '{{mappingName}}': {{{modelName}}}, {{/mappedModels}} -{{/children}} - }, - }{{/discriminator}} \ No newline at end of file + } + if not val: + return None + return {'{{{discriminatorName}}}': val}{{/discriminator}} \ No newline at end of file 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 28fff725bb8a..bebe90010f73 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 @@ -33,6 +33,7 @@ import io.swagger.v3.oas.models.responses.ApiResponses; import io.swagger.v3.parser.core.models.ParseOptions; +import org.openapitools.codegen.languages.JavaClientCodegen; import org.openapitools.codegen.templating.mustache.CamelCaseLambda; import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.templating.mustache.LowercaseLambda; @@ -42,6 +43,7 @@ import org.testng.Assert; import org.testng.annotations.Test; +import java.io.File; import java.util.*; import java.util.stream.Collectors; @@ -569,6 +571,7 @@ public void testDiscriminator() { public void testDiscriminatorWithCustomMapping() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf.yaml"); DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); codegen.setOpenAPI(openAPI); String path = "/person/display/{personId}"; @@ -643,6 +646,570 @@ public void testAllParents() { Assert.assertEquals(adultModel.allParents, Collections.singletonList("Person")); } + @Test + public void testComposedSchemaAllOfDiscriminatorMap() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf_composition_discriminator.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + codegen.setLegacyDiscriminatorBehavior(false); + Schema sc; + String modelName; + + String propertyName = "petType"; + String propertyBaseName = propertyName; + CodegenDiscriminator emptyMapDisc = new CodegenDiscriminator(); + emptyMapDisc.setPropertyName(propertyName); + emptyMapDisc.setPropertyBaseName(propertyBaseName); + + // all leaf Schemas have discriminators with PropertyName/BaseName + empty discriminator maps + List<String> leafModelNames = Arrays.asList("Cat", "Dog", "Lizard", "Snake"); + for (String leafModelName: leafModelNames) { + Schema leafSc = openAPI.getComponents().getSchemas().get(leafModelName); + CodegenModel leafCm = codegen.fromModel(leafModelName, leafSc); + Assert.assertEquals(leafCm.discriminator, emptyMapDisc); + } + + // the Pet discriminator map contains all animals + Reptile (children + grandchildren) + CodegenDiscriminator petDisc = new CodegenDiscriminator(); + petDisc.setPropertyName(propertyName); + petDisc.setPropertyBaseName(propertyBaseName); + java.util.LinkedHashSet hs = new LinkedHashSet<>(); + for (String leafModelName: leafModelNames) { + hs.add(new CodegenDiscriminator.MappedModel(leafModelName, codegen.toModelName(leafModelName))); + } + hs.add(new CodegenDiscriminator.MappedModel("Reptile", codegen.toModelName("Reptile"))); + petDisc.setMappedModels(hs); + modelName = "Pet"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel pet = codegen.fromModel(modelName, sc); + Assert.assertEquals(pet.discriminator, petDisc); + + // the Reptile discriminator contains both reptiles + List<String> reptileModelNames = Arrays.asList("Lizard", "Snake"); + CodegenDiscriminator reptileDisc = new CodegenDiscriminator(); + reptileDisc.setPropertyName(propertyName); + reptileDisc.setPropertyBaseName(propertyBaseName); + hs.clear(); + for (String reptileModelName: reptileModelNames) { + hs.add(new CodegenDiscriminator.MappedModel(reptileModelName, codegen.toModelName(reptileModelName))); + } + reptileDisc.setMappedModels(hs); + modelName = "Reptile"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel reptile = codegen.fromModel(modelName, sc); + Assert.assertEquals(reptile.discriminator, reptileDisc); + + // the MyPets discriminator contains Cat and Lizard + List<String> myPetNames = Arrays.asList("Cat", "Lizard"); + CodegenDiscriminator myPetDisc = new CodegenDiscriminator(); + myPetDisc.setPropertyName(propertyName); + myPetDisc.setPropertyBaseName(propertyBaseName); + hs.clear(); + for (String myPetName: myPetNames) { + hs.add(new CodegenDiscriminator.MappedModel(myPetName, codegen.toModelName(myPetName))); + } + myPetDisc.setMappedModels(hs); + modelName = "MyPets"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel myPets = codegen.fromModel(modelName, sc); + Assert.assertEquals(myPets.discriminator, myPetDisc); + + // the MyPetsNoDisc discriminator is created because all oneOf classes have the same discriminator + modelName = "MyPetsNoDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel myPetsNoDisc = codegen.fromModel(modelName, sc); + Assert.assertEquals(myPetsNoDisc.discriminator, myPetDisc); + + CodegenModel cm; + + // the mapping in b is in A + modelName = "A"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs.clear(); + hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"))); + hs.add(new CodegenDiscriminator.MappedModel("B", codegen.toModelName("B"))); + hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C"))); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // the mapping in b is in B + modelName = "B"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs.clear(); + hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"))); + hs.add(new CodegenDiscriminator.MappedModel("C", codegen.toModelName("C"))); + + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // the mapping in b is in C + modelName = "C"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs.clear(); + hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"))); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + } + + @Test + public void testComposedSchemaAllOfDiscriminatorMapLegacy() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf_composition_discriminator.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + // codegen.discriminatorExplicitMappingVerbose remains false in the legacy use case + codegen.setOpenAPI(openAPI); + Schema sc; + String modelName; + + String propertyName = "petType"; + String propertyBaseName = propertyName; + CodegenDiscriminator emptyMapDisc = new CodegenDiscriminator(); + emptyMapDisc.setPropertyName(propertyName); + emptyMapDisc.setPropertyBaseName(propertyBaseName); + + // all leaf Schemas have discriminators with PropertyName/BaseName + empty discriminator maps + List<String> leafModelNames = Arrays.asList("Cat", "Dog", "Lizard", "Snake"); + for (String leafModelName: leafModelNames) { + Schema leafSc = openAPI.getComponents().getSchemas().get(leafModelName); + CodegenModel leafCm = codegen.fromModel(leafModelName, leafSc); + Assert.assertEquals(leafCm.discriminator, null); + } + + // the Pet discriminator map contains all animals + Reptile (children + grandchildren) + CodegenDiscriminator petDisc = new CodegenDiscriminator(); + petDisc.setPropertyName(propertyName); + petDisc.setPropertyBaseName(propertyBaseName); + java.util.LinkedHashSet hs = new LinkedHashSet<>(); + for (String leafModelName: leafModelNames) { + hs.add(new CodegenDiscriminator.MappedModel(leafModelName, codegen.toModelName(leafModelName))); + } + hs.add(new CodegenDiscriminator.MappedModel("Reptile", codegen.toModelName("Reptile"))); + petDisc.setMappedModels(hs); + modelName = "Pet"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel pet = codegen.fromModel(modelName, sc); + Assert.assertEquals(pet.discriminator, petDisc); + + // the Reptile discriminator contains both reptiles + List<String> reptileModelNames = Arrays.asList("Lizard", "Snake"); + CodegenDiscriminator reptileDisc = new CodegenDiscriminator(); + reptileDisc.setPropertyName(propertyName); + reptileDisc.setPropertyBaseName(propertyBaseName); + hs.clear(); + for (String reptileModelName: reptileModelNames) { + hs.add(new CodegenDiscriminator.MappedModel(reptileModelName, codegen.toModelName(reptileModelName))); + } + reptileDisc.setMappedModels(hs); + modelName = "Reptile"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel reptile = codegen.fromModel(modelName, sc); + Assert.assertEquals(reptile.discriminator, null); + + // the MyPets discriminator contains Cat and Lizard + CodegenDiscriminator myPetDisc = new CodegenDiscriminator(); + myPetDisc.setPropertyName(propertyName); + myPetDisc.setPropertyBaseName(propertyBaseName); + hs.clear(); + modelName = "MyPets"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel myPets = codegen.fromModel(modelName, sc); + Assert.assertEquals(myPets.discriminator, myPetDisc); + + // the MyPetsNoDisc discriminator is created because all oneOf classes have the same discriminator + modelName = "MyPetsNoDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + CodegenModel myPetsNoDisc = codegen.fromModel(modelName, sc); + Assert.assertEquals(myPetsNoDisc.discriminator, null); + + CodegenModel cm; + + // the mapping in b is in A + modelName = "A"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs.clear(); + hs.add(new CodegenDiscriminator.MappedModel("b", codegen.toModelName("B"))); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // the mapping in b is in B + modelName = "B"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + Assert.assertEquals(cm.discriminator, null); + + // the mapping in b is in C + modelName = "C"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + Assert.assertEquals(cm.discriminator, null); + } + + @Test + public void testComposedSchemaOneOfDiscriminatorsInvalid() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/oneOfDiscriminator.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); + codegen.setOpenAPI(openAPI); + + HashMap<String, String> hm = new HashMap<>(); + hm.put("ComposedDiscMissingNoProperties", "'ComposedDiscMissingNoProperties' defines discriminator 'fruitType', but the referenced schema 'DiscMissingNoProperties' is incorrect. fruitType is missing from the schema, define it as required and type string"); + hm.put("ComposedDiscMissingFromProperties", "'ComposedDiscMissingFromProperties' defines discriminator 'fruitType', but the referenced schema 'DiscMissingFromProperties' is incorrect. fruitType is missing from the schema, define it as required and type string"); + hm.put("ComposedDiscOptionalTypeCorrect", "'ComposedDiscOptionalTypeCorrect' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeCorrect' is incorrect. invalid optional definition of fruitType, include it in required"); + hm.put("ComposedDiscOptionalTypeIncorrect", "'ComposedDiscOptionalTypeIncorrect' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeIncorrect' is incorrect. invalid type for fruitType, set it to string. invalid optional definition of fruitType, include it in required"); + hm.put("ComposedDiscOptionalTypeInconsistent", "'ComposedDiscOptionalTypeInconsistent' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeIncorrect' is incorrect. invalid type for fruitType, set it to string. invalid optional definition of fruitType, include it in required"); + hm.put("ComposedDiscTypeIncorrect", "'ComposedDiscTypeIncorrect' defines discriminator 'fruitType', but the referenced schema 'DiscTypeIncorrect' is incorrect. invalid type for fruitType, set it to string"); + hm.put("ComposedDiscTypeInconsistent", "'ComposedDiscTypeInconsistent' defines discriminator 'fruitType', but the referenced schema 'DiscTypeIncorrect' is incorrect. invalid type for fruitType, set it to string"); + hm.put("ComposedDiscRequiredInconsistent", "'ComposedDiscRequiredInconsistent' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeCorrect' is incorrect. invalid optional definition of fruitType, include it in required"); + + for(Map.Entry<String, String> entry : hm.entrySet()) { + String modelName = entry.getKey(); + String errorMessageExpected = entry.getValue(); + + Schema sc = openAPI.getComponents().getSchemas().get(modelName); + + try { + codegen.fromModel(modelName, sc); + Assert.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not"); + } catch (RuntimeException re) { + Assert.assertEquals(re.getMessage(), errorMessageExpected); + } + } + } + + @Test + public void testComposedSchemaAnyOfDiscriminatorsInvalid() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/anyOfDiscriminator.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); + codegen.setOpenAPI(openAPI); + + HashMap<String, String> hm = new HashMap<>(); + hm.put("ComposedDiscMissingNoProperties", "'ComposedDiscMissingNoProperties' defines discriminator 'fruitType', but the referenced schema 'DiscMissingNoProperties' is incorrect. fruitType is missing from the schema, define it as required and type string"); + hm.put("ComposedDiscMissingFromProperties", "'ComposedDiscMissingFromProperties' defines discriminator 'fruitType', but the referenced schema 'DiscMissingFromProperties' is incorrect. fruitType is missing from the schema, define it as required and type string"); + hm.put("ComposedDiscOptionalTypeCorrect", "'ComposedDiscOptionalTypeCorrect' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeCorrect' is incorrect. invalid optional definition of fruitType, include it in required"); + hm.put("ComposedDiscOptionalTypeIncorrect", "'ComposedDiscOptionalTypeIncorrect' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeIncorrect' is incorrect. invalid type for fruitType, set it to string. invalid optional definition of fruitType, include it in required"); + hm.put("ComposedDiscOptionalTypeInconsistent", "'ComposedDiscOptionalTypeInconsistent' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeIncorrect' is incorrect. invalid type for fruitType, set it to string. invalid optional definition of fruitType, include it in required"); + hm.put("ComposedDiscTypeIncorrect", "'ComposedDiscTypeIncorrect' defines discriminator 'fruitType', but the referenced schema 'DiscTypeIncorrect' is incorrect. invalid type for fruitType, set it to string"); + hm.put("ComposedDiscTypeInconsistent", "'ComposedDiscTypeInconsistent' defines discriminator 'fruitType', but the referenced schema 'DiscTypeIncorrect' is incorrect. invalid type for fruitType, set it to string"); + hm.put("ComposedDiscRequiredInconsistent", "'ComposedDiscRequiredInconsistent' defines discriminator 'fruitType', but the referenced schema 'DiscOptionalTypeCorrect' is incorrect. invalid optional definition of fruitType, include it in required"); + + for(Map.Entry<String, String> entry : hm.entrySet()) { + String modelName = entry.getKey(); + String errorMessageExpected = entry.getValue(); + + Schema sc = openAPI.getComponents().getSchemas().get(modelName); + + try { + codegen.fromModel(modelName, sc); + Assert.assertTrue(false, "A RuntimeException should have been thrown when processing "+modelName+ " but it was not"); + } catch (RuntimeException re) { + Assert.assertEquals(re.getMessage(), errorMessageExpected); + } + } + } + + @Test + public void testComposedSchemaAnyOfDiscriminatorMap() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/anyOfDiscriminator.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); + codegen.setOpenAPI(openAPI); + + String modelName; + Schema sc; + CodegenModel cm; + java.util.LinkedHashSet hs; + String mn; + + // inline anyOf models work because the inline schemas are turned into $refs + modelName = "FruitInlineDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "FruitInlineDisc_anyOf"; + hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn))); + mn = "FruitInlineDisc_anyOf_1"; + hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn))); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // inline anyOf with inline anyOf model doesn't work because we have null $refs and we throw an exception + final String fmodelName = "FruitInlineInlineDisc"; + final Schema fsc = openAPI.getComponents().getSchemas().get(fmodelName); + Assert.assertThrows(() -> codegen.fromModel(fmodelName, fsc)); + + // ref anyOf models with discriminator in properties in those models + modelName = "FruitReqDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleReqDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaReqDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in allOf in those models + modelName = "FruitAllOfDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleAllOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaAllOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in anyOf in those models + modelName = "FruitAnyOfDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleAnyOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaAnyOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in anyOf in those models + modelName = "FruitAnyOfDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleAnyOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaAnyOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in the grandparent schemas of those anyof models + modelName = "FruitGrandparentDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleGrandparentDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaGrandparentDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + } + + @Test + public void testComposedSchemaOneOfDiscriminatorMap() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/oneOfDiscriminator.yaml"); + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); + codegen.setOpenAPI(openAPI); + + String modelName; + Schema sc; + CodegenModel cm; + java.util.LinkedHashSet hs; + String mn; + + // inline oneOf models work because the inline schemas are turned into $refs + modelName = "FruitInlineDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "FruitInlineDisc_oneOf"; + hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn))); + mn = "FruitInlineDisc_oneOf_1"; + hs.add(new CodegenDiscriminator.MappedModel(mn, codegen.toModelName(mn))); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // inline oneOf with inline oneOf model doesn't work because we have null $refs and we throw an exception + final String fmodelName = "FruitInlineInlineDisc"; + final Schema fsc = openAPI.getComponents().getSchemas().get(fmodelName); + Assert.assertThrows(() -> codegen.fromModel(fmodelName, fsc)); + + // ref oneOf models with discriminator in properties in those models + modelName = "FruitReqDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleReqDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaReqDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in allOf in those models + modelName = "FruitAllOfDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleAllOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaAllOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in anyOf in those models + modelName = "FruitAnyOfDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleAnyOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaAnyOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in oneOf in those models + modelName = "FruitOneOfDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleOneOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaOneOfDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + + // ref oneOf models with discriminator in the grandparent schemas of those oneof models + modelName = "FruitGrandparentDisc"; + sc = openAPI.getComponents().getSchemas().get(modelName); + cm = codegen.fromModel(modelName, sc); + hs = new java.util.LinkedHashSet(); + mn = "AppleGrandparentDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + mn = "BananaGrandparentDisc"; + hs.add(new CodegenDiscriminator.MappedModel(mn, mn)); + Assert.assertEquals(cm.discriminator.getMappedModels(), hs); + } + + @Test + public void testComposedSchemaMyPetsOneOfDiscriminatorMap() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf_composition_discriminator.yaml"); + + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); + codegen.setOpenAPI(openAPI); + + String path = "/mypets"; + + Operation operation = openAPI.getPaths().get(path).getGet(); + CodegenOperation codegenOperation = codegen.fromOperation(path, "GET", operation, null); + verifyMyPetsDiscriminator(codegenOperation.discriminator); + + Schema pet = openAPI.getComponents().getSchemas().get("MyPets"); + CodegenModel petModel = codegen.fromModel("MyPets", pet); + verifyMyPetsDiscriminator(petModel.discriminator); + } + + @Test + public void testComposedSchemaAllOfHierarchy(){ + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf_composition_discriminator.yaml"); + + DefaultCodegen codegen = new DefaultCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); + codegen.setOpenAPI(openAPI); + + Schema pet = openAPI.getComponents().getSchemas().get("Lizard"); + CodegenModel petModel = codegen.fromModel("Lizard", pet); + verifyLizardDiscriminator(petModel.discriminator); + + pet = openAPI.getComponents().getSchemas().get("Reptile"); + petModel = codegen.fromModel("Reptile", pet); + verifyReptileDiscriminator(petModel.discriminator); + } + + private void verifyLizardDiscriminator(CodegenDiscriminator discriminator) { + CodegenDiscriminator test = new CodegenDiscriminator(); + String prop = "petType"; + test.setPropertyName(prop); + test.setPropertyBaseName(prop); + test.setMapping(null); + test.setMappedModels(new HashSet<>()); + assertEquals(discriminator, test); + } + + private void verifyReptileDiscriminator(CodegenDiscriminator discriminator) { + CodegenDiscriminator test = new CodegenDiscriminator(); + String prop = "petType"; + test.setPropertyName(prop); + test.setPropertyBaseName(prop); + test.setMapping(null); + test.setMappedModels(new HashSet<CodegenDiscriminator.MappedModel>(){{ + add(new CodegenDiscriminator.MappedModel("Snake", "Snake")); + add(new CodegenDiscriminator.MappedModel("Lizard", "Lizard")); + }}); + assertEquals(discriminator, test); + } + + private void verifyMyPetsDiscriminator(CodegenDiscriminator discriminator) { + CodegenDiscriminator test = new CodegenDiscriminator(); + String prop = "petType"; + test.setPropertyName(prop); + test.setPropertyBaseName(prop); + test.setMapping(null); + test.setMappedModels(new HashSet<CodegenDiscriminator.MappedModel>(){{ + add(new CodegenDiscriminator.MappedModel("Cat", "Cat")); + add(new CodegenDiscriminator.MappedModel("Lizard", "Lizard")); + }}); + assertEquals(discriminator, test); + } + + public CodegenModel getModel(List<Object> allModels, String modelName) { + for (Object obj: allModels) { + HashMap<String, Object> hm = (HashMap<String, Object>) obj; + CodegenModel cm = (CodegenModel) hm.get("model"); + if (modelName.equals(cm.name)) { + return cm; + } + } + return null; + } + + @Test + public void verifyXDiscriminatorValue() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/x-discriminator-value.yaml"); + final DefaultCodegen config = new DefaultCodegen(); + config.setOpenAPI(openAPI); + + String modelName; + CodegenDiscriminator discriminator; + Schema sc; + CodegenModel cm; + + Boolean dryRun = Boolean.TRUE; + final DefaultGenerator generator = new DefaultGenerator(dryRun); + generator.openAPI = openAPI; + generator.config = config; + generator.configureGeneratorProperties(); + + // for us to check a model's children we need to run generator.generateModels + // because children are assigned in config.updateAllModels which is invoked in generator.generateModels + List<File> files = new ArrayList<>(); + List<String> filteredSchemas = ModelUtils.getSchemasUsedOnlyInFormParam(openAPI); + List<Object> allModels = new ArrayList<>(); + generator.generateModels(files, allModels, filteredSchemas); + + // check that the model's children contain the x-discriminator-values + modelName = "BaseObj"; + cm = getModel(allModels, modelName); + List<String> excpectedDiscriminatorValues = new ArrayList<>(Arrays.asList("daily", "sub-obj")); + ArrayList<String> xDiscriminatorValues = new ArrayList<>(); + for (CodegenModel child: cm.children) { + xDiscriminatorValues.add((String) child.vendorExtensions.get("x-discriminator-value")); + } + assertEquals(xDiscriminatorValues, excpectedDiscriminatorValues); + + // check that the discriminator's MappedModels also contains the x-discriminator-values + discriminator = new CodegenDiscriminator(); + String prop = "object_type"; + discriminator.setPropertyName(config.toVarName(prop)); + discriminator.setPropertyBaseName(prop); + discriminator.setMapping(null); + discriminator.setMappedModels(new HashSet<CodegenDiscriminator.MappedModel>(){{ + add(new CodegenDiscriminator.MappedModel("DailySubObj", "DailySubObj")); + add(new CodegenDiscriminator.MappedModel("SubObj", "SubObj")); + add(new CodegenDiscriminator.MappedModel("daily", "DailySubObj")); + add(new CodegenDiscriminator.MappedModel("sub-obj", "SubObj")); + }}); + assertEquals(cm.discriminator, discriminator); + } + + @Test public void testAllOfSingleRefNoOwnProps() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/composed-allof.yaml"); @@ -1033,6 +1600,8 @@ private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) { test.getMapping().put("c", "Child"); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("a", "Adult")); test.getMappedModels().add(new CodegenDiscriminator.MappedModel("c", "Child")); + test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Adult", "Adult")); + test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Child", "Child")); Assert.assertEquals(discriminator, test); } @@ -1139,8 +1708,7 @@ public void modelDoNotContainInheritedVars() { DefaultCodegen codegen = new DefaultCodegen(); codegen.supportsInheritance = true; - OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/generic.yaml"); codegen.setOpenAPI(openAPI); CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog")); @@ -1169,8 +1737,7 @@ public void modelWithPrefixDoNotContainInheritedVars() { codegen.supportsInheritance = true; codegen.setModelNamePrefix("prefix"); - OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/generic.yaml"); codegen.setOpenAPI(openAPI); CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog")); @@ -1184,8 +1751,7 @@ public void modelWithSuffixDoNotContainInheritedVars() { codegen.supportsInheritance = true; codegen.setModelNameSuffix("suffix"); - OpenAPI openAPI = new OpenAPIParser() - .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/generic.yaml"); codegen.setOpenAPI(openAPI); CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog")); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/BashClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/BashClientOptionsProvider.java index 17fddc4cfb6b..45b03efcccef 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/BashClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/BashClientOptionsProvider.java @@ -70,6 +70,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, "false") .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java index 226389505b0a..79cf084234f1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java @@ -62,6 +62,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(DartClientCodegen.SUPPORT_DART2, "false") + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java index da24d2e195a7..9e54e028f7ff 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java @@ -67,6 +67,7 @@ public Map<String, String> createOptions() { .put(DartDioClientCodegen.SUPPORT_DART2, "false") .put(DartDioClientCodegen.DATE_LIBRARY, DATE_LIBRARY) .put(DartDioClientCodegen.NULLABLE_FIELDS, NULLABLE_FIELDS) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ElixirClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ElixirClientOptionsProvider.java index 0a0f86e4eeb7..f6efa94aa517 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ElixirClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ElixirClientOptionsProvider.java @@ -43,6 +43,7 @@ public Map<String, String> createOptions() { .put("licenseHeader", "# Copyright 2017 Me\n#\n# Licensed under the Apache License") .put(CodegenConstants.PACKAGE_NAME, "yay_pets") .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/HaskellServantOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/HaskellServantOptionsProvider.java index 15a466650963..f883ebbed197 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/HaskellServantOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/HaskellServantOptionsProvider.java @@ -48,6 +48,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(HaskellServantCodegen.PROP_SERVE_STATIC, HaskellServantCodegen.PROP_SERVE_STATIC_DEFAULT.toString()) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java index b1aed3e446eb..245957be4076 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java @@ -58,6 +58,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java index 8f2c1d574ff9..97ad8132ce43 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java @@ -57,6 +57,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSilexServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSilexServerOptionsProvider.java index faf3992c99df..a3f32f9b4a00 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSilexServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSilexServerOptionsProvider.java @@ -42,6 +42,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java index 98c1ded49d28..4bf91932a3f0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java @@ -60,6 +60,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(PhpSlim4ServerCodegen.PSR7_IMPLEMENTATION, PSR7_IMPLEMENTATION_VALUE) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java index 70eed81c9e2f..537b7b10c664 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java @@ -57,6 +57,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/RubyClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/RubyClientOptionsProvider.java index dce16e7245da..09bd0dceabc1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/RubyClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/RubyClientOptionsProvider.java @@ -66,6 +66,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(CodegenConstants.LIBRARY, LIBRARY) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaAkkaClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaAkkaClientOptionsProvider.java index f9ac4d5ee3b4..4b982932b98a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaAkkaClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaAkkaClientOptionsProvider.java @@ -55,6 +55,7 @@ public Map<String, String> createOptions() { .put("mainPackage", MAIN_PACKAGE_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING) .put("dateLibrary", DATE_LIBRARY) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java index c128ea1bba77..11825e2ec129 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/ScalaHttpClientOptionsProvider.java @@ -52,6 +52,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put("dateLibrary", DATE_LIBRARY) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift3OptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift3OptionsProvider.java index 6e496e915af6..d83863cd7391 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift3OptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift3OptionsProvider.java @@ -79,6 +79,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java index 87c2ecbebd3f..aa2d61f28294 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift4OptionsProvider.java @@ -81,6 +81,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java index 3f85681caa68..d5cd8cbe38e8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java @@ -80,6 +80,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(CodegenConstants.API_NAME_PREFIX, "") .put(CodegenConstants.LIBRARY, LIBRARY_VALUE) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java index 5635465a6322..51b62748e3c5 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java @@ -81,6 +81,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(TypeScriptAngularClientCodegen.FILE_NAMING, FILE_NAMING_VALUE) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java index 2ab399a12bb1..1e008de1ed16 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java @@ -53,6 +53,7 @@ public Map<String, String> createOptions() { .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java index 9c72ca44ab9f..58b5aa61826a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java @@ -59,6 +59,7 @@ public Map<String, String> createOptions() { .put(TypeScriptAureliaClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java index 196e220fb328..7bec81c9ae36 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -66,6 +66,7 @@ public Map<String, String> createOptions() { .put(TypeScriptFetchClientCodegen.TYPESCRIPT_THREE_PLUS, TYPESCRIPT_THREE_PLUS) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java index 23da17ea1c49..a2dc76d63f41 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java @@ -63,6 +63,7 @@ public Map<String, String> createOptions() { .put(TypeScriptAngularClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .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") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index 7191f6e5ee0c..cdde6ddc8f37 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -363,6 +363,7 @@ public void oneOfTest() { public void allOfTest() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf.yaml"); final RubyClientCodegen codegen = new RubyClientCodegen(); + codegen.setLegacyDiscriminatorBehavior(false); codegen.setModuleName("OnlinePetstore"); final Schema schema = openAPI.getComponents().getSchemas().get("Person"); @@ -372,10 +373,29 @@ public void allOfTest() { CodegenDiscriminator codegenDiscriminator = person.getDiscriminator(); Set<CodegenDiscriminator.MappedModel> mappedModels = new LinkedHashSet<CodegenDiscriminator.MappedModel>(); - CodegenDiscriminator.MappedModel adult = new CodegenDiscriminator.MappedModel("a", "Adult"); - mappedModels.add(adult); - CodegenDiscriminator.MappedModel child = new CodegenDiscriminator.MappedModel("c", "Child"); - mappedModels.add(child); + mappedModels.add(new CodegenDiscriminator.MappedModel("a", "Adult")); + mappedModels.add(new CodegenDiscriminator.MappedModel("c", "Child")); + mappedModels.add(new CodegenDiscriminator.MappedModel("Adult", "Adult")); + mappedModels.add(new CodegenDiscriminator.MappedModel("Child", "Child")); + Assert.assertEquals(codegenDiscriminator.getMappedModels(), mappedModels); + } + + @Test(description = "test allOf (OAS3)") + public void allOfTestLegacy() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/allOf.yaml"); + final RubyClientCodegen codegen = new RubyClientCodegen(); + // codegen.discriminatorExplicitMappingVerbose == false by default + codegen.setModuleName("OnlinePetstore"); + + final Schema schema = openAPI.getComponents().getSchemas().get("Person"); + codegen.setOpenAPI(openAPI); + CodegenModel person = codegen.fromModel("Person", schema); + Assert.assertNotNull(person); + + CodegenDiscriminator codegenDiscriminator = person.getDiscriminator(); + Set<CodegenDiscriminator.MappedModel> mappedModels = new LinkedHashSet<CodegenDiscriminator.MappedModel>(); + mappedModels.add(new CodegenDiscriminator.MappedModel("a", "Adult")); + mappedModels.add(new CodegenDiscriminator.MappedModel("c", "Child")); Assert.assertEquals(codegenDiscriminator.getMappedModels(), mappedModels); } diff --git a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml index 7397e6c5d5fc..ba8906a1a2dd 100644 --- a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml @@ -2077,12 +2077,11 @@ definitions: properties: pet_type: type: string + discriminator: pet_type ParentPet: type: object allOf: - $ref: '#/definitions/GrandparentAnimal' - - type: object - discriminator: pet_type ChildCat: allOf: - $ref: '#/definitions/ParentPet' diff --git a/modules/openapi-generator/src/test/resources/2_0/x-discriminator-value.yaml b/modules/openapi-generator/src/test/resources/2_0/x-discriminator-value.yaml new file mode 100644 index 000000000000..9dc4dea3e293 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/2_0/x-discriminator-value.yaml @@ -0,0 +1,66 @@ +swagger: '2.0' +info: + description: 'blah' + version: 1.0.0 + title: sample spec +host: fake.site.com +tags: [] +schemes: + - https +paths: + /numberdata: + post: + operationId: getNumberHolder + consumes: + - application/json + produces: + - application/json + parameters: [] + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/BaseObj' +securityDefinitions: {} +definitions: + BaseObj: + type: object + discriminator: object_type + required: + - id + - object_type + properties: + id: + type: integer + format: int64 + object_type: + type: string + SubObjType: + type: string + enum: + - daily + - monthly + - quarterly + - yearly + SubObj: + x-discriminator-value: sub-obj + allOf: + - $ref: '#/definitions/BaseObj' + - type: object + discriminator: sub_obj_type + required: + - sub_obj_type + properties: + sub_obj_type: + $ref: '#/definitions/SubObjType' + name: + type: string + DailySubObj: + x-discriminator-value: daily + allOf: + - $ref: '#/definitions/SubObj' + - type: object + properties: + day_of_month: + type: integer + format: int32 \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/allOf_composition_discriminator.yaml b/modules/openapi-generator/src/test/resources/3_0/allOf_composition_discriminator.yaml new file mode 100644 index 000000000000..efeaa5fd02e9 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/allOf_composition_discriminator.yaml @@ -0,0 +1,103 @@ +openapi: 3.0.2 +info: + title: OAI Specification example for Polymorphism + version: 1.0.0 +paths: + /pet: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + /reptile: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/Reptile' + /mypets: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/MyPets' +components: + schemas: + Pet: + type: object + required: + - petType + properties: + petType: + type: string + discriminator: + propertyName: petType + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + name: + type: string + Reptile: + allOf: + - $ref: '#/components/schemas/Pet' + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - type: object + properties: + bark: + type: string + Lizard: + allOf: + - $ref: '#/components/schemas/Reptile' + - type: object + properties: + lovesRocks: + type: boolean + Snake: + allOf: + - $ref: '#/components/schemas/Reptile' + - type: object + properties: + hasLegs: + type: boolean + MyPets: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + discriminator: + propertyName: petType + # per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject + # this discriminator must be included to use it as a hint to pick a schema + MyPetsNoDisc: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + A: + type: object + required: + - petType + properties: + petType: + type: string + discriminator: + propertyName: petType + mapping: + b: '#/components/schemas/B' + B: + allOf: + - $ref: '#/components/schemas/A' + C: + allOf: + - $ref: '#/components/schemas/B' diff --git a/modules/openapi-generator/src/test/resources/3_0/anyOfDiscriminator.yaml b/modules/openapi-generator/src/test/resources/3_0/anyOfDiscriminator.yaml new file mode 100644 index 000000000000..72fa6abbb7d1 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/anyOfDiscriminator.yaml @@ -0,0 +1,244 @@ +openapi: 3.0.1 +info: + title: fruity + version: 0.0.1 +paths: + /: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/FruitAllOfDisc' +components: + schemas: + FruitType: + properties: + fruitType: + type: string + required: + - fruitType + FruitInlineDisc: + anyOf: + - type: object + required: + - seeds + - fruitType + properties: + seeds: + type: integer + fruitType: + type: string + - type: object + required: + - length + - fruitType + properties: + length: + type: integer + fruitType: + type: string + discriminator: + propertyName: fruitType + FruitInlineInlineDisc: + anyOf: + - type: object + required: + - seeds + properties: + seeds: + type: integer + anyOf: + - type: object + properties: + fruitType: + type: string + required: + - fruitType + - type: object + required: + - length + properties: + length: + type: integer + anyOf: + - type: object + properties: + fruitType: + type: string + required: + - fruitType + discriminator: + propertyName: fruitType + FruitReqDisc: + anyOf: + - $ref: '#/components/schemas/AppleReqDisc' + - $ref: '#/components/schemas/BananaReqDisc' + discriminator: + propertyName: fruitType + AppleReqDisc: + type: object + required: + - seeds + - fruitType + properties: + seeds: + type: integer + fruitType: + type: string + BananaReqDisc: + type: object + required: + - length + - fruitType + properties: + length: + type: integer + fruitType: + type: string + FruitAllOfDisc: + anyOf: + - $ref: '#/components/schemas/AppleAllOfDisc' + - $ref: '#/components/schemas/BananaAllOfDisc' + discriminator: + propertyName: fruitType + AppleAllOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + allOf: + - $ref: '#/components/schemas/FruitType' + BananaAllOfDisc: + type: object + required: + - length + properties: + length: + type: integer + allOf: + - $ref: '#/components/schemas/FruitType' + FruitAnyOfDisc: + anyOf: + - $ref: '#/components/schemas/AppleAnyOfDisc' + - $ref: '#/components/schemas/BananaAnyOfDisc' + discriminator: + propertyName: fruitType + AppleAnyOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + anyOf: + - $ref: '#/components/schemas/FruitType' + BananaAnyOfDisc: + type: object + required: + - length + properties: + length: + type: integer + anyOf: + - $ref: '#/components/schemas/FruitType' + FruitGrandparentDisc: + anyOf: + - $ref: '#/components/schemas/AppleGrandparentDisc' + - $ref: '#/components/schemas/BananaGrandparentDisc' + discriminator: + propertyName: fruitType + Parent: + type: object + allOf: + # the FruitType schema is a grandparent of AppleGrandparentDisc + BananaGrandparentDisc + - $ref: '#/components/schemas/FruitType' + AppleGrandparentDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + allOf: + - $ref: '#/components/schemas/Parent' + BananaGrandparentDisc: + type: object + required: + - length + properties: + length: + type: integer + allOf: + - $ref: '#/components/schemas/Parent' + ComposedDiscMissingNoProperties: + anyOf: + - $ref: '#/components/schemas/DiscMissingNoProperties' + discriminator: + propertyName: fruitType + DiscMissingNoProperties: + type: object + ComposedDiscMissingFromProperties: + anyOf: + - $ref: '#/components/schemas/DiscMissingFromProperties' + discriminator: + propertyName: fruitType + DiscMissingFromProperties: + type: object + properties: + length: + type: integer + ComposedDiscOptionalTypeCorrect: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + discriminator: + propertyName: fruitType + DiscOptionalTypeCorrect: + type: object + properties: + fruitType: + type: string + ComposedDiscOptionalTypeIncorrect: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + discriminator: + propertyName: fruitType + DiscOptionalTypeIncorrect: + type: object + properties: + fruitType: + type: integer + ComposedDiscOptionalTypeInconsistent: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + discriminator: + propertyName: fruitType + ComposedDiscTypeIncorrect: + anyOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + discriminator: + propertyName: fruitType + DiscTypeIncorrect: + type: object + properties: + fruitType: + type: integer + required: + - fruitType + ComposedDiscTypeInconsistent: + anyOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + - $ref: '#/components/schemas/FruitType' + discriminator: + propertyName: fruitType + ComposedDiscRequiredInconsistent: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + - $ref: '#/components/schemas/FruitType' + discriminator: + propertyName: fruitType \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/oneOfDiscriminator.yaml b/modules/openapi-generator/src/test/resources/3_0/oneOfDiscriminator.yaml new file mode 100644 index 000000000000..e9a342980749 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/oneOfDiscriminator.yaml @@ -0,0 +1,268 @@ +openapi: 3.0.1 +info: + title: fruity + version: 0.0.1 +paths: + /: + get: + responses: + '200': + description: desc + content: + application/json: + schema: + $ref: '#/components/schemas/FruitAllOfDisc' +components: + schemas: + FruitType: + properties: + fruitType: + type: string + required: + - fruitType + FruitInlineDisc: + oneOf: + - type: object + required: + - seeds + - fruitType + properties: + seeds: + type: integer + fruitType: + type: string + - type: object + required: + - length + - fruitType + properties: + length: + type: integer + fruitType: + type: string + discriminator: + propertyName: fruitType + FruitInlineInlineDisc: + oneOf: + - type: object + required: + - seeds + properties: + seeds: + type: integer + oneOf: + - type: object + properties: + fruitType: + type: string + required: + - fruitType + - type: object + required: + - length + properties: + length: + type: integer + oneOf: + - type: object + properties: + fruitType: + type: string + required: + - fruitType + discriminator: + propertyName: fruitType + FruitReqDisc: + oneOf: + - $ref: '#/components/schemas/AppleReqDisc' + - $ref: '#/components/schemas/BananaReqDisc' + discriminator: + propertyName: fruitType + AppleReqDisc: + type: object + required: + - seeds + - fruitType + properties: + seeds: + type: integer + fruitType: + type: string + BananaReqDisc: + type: object + required: + - length + - fruitType + properties: + length: + type: integer + fruitType: + type: string + FruitAllOfDisc: + oneOf: + - $ref: '#/components/schemas/AppleAllOfDisc' + - $ref: '#/components/schemas/BananaAllOfDisc' + discriminator: + propertyName: fruitType + AppleAllOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + allOf: + - $ref: '#/components/schemas/FruitType' + BananaAllOfDisc: + type: object + required: + - length + properties: + length: + type: integer + allOf: + - $ref: '#/components/schemas/FruitType' + FruitAnyOfDisc: + oneOf: + - $ref: '#/components/schemas/AppleAnyOfDisc' + - $ref: '#/components/schemas/BananaAnyOfDisc' + discriminator: + propertyName: fruitType + AppleAnyOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + anyOf: + - $ref: '#/components/schemas/FruitType' + BananaAnyOfDisc: + type: object + required: + - length + properties: + length: + type: integer + anyOf: + - $ref: '#/components/schemas/FruitType' + FruitOneOfDisc: + oneOf: + - $ref: '#/components/schemas/AppleOneOfDisc' + - $ref: '#/components/schemas/BananaOneOfDisc' + discriminator: + propertyName: fruitType + AppleOneOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + oneOf: + - $ref: '#/components/schemas/FruitType' + BananaOneOfDisc: + type: object + required: + - length + properties: + length: + type: integer + oneOf: + - $ref: '#/components/schemas/FruitType' + FruitGrandparentDisc: + oneOf: + - $ref: '#/components/schemas/AppleGrandparentDisc' + - $ref: '#/components/schemas/BananaGrandparentDisc' + discriminator: + propertyName: fruitType + Parent: + type: object + allOf: + # the FruitType schema is a grandparent of AppleGrandparentDisc + BananaGrandparentDisc + - $ref: '#/components/schemas/FruitType' + AppleGrandparentDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + allOf: + - $ref: '#/components/schemas/Parent' + BananaGrandparentDisc: + type: object + required: + - length + properties: + length: + type: integer + allOf: + - $ref: '#/components/schemas/Parent' + ComposedDiscMissingNoProperties: + oneOf: + - $ref: '#/components/schemas/DiscMissingNoProperties' + discriminator: + propertyName: fruitType + DiscMissingNoProperties: + type: object + ComposedDiscMissingFromProperties: + oneOf: + - $ref: '#/components/schemas/DiscMissingFromProperties' + discriminator: + propertyName: fruitType + DiscMissingFromProperties: + type: object + properties: + length: + type: integer + ComposedDiscOptionalTypeCorrect: + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + discriminator: + propertyName: fruitType + DiscOptionalTypeCorrect: + type: object + properties: + fruitType: + type: string + ComposedDiscOptionalTypeIncorrect: + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + discriminator: + propertyName: fruitType + DiscOptionalTypeIncorrect: + type: object + properties: + fruitType: + type: integer + ComposedDiscOptionalTypeInconsistent: + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + discriminator: + propertyName: fruitType + ComposedDiscTypeIncorrect: + oneOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + discriminator: + propertyName: fruitType + DiscTypeIncorrect: + type: object + properties: + fruitType: + type: integer + required: + - fruitType + ComposedDiscTypeInconsistent: + oneOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + - $ref: '#/components/schemas/FruitType' + discriminator: + propertyName: fruitType + ComposedDiscRequiredInconsistent: + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + - $ref: '#/components/schemas/FruitType' + discriminator: + propertyName: fruitType 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 00db7a1b7b6d..ff1964caa4bb 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 @@ -43,7 +43,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java index e0ae875483bd..bbadf265ba6b 100644 --- a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java index b5b4f315c165..345d77346315 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java @@ -41,7 +41,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java index e0ae875483bd..bbadf265ba6b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java index e0ae875483bd..bbadf265ba6b 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 1367d6dd7886..4b6c177d34a2 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 @@ -34,7 +34,7 @@ public class Animal implements Parcelable { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) 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 af469dda3f40..cea2ff5988d7 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 @@ -32,7 +32,7 @@ public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) 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 57dad620ef0a..0390cab3e8c3 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 @@ -45,7 +45,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 bb64354ab52e..4cbc678b5321 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 @@ -35,7 +35,7 @@ public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 af9c0df70387..87a9c706f4a9 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 @@ -48,7 +48,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; @XmlElement(name = "className") - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; @XmlElement(name = "color") 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java index af469dda3f40..cea2ff5988d7 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java index 38b0a1b2f159..e93cac2705d0 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java @@ -44,7 +44,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java index 38b0a1b2f159..e93cac2705d0 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java @@ -44,7 +44,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 38b0a1b2f159..e93cac2705d0 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 @@ -44,7 +44,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 af469dda3f40..cea2ff5988d7 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 @@ -32,7 +32,7 @@ public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java index af469dda3f40..cea2ff5988d7 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) 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 af469dda3f40..cea2ff5988d7 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 @@ -32,7 +32,7 @@ public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className; + protected String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; 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 e0ae875483bd..bbadf265ba6b 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 @@ -42,7 +42,7 @@ public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; - private String className; + protected String className; public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; diff --git a/samples/client/petstore/python-asyncio/petstore_api/api_client.py b/samples/client/petstore/python-asyncio/petstore_api/api_client.py index bed70584efb9..8aae783bfc3b 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api_client.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api_client.py @@ -625,9 +625,12 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and has_discriminator is False: return data kwargs = {} @@ -641,7 +644,7 @@ def __deserialize_model(self, data, klass): instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if has_discriminator: klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/client/petstore/python-experimental/petstore_api/models/animal.py index 45058ec7612f..39dd9789ff8b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/animal.py @@ -90,12 +90,13 @@ def openapi_types(): @staticmethod def discriminator(): - return { - 'class_name': { - 'Cat': cat.Cat, - 'Dog': dog.Dog, - }, + val = { + 'Cat': cat.Cat, + 'Dog': dog.Dog, } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/client/petstore/python-experimental/petstore_api/models/cat.py index d40464eaf0e9..3f3c2384ec22 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat.py @@ -91,7 +91,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 @@ -194,3 +198,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py index b83986bd68a8..e7894c9c7af4 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py @@ -90,7 +90,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'pet_type': val} attribute_map = { 'pet_type': 'pet_type', # noqa: E501 @@ -191,3 +195,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py b/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py index da568bd7d271..8544773e8843 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py @@ -90,7 +90,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'pet_type': val} attribute_map = { 'pet_type': 'pet_type', # noqa: E501 @@ -191,3 +195,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py index 62fa11f26e80..681e99ae6665 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py @@ -90,7 +90,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'pet_type': val} attribute_map = { 'pet_type': 'pet_type', # noqa: E501 @@ -191,3 +195,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/client/petstore/python-experimental/petstore_api/models/dog.py index 69af821b27e2..5d5712d428e9 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog.py @@ -91,7 +91,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 @@ -194,3 +198,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py index af25951ed73a..db7e6f33887d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py @@ -29,6 +29,26 @@ str, validate_get_composed_info, ) +try: + from petstore_api.models import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.models.child_cat'] +try: + from petstore_api.models import child_dog +except ImportError: + child_dog = sys.modules[ + 'petstore_api.models.child_dog'] +try: + from petstore_api.models import child_lizard +except ImportError: + child_lizard = sys.modules[ + 'petstore_api.models.child_lizard'] +try: + from petstore_api.models import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.models.parent_pet'] class GrandparentAnimal(ModelNormal): @@ -79,7 +99,15 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + 'ChildCat': child_cat.ChildCat, + 'ChildDog': child_dog.ChildDog, + 'ChildLizard': child_lizard.ChildLizard, + 'ParentPet': parent_pet.ParentPet, + } + if not val: + return None + return {'pet_type': val} attribute_map = { 'pet_type': 'pet_type', # noqa: E501 @@ -134,3 +162,16 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item # discard variable. continue setattr(self, var_name, var_value) + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py index cdb96676c555..e7f2a6fb63f9 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py @@ -99,13 +99,14 @@ def openapi_types(): @staticmethod def discriminator(): - return { - 'pet_type': { - 'ChildCat': child_cat.ChildCat, - 'ChildDog': child_dog.ChildDog, - 'ChildLizard': child_lizard.ChildLizard, - }, + val = { + 'ChildCat': child_cat.ChildCat, + 'ChildDog': child_dog.ChildDog, + 'ChildLizard': child_lizard.ChildLizard, } + if not val: + return None + return {'pet_type': val} attribute_map = { 'pet_type': 'pet_type', # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api_client.py b/samples/client/petstore/python-tornado/petstore_api/api_client.py index 6b9c738128fd..328c1a70e10e 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api_client.py +++ b/samples/client/petstore/python-tornado/petstore_api/api_client.py @@ -626,9 +626,12 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and has_discriminator is False: return data kwargs = {} @@ -642,7 +645,7 @@ def __deserialize_model(self, data, klass): instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if has_discriminator: klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index c0564c598f13..a80084e04b0f 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -624,9 +624,12 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and has_discriminator is False: return data kwargs = {} @@ -640,7 +643,7 @@ def __deserialize_model(self, data, klass): instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if has_discriminator: klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py index 45058ec7612f..39dd9789ff8b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py @@ -90,12 +90,13 @@ def openapi_types(): @staticmethod def discriminator(): - return { - 'class_name': { - 'Cat': cat.Cat, - 'Dog': dog.Dog, - }, + val = { + 'Cat': cat.Cat, + 'Dog': dog.Dog, } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py index 92076d35c068..c3641a6862b9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py @@ -96,7 +96,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 @@ -200,3 +204,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py index 69af821b27e2..5d5712d428e9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py @@ -91,7 +91,11 @@ def openapi_types(): @staticmethod def discriminator(): - return None + val = { + } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 @@ -194,3 +198,16 @@ def _composed_schemas(): 'oneOf': [ ], } + + @classmethod + def get_discriminator_class(cls, from_server, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator() + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if from_server: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py index 303838fd7d4b..d5ee114fe25f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py @@ -97,12 +97,13 @@ def openapi_types(): @staticmethod def discriminator(): - return { - 'class_name': { - 'whale': whale.Whale, - 'zebra': zebra.Zebra, - }, + val = { + 'whale': whale.Whale, + 'zebra': zebra.Zebra, } + if not val: + return None + return {'class_name': val} attribute_map = { 'class_name': 'className', # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index c0564c598f13..a80084e04b0f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -624,9 +624,12 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and has_discriminator is False: return data kwargs = {} @@ -640,7 +643,7 @@ def __deserialize_model(self, data, klass): instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if has_discriminator: klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) From 58908e6494f38b7928b6be51ff450dce40f115ad Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Fri, 24 Apr 2020 09:07:15 -0700 Subject: [PATCH 16/78] [codegen] change x-oneOf-name to x-one-of-name. Consistency with naming conventions and x-all-of-name (#5820) * change x-oneOf-name to x-one-of-name. * Add code comments * Add code comments --- .../java/org/openapitools/codegen/DefaultCodegen.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 91edad3cd514..82cebbf02245 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 @@ -1857,7 +1857,13 @@ public String toAnyOfName(List<String> names, ComposedSchema composedSchema) { } /** - * Return the name of the oneOf schema + * Return the name of the oneOf schema. + * + * This name is used to set the value of CodegenProperty.openApiType. + * + * If the 'x-one-of-name' extension is specified in the OAS document, return that value. + * Otherwise, a name is constructed by creating a comma-separated list of all the names + * of the oneOf schemas. * * @param names List of names * @param composedSchema composed schema From e8f486ba7f22ad7478b6dd380d2adbbb3b82e102 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Fri, 24 Apr 2020 09:10:32 -0700 Subject: [PATCH 17/78] [Python experimental] Readme improvements (#6031) * Python experimental readme improvements * Python experimental readme improvements * execute scripts in bin directory --- .../resources/python/common_README.mustache | 4 +- .../resources/python/configuration.mustache | 56 +- .../README_common.mustache | 4 +- .../python/python_doc_auth_partial.mustache | 116 ++++- .../client/petstore/python-asyncio/README.md | 10 +- .../python-asyncio/docs/AnotherFakeApi.md | 6 + .../petstore/python-asyncio/docs/FakeApi.md | 99 +++- .../docs/FakeClassnameTags123Api.md | 22 +- .../petstore/python-asyncio/docs/PetApi.md | 166 ++++-- .../petstore/python-asyncio/docs/StoreApi.md | 40 +- .../petstore/python-asyncio/docs/UserApi.md | 48 ++ .../petstore_api/configuration.py | 20 +- .../petstore/python-experimental/README.md | 10 +- .../docs/AnotherFakeApi.md | 6 + .../python-experimental/docs/FakeApi.md | 105 +++- .../docs/FakeClassnameTags123Api.md | 22 +- .../python-experimental/docs/PetApi.md | 166 ++++-- .../python-experimental/docs/StoreApi.md | 40 +- .../python-experimental/docs/UserApi.md | 48 ++ .../petstore_api/configuration.py | 20 +- .../client/petstore/python-tornado/README.md | 10 +- .../python-tornado/docs/AnotherFakeApi.md | 6 + .../petstore/python-tornado/docs/FakeApi.md | 99 +++- .../docs/FakeClassnameTags123Api.md | 22 +- .../petstore/python-tornado/docs/PetApi.md | 166 ++++-- .../petstore/python-tornado/docs/StoreApi.md | 40 +- .../petstore/python-tornado/docs/UserApi.md | 48 ++ .../petstore_api/configuration.py | 20 +- samples/client/petstore/python/README.md | 10 +- .../petstore/python/docs/AnotherFakeApi.md | 6 + .../client/petstore/python/docs/FakeApi.md | 99 +++- .../python/docs/FakeClassnameTags123Api.md | 22 +- samples/client/petstore/python/docs/PetApi.md | 166 ++++-- .../client/petstore/python/docs/StoreApi.md | 40 +- .../client/petstore/python/docs/UserApi.md | 48 ++ .../python/petstore_api/configuration.py | 20 +- .../petstore/python-experimental/README.md | 10 +- .../docs/AnotherFakeApi.md | 6 + .../python-experimental/docs/DefaultApi.md | 6 + .../python-experimental/docs/FakeApi.md | 112 +++- .../docs/FakeClassnameTags123Api.md | 22 +- .../python-experimental/docs/PetApi.md | 482 +++++++++++++----- .../python-experimental/docs/StoreApi.md | 40 +- .../python-experimental/docs/UserApi.md | 48 ++ .../petstore_api/configuration.py | 56 +- .../openapi3/client/petstore/python/README.md | 10 +- .../petstore/python/docs/AnotherFakeApi.md | 6 + .../client/petstore/python/docs/DefaultApi.md | 6 + .../client/petstore/python/docs/FakeApi.md | 112 +++- .../python/docs/FakeClassnameTags123Api.md | 22 +- .../client/petstore/python/docs/PetApi.md | 166 ++++-- .../client/petstore/python/docs/StoreApi.md | 40 +- .../client/petstore/python/docs/UserApi.md | 48 ++ .../python/petstore_api/configuration.py | 20 +- 54 files changed, 2499 insertions(+), 543 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/common_README.mustache b/modules/openapi-generator/src/main/resources/python/common_README.mustache index 991002aa17cd..37060d6d1f3d 100644 --- a/modules/openapi-generator/src/main/resources/python/common_README.mustache +++ b/modules/openapi-generator/src/main/resources/python/common_README.mustache @@ -1,13 +1,13 @@ ```python from __future__ import print_function +{{#apiInfo}}{{#apis}}{{^hasMore}}{{#hasHttpSignatureMethods}}import datetime{{/hasHttpSignatureMethods}}{{/hasMore}}{{/apis}}{{/apiInfo}} import time import {{{packageName}}} from {{{packageName}}}.rest import ApiException from pprint import pprint {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} {{> python_doc_auth_partial}} -# Defining host is optional and default to {{{basePath}}} -configuration.host = "{{{basePath}}}" + # Enter a context with an instance of the API client with {{{packageName}}}.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache index 7fdcd894277e..dceab63e67b2 100644 --- a/modules/openapi-generator/src/main/resources/python/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache @@ -62,10 +62,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = {{{packageName}}}.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = {{{packageName}}}.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 {{/hasApiKeyMethods}} @@ -80,10 +82,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = {{{packageName}}}.Configuration( - username='the-user', - password='the-password', - ) + +conf = {{{packageName}}}.Configuration( + username='the-user', + password='the-password', +) + {{/hasHttpBasicMethods}} {{#hasHttpSignatureMethods}} @@ -107,24 +111,24 @@ class Configuration(object): load balancers may add/modify/remove headers. Include the HTTP headers that you know are not going to be modified in transit. - conf = {{{packageName}}}.Configuration( - signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) - ) +conf = {{{packageName}}}.Configuration( + signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = {{{packageName}}}.signing.SCHEME_HS2019, + signing_algorithm = {{{packageName}}}.signing.ALGORITHM_RSASSA_PSS, + signed_headers = [{{{packageName}}}.signing.HEADER_REQUEST_TARGET, + {{{packageName}}}.signing.HEADER_CREATED, + {{{packageName}}}.signing.HEADER_EXPIRES, + {{{packageName}}}.signing.HEADER_HOST, + {{{packageName}}}.signing.HEADER_DATE, + {{{packageName}}}.signing.HEADER_DIGEST, + 'Content-Type', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) {{/hasHttpSignatureMethods}} {{/hasAuthMethods}} """ diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache index b474eb264ae1..7d9811fdfb85 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache @@ -1,12 +1,12 @@ ```python from __future__ import print_function +{{#apiInfo}}{{#apis}}{{^hasMore}}{{#hasHttpSignatureMethods}}import datetime{{/hasHttpSignatureMethods}}{{/hasMore}}{{/apis}}{{/apiInfo}} import time import {{{packageName}}} from pprint import pprint {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} {{> python_doc_auth_partial}} -# Defining host is optional and default to {{{basePath}}} -configuration.host = "{{{basePath}}}" + # Enter a context with an instance of the API client with {{{packageName}}}.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/modules/openapi-generator/src/main/resources/python/python_doc_auth_partial.mustache b/modules/openapi-generator/src/main/resources/python/python_doc_auth_partial.mustache index d8cfc4ad11df..3086d770b183 100644 --- a/modules/openapi-generator/src/main/resources/python/python_doc_auth_partial.mustache +++ b/modules/openapi-generator/src/main/resources/python/python_doc_auth_partial.mustache @@ -1,51 +1,113 @@ +# Defining the host is optional and defaults to {{{basePath}}} +# See configuration.py for a list of all supported configuration parameters. +configuration = {{{packageName}}}.Configuration( + host = "{{{basePath}}}" +) + {{#hasAuthMethods}} +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. {{#authMethods}} -configuration = {{{packageName}}}.Configuration() {{#isBasic}} {{#isBasicBasic}} + # Configure HTTP basic authorization: {{{name}}} -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +configuration = {{{packageName}}}.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) {{/isBasicBasic}} {{#isBasicBearer}} + # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}} -configuration.access_token = 'YOUR_BEARER_TOKEN' +configuration = {{{packageName}}}.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) {{/isBasicBearer}} {{#isHttpSignature}} -# Configure HTTP signature authorization: {{{name}}} -# You can specify the signing key-id, private key path, signing scheme, signing algorithm, -# list of signed headers and signature max validity. -configuration.signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) + +# Configure HTTP message signature: {{{name}}} +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See {{{packageName}}}.signing for a list of all supported parameters. +configuration = {{{packageName}}}.Configuration( + host = "{{{basePath}}}", + signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = {{{packageName}}}.signing.SCHEME_HS2019, + signing_algorithm = {{{packageName}}}.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = {{{packageName}}}.signing.SCHEME_RSA_SHA256, + signed_headers = [ + {{{packageName}}}.signing.HEADER_REQUEST_TARGET, + {{{packageName}}}.signing.HEADER_CREATED, + {{{packageName}}}.signing.HEADER_EXPIRES, + {{{packageName}}}.signing.HEADER_HOST, + {{{packageName}}}.signing.HEADER_DATE, + {{{packageName}}}.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) ) {{/isHttpSignature}} {{/isBasic}} {{#isApiKey}} + # Configure API key authorization: {{{name}}} -configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' +configuration = {{{packageName}}}.Configuration( + host = "{{{basePath}}}", + api_key = { + '{{{keyParamName}}}': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer' {{/isApiKey}} {{#isOAuth}} + # Configure OAuth2 access token for authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration( + host = "{{{basePath}}}" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' {{/isOAuth}} {{/authMethods}} - -# Defining host is optional and default to {{{basePath}}} -configuration.host = "{{{basePath}}}" {{/hasAuthMethods}} diff --git a/samples/client/petstore/python-asyncio/README.md b/samples/client/petstore/python-asyncio/README.md index 36c0a082f3fd..1cfb40e579e7 100644 --- a/samples/client/petstore/python-asyncio/README.md +++ b/samples/client/petstore/python-asyncio/README.md @@ -46,14 +46,20 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function + import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md b/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md index f777f0d43e6c..047c4ae6444b 100644 --- a/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md @@ -22,6 +22,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md index d1d84afd1ce7..68a36b5f7525 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -35,6 +35,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -90,6 +96,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -145,6 +157,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -200,6 +218,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -255,6 +279,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -310,6 +340,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -362,6 +398,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -418,6 +460,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -475,13 +523,22 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP basic authorization: http_basic_test -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -564,6 +621,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -634,6 +697,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -697,6 +766,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -750,6 +825,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -807,6 +888,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md index 160851b5c31c..5e1739a561e5 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md @@ -23,15 +23,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key_query': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-asyncio/docs/PetApi.md b/samples/client/petstore/python-asyncio/docs/PetApi.md index 5e9f9804ee00..a07c55e726d5 100644 --- a/samples/client/petstore/python-asyncio/docs/PetApi.md +++ b/samples/client/petstore/python-asyncio/docs/PetApi.md @@ -29,13 +29,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -90,13 +100,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -155,13 +175,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -219,13 +249,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -283,15 +323,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -348,13 +400,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -411,13 +473,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -475,13 +547,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -540,13 +622,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-asyncio/docs/StoreApi.md b/samples/client/petstore/python-asyncio/docs/StoreApi.md index 360d7e01865e..8d5e2178eaf5 100644 --- a/samples/client/petstore/python-asyncio/docs/StoreApi.md +++ b/samples/client/petstore/python-asyncio/docs/StoreApi.md @@ -25,6 +25,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,15 +88,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -142,6 +160,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -198,6 +222,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-asyncio/docs/UserApi.md b/samples/client/petstore/python-asyncio/docs/UserApi.md index 1d69ee7aa6e3..6cb9d1ec3849 100644 --- a/samples/client/petstore/python-asyncio/docs/UserApi.md +++ b/samples/client/petstore/python-asyncio/docs/UserApi.md @@ -29,6 +29,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,6 +88,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -135,6 +147,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -190,6 +208,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -244,6 +268,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -300,6 +330,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -357,6 +393,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -408,6 +450,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-asyncio/petstore_api/configuration.py b/samples/client/petstore/python-asyncio/petstore_api/configuration.py index ef96f1bc5cd1..a93073e81424 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/configuration.py +++ b/samples/client/petstore/python-asyncio/petstore_api/configuration.py @@ -61,10 +61,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 @@ -77,10 +79,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = petstore_api.Configuration( - username='the-user', - password='the-password', - ) + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + """ _default = None diff --git a/samples/client/petstore/python-experimental/README.md b/samples/client/petstore/python-experimental/README.md index f64e70f79da3..81b680fa57b3 100644 --- a/samples/client/petstore/python-experimental/README.md +++ b/samples/client/petstore/python-experimental/README.md @@ -46,13 +46,19 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function + import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md index 493dd47a4cf3..83a89addfaee 100644 --- a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -21,6 +21,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-experimental/docs/FakeApi.md b/samples/client/petstore/python-experimental/docs/FakeApi.md index 59b07dd05a0a..de9a3fd1a4fb 100644 --- a/samples/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/client/petstore/python-experimental/docs/FakeApi.md @@ -35,6 +35,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -90,6 +96,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -146,6 +158,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -202,6 +220,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -258,6 +282,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -314,6 +344,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -370,6 +406,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -422,6 +464,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -478,6 +526,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -534,6 +588,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -592,13 +652,22 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP basic authorization: http_basic_test -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -689,6 +758,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -760,6 +835,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -831,6 +912,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -884,6 +971,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index 1b5308a8199a..c10f9f37e164 100644 --- a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -22,15 +22,27 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key_query': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-experimental/docs/PetApi.md b/samples/client/petstore/python-experimental/docs/PetApi.md index c7f69f794b5c..d7192a2dd5f3 100644 --- a/samples/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/client/petstore/python-experimental/docs/PetApi.md @@ -28,13 +28,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -89,13 +99,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -162,13 +182,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -226,13 +256,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -290,15 +330,27 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -355,13 +407,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -418,13 +480,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -490,13 +562,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -566,13 +648,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-experimental/docs/StoreApi.md b/samples/client/petstore/python-experimental/docs/StoreApi.md index efcc4a3ea287..b4492962d69c 100644 --- a/samples/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/client/petstore/python-experimental/docs/StoreApi.md @@ -24,6 +24,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -81,15 +87,27 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -141,6 +159,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -197,6 +221,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-experimental/docs/UserApi.md b/samples/client/petstore/python-experimental/docs/UserApi.md index 4473840b5ce7..b02b92afbf74 100644 --- a/samples/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/client/petstore/python-experimental/docs/UserApi.md @@ -28,6 +28,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -81,6 +87,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -134,6 +146,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -189,6 +207,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -243,6 +267,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -299,6 +329,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -356,6 +392,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -407,6 +449,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-experimental/petstore_api/configuration.py b/samples/client/petstore/python-experimental/petstore_api/configuration.py index 066665d16fc9..32406df02f53 100644 --- a/samples/client/petstore/python-experimental/petstore_api/configuration.py +++ b/samples/client/petstore/python-experimental/petstore_api/configuration.py @@ -62,10 +62,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 @@ -78,10 +80,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = petstore_api.Configuration( - username='the-user', - password='the-password', - ) + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + """ _default = None diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md index 36c0a082f3fd..1cfb40e579e7 100644 --- a/samples/client/petstore/python-tornado/README.md +++ b/samples/client/petstore/python-tornado/README.md @@ -46,14 +46,20 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function + import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md b/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md index f777f0d43e6c..047c4ae6444b 100644 --- a/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md @@ -22,6 +22,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md index d1d84afd1ce7..68a36b5f7525 100644 --- a/samples/client/petstore/python-tornado/docs/FakeApi.md +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -35,6 +35,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -90,6 +96,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -145,6 +157,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -200,6 +218,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -255,6 +279,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -310,6 +340,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -362,6 +398,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -418,6 +460,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -475,13 +523,22 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP basic authorization: http_basic_test -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -564,6 +621,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -634,6 +697,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -697,6 +766,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -750,6 +825,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -807,6 +888,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md index 160851b5c31c..5e1739a561e5 100644 --- a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md @@ -23,15 +23,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key_query': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-tornado/docs/PetApi.md b/samples/client/petstore/python-tornado/docs/PetApi.md index 5e9f9804ee00..a07c55e726d5 100644 --- a/samples/client/petstore/python-tornado/docs/PetApi.md +++ b/samples/client/petstore/python-tornado/docs/PetApi.md @@ -29,13 +29,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -90,13 +100,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -155,13 +175,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -219,13 +249,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -283,15 +323,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -348,13 +400,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -411,13 +473,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -475,13 +547,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -540,13 +622,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python-tornado/docs/StoreApi.md b/samples/client/petstore/python-tornado/docs/StoreApi.md index 360d7e01865e..8d5e2178eaf5 100644 --- a/samples/client/petstore/python-tornado/docs/StoreApi.md +++ b/samples/client/petstore/python-tornado/docs/StoreApi.md @@ -25,6 +25,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,15 +88,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -142,6 +160,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -198,6 +222,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-tornado/docs/UserApi.md b/samples/client/petstore/python-tornado/docs/UserApi.md index 1d69ee7aa6e3..6cb9d1ec3849 100644 --- a/samples/client/petstore/python-tornado/docs/UserApi.md +++ b/samples/client/petstore/python-tornado/docs/UserApi.md @@ -29,6 +29,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,6 +88,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -135,6 +147,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -190,6 +208,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -244,6 +268,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -300,6 +330,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -357,6 +393,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -408,6 +450,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python-tornado/petstore_api/configuration.py b/samples/client/petstore/python-tornado/petstore_api/configuration.py index 066665d16fc9..32406df02f53 100644 --- a/samples/client/petstore/python-tornado/petstore_api/configuration.py +++ b/samples/client/petstore/python-tornado/petstore_api/configuration.py @@ -62,10 +62,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 @@ -78,10 +80,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = petstore_api.Configuration( - username='the-user', - password='the-password', - ) + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + """ _default = None diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 36c0a082f3fd..1cfb40e579e7 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -46,14 +46,20 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function + import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python/docs/AnotherFakeApi.md b/samples/client/petstore/python/docs/AnotherFakeApi.md index f777f0d43e6c..047c4ae6444b 100644 --- a/samples/client/petstore/python/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python/docs/AnotherFakeApi.md @@ -22,6 +22,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index d1d84afd1ce7..68a36b5f7525 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -35,6 +35,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -90,6 +96,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -145,6 +157,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -200,6 +218,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -255,6 +279,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -310,6 +340,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -362,6 +398,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -418,6 +460,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -475,13 +523,22 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP basic authorization: http_basic_test -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -564,6 +621,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -634,6 +697,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -697,6 +766,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -750,6 +825,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -807,6 +888,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python/docs/FakeClassnameTags123Api.md index 160851b5c31c..5e1739a561e5 100644 --- a/samples/client/petstore/python/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python/docs/FakeClassnameTags123Api.md @@ -23,15 +23,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key_query': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index 5e9f9804ee00..a07c55e726d5 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -29,13 +29,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -90,13 +100,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -155,13 +175,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -219,13 +249,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -283,15 +323,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -348,13 +400,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -411,13 +473,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -475,13 +547,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -540,13 +622,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/client/petstore/python/docs/StoreApi.md b/samples/client/petstore/python/docs/StoreApi.md index 360d7e01865e..8d5e2178eaf5 100644 --- a/samples/client/petstore/python/docs/StoreApi.md +++ b/samples/client/petstore/python/docs/StoreApi.md @@ -25,6 +25,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,15 +88,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -142,6 +160,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -198,6 +222,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python/docs/UserApi.md b/samples/client/petstore/python/docs/UserApi.md index 1d69ee7aa6e3..6cb9d1ec3849 100644 --- a/samples/client/petstore/python/docs/UserApi.md +++ b/samples/client/petstore/python/docs/UserApi.md @@ -29,6 +29,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,6 +88,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -135,6 +147,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -190,6 +208,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -244,6 +268,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -300,6 +330,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -357,6 +393,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -408,6 +450,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 066665d16fc9..32406df02f53 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -62,10 +62,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 @@ -78,10 +80,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = petstore_api.Configuration( - username='the-user', - password='the-password', - ) + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + """ _default = None diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index a0988878b947..b2158bd96594 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -46,13 +46,19 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function +import datetime import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md index 831230e18c65..7b8b3d6796d0 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -21,6 +21,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md index 080fe8bd98bb..91623f7a45ae 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md @@ -19,6 +19,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md index c1146038a232..a31649db9aaf 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md @@ -32,6 +32,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -84,6 +90,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -140,6 +152,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -196,6 +214,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -252,6 +276,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -308,6 +338,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -360,6 +396,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -416,6 +458,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -473,13 +521,22 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP basic authorization: http_basic_test -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -570,6 +627,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -642,12 +705,21 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure Bearer authorization (JWT): bearer_test -configuration.access_token = 'YOUR_BEARER_TOKEN' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization (JWT): bearer_test +configuration = petstore_api.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -719,6 +791,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -772,6 +850,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -829,6 +913,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index a93336558a92..ab1eb4d62ca8 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -22,15 +22,27 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key_query': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md index 72f7fb27fc30..62bcfdd1bdd1 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md @@ -28,34 +28,83 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP signature authorization: http_signature_test -# You can specify the signing key-id, private key path, signing scheme, signing algorithm, -# list of signed headers and signature max validity. -configuration.signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" ) -configuration = petstore_api.Configuration() + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -109,13 +158,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -181,34 +240,83 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP signature authorization: http_signature_test -# You can specify the signing key-id, private key path, signing scheme, signing algorithm, -# list of signed headers and signature max validity. -configuration.signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) ) -configuration = petstore_api.Configuration() + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -266,34 +374,83 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP signature authorization: http_signature_test -# You can specify the signing key-id, private key path, signing scheme, signing algorithm, -# list of signed headers and signature max validity. -configuration.signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" ) -configuration = petstore_api.Configuration() + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -351,15 +508,27 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -416,34 +585,83 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP signature authorization: http_signature_test -# You can specify the signing key-id, private key path, signing scheme, signing algorithm, -# list of signed headers and signature max validity. -configuration.signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) ) -configuration = petstore_api.Configuration() + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -499,13 +717,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -571,13 +799,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -645,13 +883,23 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md index 4372edd56540..4a7b890a1cc1 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md @@ -24,6 +24,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -81,15 +87,27 @@ from __future__ import print_function import time import petstore_api from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -141,6 +159,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -197,6 +221,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md index 70c5e1232ac7..4aa31e100bb0 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md @@ -28,6 +28,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -81,6 +87,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -134,6 +146,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -189,6 +207,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -243,6 +267,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -299,6 +329,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -356,6 +392,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -407,6 +449,12 @@ from __future__ import print_function import time import petstore_api from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py index d885572339ef..92c53fb54ec0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/configuration.py @@ -64,10 +64,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 @@ -80,10 +82,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = petstore_api.Configuration( - username='the-user', - password='the-password', - ) + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + HTTP Signature Authentication Example. Given the following security scheme in the OpenAPI specification: @@ -105,24 +109,24 @@ class Configuration(object): load balancers may add/modify/remove headers. Include the HTTP headers that you know are not going to be modified in transit. - conf = petstore_api.Configuration( - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = signing.SCHEME_HS2019, - signing_algorithm = signing.ALGORITHM_RSASSA_PSS, - signed_headers = [signing.HEADER_REQUEST_TARGET, - signing.HEADER_CREATED, - signing.HEADER_EXPIRES, - signing.HEADER_HOST, - signing.HEADER_DATE, - signing.HEADER_DIGEST, - 'Content-Type', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) - ) +conf = petstore_api.Configuration( + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_RSASSA_PSS, + signed_headers = [petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) """ _default = None diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 39d427e7cccd..2c3dd373c6e0 100644 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -46,14 +46,20 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function + import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/openapi3/client/petstore/python/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python/docs/AnotherFakeApi.md index d93ffd79f195..ecd52ad7705d 100644 --- a/samples/openapi3/client/petstore/python/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/AnotherFakeApi.md @@ -22,6 +22,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python/docs/DefaultApi.md b/samples/openapi3/client/petstore/python/docs/DefaultApi.md index dbb994da49c2..7f022fd7d3eb 100644 --- a/samples/openapi3/client/petstore/python/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python/docs/DefaultApi.md @@ -20,6 +20,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index e1b0e67d4230..2ae2daf4bb8e 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -33,6 +33,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -85,6 +91,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -140,6 +152,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -195,6 +213,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -250,6 +274,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -305,6 +335,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -357,6 +393,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -413,6 +455,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -470,13 +518,22 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() -# Configure HTTP basic authorization: http_basic_test -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = 'YOUR_USERNAME', + password = 'YOUR_PASSWORD' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -559,6 +616,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -630,12 +693,21 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() -# Configure Bearer authorization (JWT): bearer_test -configuration.access_token = 'YOUR_BEARER_TOKEN' +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization (JWT): bearer_test +configuration = petstore_api.Configuration( + access_token = 'YOUR_BEARER_TOKEN' +) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: @@ -699,6 +771,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -752,6 +830,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -809,6 +893,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python/docs/FakeClassnameTags123Api.md index bf60f00c6a0d..822fd39acec9 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python/docs/FakeClassnameTags123Api.md @@ -23,15 +23,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key_query': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key_query'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/openapi3/client/petstore/python/docs/PetApi.md b/samples/openapi3/client/petstore/python/docs/PetApi.md index eafac6a400de..d64a86236a79 100644 --- a/samples/openapi3/client/petstore/python/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python/docs/PetApi.md @@ -29,13 +29,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -89,13 +99,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -153,13 +173,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -217,13 +247,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -281,15 +321,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -346,13 +398,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -408,13 +470,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -472,13 +544,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -537,13 +619,23 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) configuration.access_token = 'YOUR_ACCESS_TOKEN' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class diff --git a/samples/openapi3/client/petstore/python/docs/StoreApi.md b/samples/openapi3/client/petstore/python/docs/StoreApi.md index 9bfe9d95bf77..3e6cc02faa6c 100644 --- a/samples/openapi3/client/petstore/python/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python/docs/StoreApi.md @@ -25,6 +25,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,15 +88,27 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint -configuration = petstore_api.Configuration() +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + # Configure API key authorization: api_key -configuration.api_key['api_key'] = 'YOUR_API_KEY' +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + api_key = { + 'api_key': 'YOUR_API_KEY' + } +) # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['api_key'] = 'Bearer' -# Defining host is optional and default to http://petstore.swagger.io:80/v2 -configuration.host = "http://petstore.swagger.io:80/v2" - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -142,6 +160,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -198,6 +222,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python/docs/UserApi.md b/samples/openapi3/client/petstore/python/docs/UserApi.md index 6de550edd989..32a62c8add92 100644 --- a/samples/openapi3/client/petstore/python/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python/docs/UserApi.md @@ -29,6 +29,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -82,6 +88,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -135,6 +147,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -190,6 +208,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -244,6 +268,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -300,6 +330,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -357,6 +393,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: @@ -408,6 +450,12 @@ import time import petstore_api from petstore_api.rest import ApiException from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py index d0d05b11381f..915a079502fd 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py @@ -62,10 +62,12 @@ class Configuration(object): name: JSESSIONID # cookie name You can programmatically set the cookie: - conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + The following cookie will be added to the HTTP request: Cookie: JSESSIONID abc123 @@ -78,10 +80,12 @@ class Configuration(object): scheme: basic Configure API client with HTTP basic authentication: - conf = petstore_api.Configuration( - username='the-user', - password='the-password', - ) + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + """ _default = None From 0e276bef1932c7cb8ae0e519844679d496f5ec6a Mon Sep 17 00:00:00 2001 From: Kieran Simpson <kierans777@gmail.com> Date: Sat, 25 Apr 2020 12:20:40 +1000 Subject: [PATCH 18/78] Add input flag for Gradle openApiGenerate task (#5966) --- .../generator/gradle/plugin/tasks/GenerateTask.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt index f273d12427ae..d0c207711a11 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt @@ -21,6 +21,7 @@ import org.gradle.api.GradleException import org.gradle.api.provider.Property import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction +import org.gradle.api.tasks.options.Option import org.gradle.internal.logging.text.StyledTextOutput import org.gradle.internal.logging.text.StyledTextOutputFactory import org.gradle.kotlin.dsl.listProperty @@ -37,7 +38,7 @@ import org.openapitools.codegen.config.GlobalSettings * * Example (CLI): * - * ./gradlew -q openApiGenerate + * ./gradlew -q openApiGenerate --input=/path/to/file * * @author Jim Schubert */ @@ -68,6 +69,14 @@ open class GenerateTask : DefaultTask() { @get:Internal val outputDir = project.objects.property<String>() + @Suppress("unused") + @get:Internal + @set:Option(option = "input", description = "The input specification.") + var input: String? = null + set(value) { + inputSpec.set(value) + } + /** * The Open API 2.0/3.x specification location. */ From cef5470ea84338fa7e7177628ad2f435cf6478c5 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Sat, 25 Apr 2020 23:39:41 +0800 Subject: [PATCH 19/78] Add Http signature authentication test to fake petstore spec (#6054) * add endpoint to test http signature * update plugin version --- .../examples/spring.xml | 2 +- ...ith-fake-endpoints-models-for-testing.yaml | 29 +++ .../client/petstore/go/go-petstore/README.md | 16 ++ .../petstore/go/go-petstore/api/openapi.yaml | 32 +++ .../petstore/go/go-petstore/api_fake.go | 81 ++++++ .../petstore/go/go-petstore/docs/FakeApi.md | 45 ++++ .../petstore/php/OpenAPIClient-php/README.md | 6 + .../php/OpenAPIClient-php/docs/Api/FakeApi.md | 58 +++++ .../php/OpenAPIClient-php/lib/Api/FakeApi.php | 245 ++++++++++++++++++ .../test/Api/FakeApiTest.php | 10 + .../openapi3/client/petstore/python/README.md | 7 +- .../client/petstore/python/docs/FakeApi.md | 64 +++++ .../python/petstore_api/api/fake_api.py | 122 +++++++++ .../python/petstore_api/configuration.py | 58 +++++ .../client/petstore/ruby-faraday/README.md | 4 + .../petstore/ruby-faraday/docs/FakeApi.md | 51 ++++ .../ruby-faraday/lib/petstore/api/fake_api.rb | 66 +++++ .../ruby-faraday/spec/api/fake_api_spec.rb | 13 + .../openapi3/client/petstore/ruby/README.md | 4 + .../client/petstore/ruby/docs/FakeApi.md | 51 ++++ .../ruby/lib/petstore/api/fake_api.rb | 66 +++++ .../petstore/ruby/spec/api/fake_api_spec.rb | 13 + .../java/org/openapitools/api/FakeApi.java | 15 ++ .../org/openapitools/api/FakeApiService.java | 2 + .../api/impl/FakeApiServiceImpl.java | 6 + 25 files changed, 1064 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator-maven-plugin/examples/spring.xml b/modules/openapi-generator-maven-plugin/examples/spring.xml index dda872981b90..a0654ffe260d 100644 --- a/modules/openapi-generator-maven-plugin/examples/spring.xml +++ b/modules/openapi-generator-maven-plugin/examples/spring.xml @@ -20,7 +20,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <!-- RELEASE_VERSION --> - <version>4.2.2-SNAPSHOT</version> + <version>4.3.1-SNAPSHOT</version> <!-- /RELEASE_VERSION --> <executions> <execution> 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 eb023ac0b6a7..87f547a24b2c 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 @@ -1093,6 +1093,32 @@ paths: application/json: schema: $ref: '#/components/schemas/HealthCheckResult' + /fake/http-signature-test: + get: + tags: + - fake + summary: test http signature authentication + operationId: fake-http-signature-test + parameters: + - name: query_1 + in: query + description: query parameter + required: optional + schema: + type: string + - name: header_1 + in: header + description: header parameter + required: optional + schema: + type: string + security: + - http_signature_test + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 200: + description: The instance started successfully servers: - url: 'http://{server}.swagger.io:{port}/v2' description: petstore server @@ -1168,6 +1194,9 @@ components: type: http scheme: bearer bearerFormat: JWT + http_signature_test: + type: http + scheme: signature schemas: Foo: type: object diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index c0f191d001d2..a08d441868ab 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -35,6 +35,7 @@ Class | Method | HTTP request | Description *AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **Patch** /another-fake/dummy | To test special tags *DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **Get** /foo | *FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **Get** /fake/health | Health check endpoint +*FakeApi* | [**FakeHttpSignatureTest**](docs/FakeApi.md#fakehttpsignaturetest) | **Get** /fake/http-signature-test | test http signature authentication *FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean | *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite | *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number | @@ -189,6 +190,21 @@ r, err := client.Service.Operation(auth, args) ``` +## http_signature_test + +- **Type**: HTTP basic authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + + ## petstore_auth diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml index 71d688ccea20..8ac184e2ef72 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -1169,6 +1169,35 @@ paths: summary: Health check endpoint tags: - fake + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + description: The instance started successfully + security: [] + summary: test http signature authentication + tags: + - fake components: requestBodies: UserArray: @@ -2057,3 +2086,6 @@ components: bearerFormat: JWT scheme: bearer type: http + http_signature_test: + scheme: signature + type: http diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go index c47eeaebb186..8c5521b6430a 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -101,6 +101,87 @@ func (a *FakeApiService) FakeHealthGet(ctx _context.Context) (HealthCheckResult, return localVarReturnValue, localVarHTTPResponse, nil } +// FakeHttpSignatureTestOpts Optional parameters for the method 'FakeHttpSignatureTest' +type FakeHttpSignatureTestOpts struct { + Query1 optional.String + Header1 optional.String +} + +/* +FakeHttpSignatureTest test http signature authentication + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param pet Pet object that needs to be added to the store + * @param optional nil or *FakeHttpSignatureTestOpts - Optional Parameters: + * @param "Query1" (optional.String) - query parameter + * @param "Header1" (optional.String) - header parameter +*/ +func (a *FakeApiService) FakeHttpSignatureTest(ctx _context.Context, pet Pet, localVarOptionals *FakeHttpSignatureTestOpts) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/fake/http-signature-test" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if localVarOptionals != nil && localVarOptionals.Query1.IsSet() { + localVarQueryParams.Add("query_1", parameterToString(localVarOptionals.Query1.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/xml"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.Header1.IsSet() { + localVarHeaderParams["header_1"] = parameterToString(localVarOptionals.Header1.Value(), "") + } + // body params + localVarPostBody = &pet + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // FakeOuterBooleanSerializeOpts Optional parameters for the method 'FakeOuterBooleanSerialize' type FakeOuterBooleanSerializeOpts struct { Body optional.Bool diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md index 3634a8771e29..eab45b0e2c29 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**FakeHealthGet**](FakeApi.md#FakeHealthGet) | **Get** /fake/health | Health check endpoint +[**FakeHttpSignatureTest**](FakeApi.md#FakeHttpSignatureTest) | **Get** /fake/http-signature-test | test http signature authentication [**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean | [**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite | [**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number | @@ -49,6 +50,50 @@ No authorization required [[Back to README]](../README.md) +## FakeHttpSignatureTest + +> FakeHttpSignatureTest(ctx, pet, optional) + +test http signature authentication + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **optional** | ***FakeHttpSignatureTestOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a FakeHttpSignatureTestOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **query1** | **optional.String**| query parameter | + **header1** | **optional.String**| header parameter | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[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) + + ## FakeOuterBooleanSerialize > bool FakeOuterBooleanSerialize(ctx, optional) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md index 2f2c6d2e0a60..ea2f41c1b143 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/README.md @@ -86,6 +86,7 @@ Class | Method | HTTP request | Description *AnotherFakeApi* | [**call123TestSpecialTags**](docs/Api/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/Api/DefaultApi.md#fooget) | **GET** /foo | *FakeApi* | [**fakeHealthGet**](docs/Api/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](docs/Api/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -214,6 +215,11 @@ Class | Method | HTTP request | Description +## http_signature_test + + + + ## petstore_auth diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index c3b5b2f1e279..20d18e8499b2 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -71,6 +72,63 @@ No authorization required [[Back to README]](../../README.md) +## fakeHttpSignatureTest + +> fakeHttpSignatureTest($pet, $query_1, $header_1) + +test http signature authentication + +### Example + +```php +<?php +require_once(__DIR__ . '/vendor/autoload.php'); + + +$apiInstance = new OpenAPI\Client\Api\FakeApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client() +); +$pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store +$query_1 = 'query_1_example'; // string | query parameter +$header_1 = 'header_1_example'; // string | header parameter + +try { + $apiInstance->fakeHttpSignatureTest($pet, $query_1, $header_1); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeHttpSignatureTest: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**\OpenAPI\Client\Model\Pet**](../Model/Pet.md)| Pet object that needs to be added to the store | + **query_1** | **string**| query parameter | [optional] + **header_1** | **string**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[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) + + ## fakeOuterBooleanSerialize > bool fakeOuterBooleanSerialize($body) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index 76ffdb3cdb2c..1dff56994580 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -369,6 +369,251 @@ protected function fakeHealthGetRequest() ); } + /** + * Operation fakeHttpSignatureTest + * + * test http signature authentication + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * @param string $query_1 query parameter (optional) + * @param string $header_1 header parameter (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function fakeHttpSignatureTest($pet, $query_1 = null, $header_1 = null) + { + $this->fakeHttpSignatureTestWithHttpInfo($pet, $query_1, $header_1); + } + + /** + * Operation fakeHttpSignatureTestWithHttpInfo + * + * test http signature authentication + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * @param string $query_1 query parameter (optional) + * @param string $header_1 header parameter (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeHttpSignatureTestWithHttpInfo($pet, $query_1 = null, $header_1 = null) + { + $request = $this->fakeHttpSignatureTestRequest($pet, $query_1, $header_1); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation fakeHttpSignatureTestAsync + * + * test http signature authentication + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * @param string $query_1 query parameter (optional) + * @param string $header_1 header parameter (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeHttpSignatureTestAsync($pet, $query_1 = null, $header_1 = null) + { + return $this->fakeHttpSignatureTestAsyncWithHttpInfo($pet, $query_1, $header_1) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fakeHttpSignatureTestAsyncWithHttpInfo + * + * test http signature authentication + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * @param string $query_1 query parameter (optional) + * @param string $header_1 header parameter (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeHttpSignatureTestAsyncWithHttpInfo($pet, $query_1 = null, $header_1 = null) + { + $returnType = ''; + $request = $this->fakeHttpSignatureTestRequest($pet, $query_1, $header_1); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fakeHttpSignatureTest' + * + * @param \OpenAPI\Client\Model\Pet $pet Pet object that needs to be added to the store (required) + * @param string $query_1 query parameter (optional) + * @param string $header_1 header parameter (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function fakeHttpSignatureTestRequest($pet, $query_1 = null, $header_1 = null) + { + // verify the required parameter 'pet' is set + if ($pet === null || (is_array($pet) && count($pet) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $pet when calling fakeHttpSignatureTest' + ); + } + + $resourcePath = '/fake/http-signature-test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if ($query_1 !== null) { + if('form' === 'form' && is_array($query_1)) { + foreach($query_1 as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['query_1'] = $query_1; + } + } + + // header params + if ($header_1 !== null) { + $headerParams['header_1'] = ObjectSerializer::toHeaderValue($header_1); + } + + + // body params + $_tempBody = null; + if (isset($pet)) { + $_tempBody = $pet; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + ['application/json', 'application/xml'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation fakeOuterBooleanSerialize * diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php index ca90b2a5e5d4..02c31a93c3d1 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/test/Api/FakeApiTest.php @@ -82,6 +82,16 @@ public function testFakeHealthGet() { } + /** + * Test case for fakeHttpSignatureTest + * + * test http signature authentication. + * + */ + public function testFakeHttpSignatureTest() + { + } + /** * Test case for fakeOuterBooleanSerialize * diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 2c3dd373c6e0..2cf7fdb9636d 100644 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -46,7 +46,7 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function - +import datetime import time import petstore_api from petstore_api.rest import ApiException @@ -84,6 +84,7 @@ Class | Method | HTTP request | Description *AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | *FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -201,6 +202,10 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication +## http_signature_test + + + ## petstore_auth - **Type**: OAuth diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index 2ae2daf4bb8e..cf1e1179db5f 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -76,6 +77,69 @@ No authorization required [[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) +# **fake_http_signature_test** +> fake_http_signature_test(pet, query_1=query_1, header_1=header_1) + +test http signature authentication + +### Example + +```python +from __future__ import print_function +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient() as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store +query_1 = 'query_1_example' # str | query parameter (optional) +header_1 = 'header_1_example' # str | header parameter (optional) + + try: + # test http signature authentication + api_instance.fake_http_signature_test(pet, query_1=query_1, header_1=header_1) + except ApiException as e: + print("Exception when calling FakeApi->fake_http_signature_test: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query_1** | **str**| query parameter | [optional] + **header_1** | **str**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[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) + # **fake_outer_boolean_serialize** > bool fake_outer_boolean_serialize(body=body) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 66c7d5d7a7cd..71be34c74bff 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -139,6 +139,128 @@ def fake_health_get_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) + def fake_http_signature_test(self, pet, **kwargs): # noqa: E501 + """test http signature authentication # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.fake_http_signature_test(pet, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param Pet pet: Pet object that needs to be added to the store (required) + :param str query_1: query parameter + :param str header_1: header parameter + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.fake_http_signature_test_with_http_info(pet, **kwargs) # noqa: E501 + + def fake_http_signature_test_with_http_info(self, pet, **kwargs): # noqa: E501 + """test http signature authentication # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.fake_http_signature_test_with_http_info(pet, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param Pet pet: Pet object that needs to be added to the store (required) + :param str query_1: query parameter + :param str header_1: header parameter + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'pet', + 'query_1', + 'header_1' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_http_signature_test" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'pet' is set + if self.api_client.client_side_validation and ('pet' not in local_var_params or # noqa: E501 + local_var_params['pet'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `pet` when calling `fake_http_signature_test`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + if 'query_1' in local_var_params and local_var_params['query_1'] is not None: # noqa: E501 + query_params.append(('query_1', local_var_params['query_1'])) # noqa: E501 + + header_params = {} + if 'header_1' in local_var_params: + header_params['header_1'] = local_var_params['header_1'] # noqa: E501 + + form_params = [] + local_var_files = {} + + body_params = None + if 'pet' in local_var_params: + body_params = local_var_params['pet'] + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json', 'application/xml']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/fake/http-signature-test', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + def fake_outer_boolean_serialize(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py index 915a079502fd..92c53fb54ec0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py @@ -49,6 +49,8 @@ class Configuration(object): then all undeclared properties received by the server are injected into the additional properties map. In that case, there are undeclared properties, and nothing to discard. + :param signing_info: Configuration parameters for the HTTP signature security scheme. + Must be an instance of petstore_api.signing.HttpSigningConfiguration :Example: @@ -86,6 +88,45 @@ class Configuration(object): password='the-password', ) + + HTTP Signature Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: signature + + Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, + sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time + of the signature to 5 minutes after the signature has been created. + Note you can use the constants defined in the petstore_api.signing module, and you can + also specify arbitrary HTTP headers to be included in the HTTP signature, except for the + 'Authorization' header, which is used to carry the signature. + + One may be tempted to sign all headers by default, but in practice it rarely works. + This is beccause explicit proxies, transparent proxies, TLS termination endpoints or + load balancers may add/modify/remove headers. Include the HTTP headers that you know + are not going to be modified in transit. + +conf = petstore_api.Configuration( + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_RSASSA_PSS, + signed_headers = [petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) """ _default = None @@ -94,6 +135,7 @@ def __init__(self, host="http://petstore.swagger.io:80/v2", api_key=None, api_key_prefix=None, username=None, password=None, discard_unknown_keys=False, + signing_info=None, ): """Constructor """ @@ -124,6 +166,11 @@ def __init__(self, host="http://petstore.swagger.io:80/v2", """Password for HTTP basic authentication """ self.discard_unknown_keys = discard_unknown_keys + if signing_info is not None: + signing_info.host = host + self.signing_info = signing_info + """The HTTP signing configuration + """ self.access_token = None """access token for OAuth/Bearer """ @@ -205,6 +252,10 @@ def __deepcopy__(self, memo): def __setattr__(self, name, value): object.__setattr__(self, name, value) + if name == "signing_info" and value is not None: + # Ensure the host paramater from signing info is the same as + # Configuration.host. + value.host = self.host @classmethod def set_default(cls, default): @@ -382,6 +433,13 @@ def auth_settings(self): 'key': 'Authorization', 'value': self.get_basic_auth_token() } + if self.signing_info is not None: + auth['http_signature_test'] = { + 'type': 'http-signature', + 'in': 'header', + 'key': 'Authorization', + 'value': None # Signature headers are calculated for every HTTP request + } if self.access_token is not None: auth['petstore_auth'] = { 'type': 'oauth2', diff --git a/samples/openapi3/client/petstore/ruby-faraday/README.md b/samples/openapi3/client/petstore/ruby-faraday/README.md index c23142438a52..719039e53116 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/README.md +++ b/samples/openapi3/client/petstore/ruby-faraday/README.md @@ -78,6 +78,7 @@ Class | Method | HTTP request | Description *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | *Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +*Petstore::FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -193,6 +194,9 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication +### http_signature_test + + ### petstore_auth diff --git a/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md b/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md index e29e28ea1a3e..a8256c46dd4b 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -62,6 +63,56 @@ No authorization required - **Accept**: application/json +## fake_http_signature_test + +> fake_http_signature_test(pet, opts) + +test http signature authentication + +### Example + +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new +pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store +opts = { + query_1: 'query_1_example', # String | query parameter + header_1: 'header_1_example' # String | header parameter +} + +begin + #test http signature authentication + api_instance.fake_http_signature_test(pet, opts) +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_http_signature_test: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query_1** | **String**| query parameter | [optional] + **header_1** | **String**| header parameter | [optional] + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + + ## fake_outer_boolean_serialize > Boolean fake_outer_boolean_serialize(opts) diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index db53effcf968..26194b07ed3d 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -73,6 +73,72 @@ def fake_health_get_with_http_info(opts = {}) return data, status_code, headers end + # test http signature authentication + # @param pet [Pet] Pet object that needs to be added to the store + # @param [Hash] opts the optional parameters + # @option opts [String] :query_1 query parameter + # @option opts [String] :header_1 header parameter + # @return [nil] + def fake_http_signature_test(pet, opts = {}) + fake_http_signature_test_with_http_info(pet, opts) + nil + end + + # test http signature authentication + # @param pet [Pet] Pet object that needs to be added to the store + # @param [Hash] opts the optional parameters + # @option opts [String] :query_1 query parameter + # @option opts [String] :header_1 header parameter + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def fake_http_signature_test_with_http_info(pet, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.fake_http_signature_test ...' + end + # verify the required parameter 'pet' is set + if @api_client.config.client_side_validation && pet.nil? + fail ArgumentError, "Missing the required parameter 'pet' when calling FakeApi.fake_http_signature_test" + end + # resource path + local_var_path = '/fake/http-signature-test' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_1'] = opts[:'query_1'] if !opts[:'query_1'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(pet) + + # return_type + return_type = opts[:return_type] + + # auth_names + auth_names = opts[:auth_names] || [] + + new_options = opts.merge( + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test serialization of outer boolean types # @param [Hash] opts the optional parameters # @option opts [Boolean] :body Input boolean as post body diff --git a/samples/openapi3/client/petstore/ruby-faraday/spec/api/fake_api_spec.rb b/samples/openapi3/client/petstore/ruby-faraday/spec/api/fake_api_spec.rb index 242cbc432569..93956dd227df 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/spec/api/fake_api_spec.rb +++ b/samples/openapi3/client/petstore/ruby-faraday/spec/api/fake_api_spec.rb @@ -42,6 +42,19 @@ end end + # unit tests for fake_http_signature_test + # test http signature authentication + # @param pet Pet object that needs to be added to the store + # @param [Hash] opts the optional parameters + # @option opts [String] :query_1 query parameter + # @option opts [String] :header_1 header parameter + # @return [nil] + describe 'fake_http_signature_test test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for fake_outer_boolean_serialize # Test serialization of outer boolean types # @param [Hash] opts the optional parameters diff --git a/samples/openapi3/client/petstore/ruby/README.md b/samples/openapi3/client/petstore/ruby/README.md index c23142438a52..719039e53116 100644 --- a/samples/openapi3/client/petstore/ruby/README.md +++ b/samples/openapi3/client/petstore/ruby/README.md @@ -78,6 +78,7 @@ Class | Method | HTTP request | Description *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | *Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +*Petstore::FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -193,6 +194,9 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication +### http_signature_test + + ### petstore_auth diff --git a/samples/openapi3/client/petstore/ruby/docs/FakeApi.md b/samples/openapi3/client/petstore/ruby/docs/FakeApi.md index e29e28ea1a3e..a8256c46dd4b 100644 --- a/samples/openapi3/client/petstore/ruby/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/ruby/docs/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -62,6 +63,56 @@ No authorization required - **Accept**: application/json +## fake_http_signature_test + +> fake_http_signature_test(pet, opts) + +test http signature authentication + +### Example + +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new +pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store +opts = { + query_1: 'query_1_example', # String | query parameter + header_1: 'header_1_example' # String | header parameter +} + +begin + #test http signature authentication + api_instance.fake_http_signature_test(pet, opts) +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_http_signature_test: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query_1** | **String**| query parameter | [optional] + **header_1** | **String**| header parameter | [optional] + +### Return type + +nil (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + + ## fake_outer_boolean_serialize > Boolean fake_outer_boolean_serialize(opts) diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb index db53effcf968..26194b07ed3d 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -73,6 +73,72 @@ def fake_health_get_with_http_info(opts = {}) return data, status_code, headers end + # test http signature authentication + # @param pet [Pet] Pet object that needs to be added to the store + # @param [Hash] opts the optional parameters + # @option opts [String] :query_1 query parameter + # @option opts [String] :header_1 header parameter + # @return [nil] + def fake_http_signature_test(pet, opts = {}) + fake_http_signature_test_with_http_info(pet, opts) + nil + end + + # test http signature authentication + # @param pet [Pet] Pet object that needs to be added to the store + # @param [Hash] opts the optional parameters + # @option opts [String] :query_1 query parameter + # @option opts [String] :header_1 header parameter + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def fake_http_signature_test_with_http_info(pet, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.fake_http_signature_test ...' + end + # verify the required parameter 'pet' is set + if @api_client.config.client_side_validation && pet.nil? + fail ArgumentError, "Missing the required parameter 'pet' when calling FakeApi.fake_http_signature_test" + end + # resource path + local_var_path = '/fake/http-signature-test' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_1'] = opts[:'query_1'] if !opts[:'query_1'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml']) + header_params[:'header_1'] = opts[:'header_1'] if !opts[:'header_1'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(pet) + + # return_type + return_type = opts[:return_type] + + # auth_names + auth_names = opts[:auth_names] || [] + + new_options = opts.merge( + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_http_signature_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test serialization of outer boolean types # @param [Hash] opts the optional parameters # @option opts [Boolean] :body Input boolean as post body diff --git a/samples/openapi3/client/petstore/ruby/spec/api/fake_api_spec.rb b/samples/openapi3/client/petstore/ruby/spec/api/fake_api_spec.rb index 242cbc432569..93956dd227df 100644 --- a/samples/openapi3/client/petstore/ruby/spec/api/fake_api_spec.rb +++ b/samples/openapi3/client/petstore/ruby/spec/api/fake_api_spec.rb @@ -42,6 +42,19 @@ end end + # unit tests for fake_http_signature_test + # test http signature authentication + # @param pet Pet object that needs to be added to the store + # @param [Hash] opts the optional parameters + # @option opts [String] :query_1 query parameter + # @option opts [String] :header_1 header parameter + # @return [nil] + describe 'fake_http_signature_test test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for fake_outer_boolean_serialize # Test serialization of outer boolean types # @param [Hash] opts the optional parameters 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 fe96bc373074..9d984b50904d 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 @@ -16,6 +16,7 @@ import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; +import org.openapitools.model.Pet; import org.openapitools.model.User; import java.util.Map; @@ -75,6 +76,20 @@ public Response fakeHealthGet(@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeHealthGet(securityContext); } + @GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + + @io.swagger.annotations.ApiOperation(value = "test http signature authentication", notes = "", response = Void.class, tags={ "fake", }) + @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); + } @POST @Path("/outer/boolean") @Consumes({ "application/json" }) diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java index ffb6a868cdda..6c6878f896c5 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java @@ -14,6 +14,7 @@ import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; +import org.openapitools.model.Pet; import org.openapitools.model.User; import java.util.List; @@ -27,6 +28,7 @@ public abstract class FakeApiService { public abstract Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeHttpSignatureTest(Pet pet,String query1,String header1,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java index 6e2fb3f06f8e..860002084e99 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -12,6 +12,7 @@ import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; +import org.openapitools.model.Pet; import org.openapitools.model.User; import java.util.List; @@ -32,6 +33,11 @@ public Response fakeHealthGet(SecurityContext securityContext) throws NotFoundEx return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override + public Response fakeHttpSignatureTest(Pet pet, String query1, String header1, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override public Response fakeOuterBooleanSerialize(Boolean body, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); From db5941379f1b6d55075a7a8d85b63cde3e149eb8 Mon Sep 17 00:00:00 2001 From: Justin Niessner <CrshOverride@gmail.com> Date: Sun, 26 Apr 2020 16:33:42 -0400 Subject: [PATCH 20/78] [Python] Fix Python UTF-8 Encoding Issue (#5679) * Try decoding but don't bail on error * Switch binary and ByteArray to bytes * Read content type and parse appropriately * Remove response parsing * Remove response parsing and just return the data * Update petshop examples w/ new generator code * Fix copy/paste error with naming * Update petstore examples * Move response decoding to inside _preload_content block * Update the clients again * Use a raw string for the regex pattern * Regenerate petstore clients * Add bytes to python primitives as it's supported in 2.7 and 3 * Add bytes to the exports from model_utils * Import bytes from model_utils * Add conditional typing for regex pattern to match variable type * Regenerate petstore clients * Use read() instead of text() for asyncio * Regenerate petstore clients * Remove unused six import * Regenerate petstore clients * Add newline to kick Circle to re-run * Remove whitespace from tox.ini * Update more examples after ensure_updated * Add sample updates that didn't run with the --batch flag * Remove extra bracket in regex to remove warning * Stop printing debug messages * Add bytes examples to python doc generators * Update generated FakeApi docs * Regenerate api_client.py * Remove print statements from generated clients * Update bytes example in FakeApi.md. Again. I swear. * Add yet another seemingly missing doc update * Catch the error, decode the body, and re-throw * Remove the updates now that the change is non-breaking * Regenerate client * Add bytes deserialization test * Update exception parsing * Add exception parsing for python-experimental * Regenerate client with minor changes * Revert test changes * Regenerate model_utils.py * Update confusing test name * Remove bytes from mapping and examples * Add back in the old binary/ByteArray to str mapping * Update docs and api_client template * Add experimental api_client changes * Regenerate samples again * Add Tornado handling to early return * Try fixing Tornado python returns * More documentation changes * Re-generate the client code * Remove bytes from test_format_test * Remove more leftover bytes usages * Switch bytes validation back to string * Fix format_test template and regenerate * Remove unused bytes var * Remove bytes import from models and regenerate * Remove bytes import from test_deserialization * Reduce nested ifs * Remove byte logic for now * Regenerate client after latest changes * Remove another bytes usage * Regenerate after removing dangling byte string usage * Reduce the scope of the try/catch in api_client * Regenerate after try/catch cleanup * Swap catch for except * Regenerate Python client after api_client change * Fix lint error on the generated api_client * Add binary format test back in w/ string * Add decoding to python-experimental and regenerate * Import re into python-experimental api_client * Ensure file upload json response is utf-8 encoded bytes --- docs/generators/python-experimental.md | 1 + docs/generators/python.md | 1 + .../languages/PythonClientCodegen.java | 3 +- .../PythonClientExperimentalCodegen.java | 4 +- .../main/resources/python/api_client.mustache | 47 ++++++++++----- .../resources/python/asyncio/rest.mustache | 2 +- .../python-experimental/api_client.mustache | 57 +++++++++++++------ .../src/main/resources/python/rest.mustache | 5 -- .../resources/python/tornado/rest.mustache | 7 +-- .../python-asyncio/petstore_api/api_client.py | 42 +++++++++----- .../python-asyncio/petstore_api/rest.py | 2 +- .../petstore_api/api_client.py | 52 +++++++++++------ .../python-experimental/petstore_api/rest.py | 5 -- .../test/test_format_test.py | 2 +- .../tests/test_api_exception.py | 1 + .../tests/test_deserialization.py | 30 ++++++++++ .../python-experimental/tests/test_pet_api.py | 2 +- .../python-tornado/petstore_api/api_client.py | 42 +++++++++----- .../python-tornado/petstore_api/rest.py | 7 +-- .../python/petstore_api/api_client.py | 42 +++++++++----- .../petstore/python/petstore_api/rest.py | 5 -- .../petstore/python/test/test_format_test.py | 26 ++++----- .../python/tests/test_api_exception.py | 1 + .../petstore_api/api_client.py | 52 +++++++++++------ .../python-experimental/petstore_api/rest.py | 5 -- .../python/petstore_api/api_client.py | 42 +++++++++----- .../petstore/python/petstore_api/rest.py | 5 -- .../php-slim4/lib/Model/EnumClass.php | 4 +- 28 files changed, 319 insertions(+), 175 deletions(-) diff --git a/docs/generators/python-experimental.md b/docs/generators/python-experimental.md index 8f3b02c7e566..546dcc22542a 100644 --- a/docs/generators/python-experimental.md +++ b/docs/generators/python-experimental.md @@ -31,6 +31,7 @@ sidebar_label: python-experimental <ul class="column-ul"> <li>bool</li> +<li>bytes</li> <li>date</li> <li>datetime</li> <li>dict</li> diff --git a/docs/generators/python.md b/docs/generators/python.md index 3bd96b865bcb..7c4ff80016a1 100644 --- a/docs/generators/python.md +++ b/docs/generators/python.md @@ -31,6 +31,7 @@ sidebar_label: python <ul class="column-ul"> <li>bool</li> +<li>bytes</li> <li>date</li> <li>datetime</li> <li>dict</li> diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index ca59f763d74c..077676af99b0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -119,6 +119,7 @@ public PythonClientCodegen() { languageSpecificPrimitives.add("object"); // TODO file and binary is mapped as `file` languageSpecificPrimitives.add("file"); + languageSpecificPrimitives.add("bytes"); typeMapping.clear(); typeMapping.put("integer", "int"); @@ -828,7 +829,7 @@ private String toExampleValueRecursive(Schema schema, List<String> included_sche if (schema.getDiscriminator()!=null) { toExclude = schema.getDiscriminator().getPropertyName(); } - + example = packageName + ".models." + underscore(schema.getTitle())+"."+schema.getTitle()+"("; // if required only: diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java index 6aa9c08250c9..60a004b6bea8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java @@ -884,8 +884,8 @@ public String getSimpleTypeDeclaration(Schema schema) { * Return a string representation of the Python types for the specified schema. * Primitive types in the OAS specification are implemented in Python using the corresponding * Python primitive types. - * Composed types (e.g. allAll, oneOf, anyOf) are represented in Python using list of types. - * + * Composed types (e.g. allAll, oneOf, anyOf) are represented in Python using list of types. + * * @param p The OAS schema. * @param prefix prepended to the returned value. * @param suffix appended to the returned value. diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index de25b7cf9754..66d3577f3c25 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -22,7 +22,7 @@ import tornado.gen from {{packageName}}.configuration import Configuration import {{modelPackage}} from {{packageName}} import rest -from {{packageName}}.exceptions import ApiValueError +from {{packageName}}.exceptions import ApiValueError, ApiException class ApiClient(object): @@ -186,22 +186,43 @@ class ApiClient(object): # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + {{^tornado}} + return return_data + {{/tornado}} + {{#tornado}} + raise tornado.gen.Return(return_data) + {{/tornado}} + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None {{^tornado}} if _return_http_data_only: diff --git a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache index f2099c753125..44531fce5a26 100644 --- a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache @@ -166,7 +166,7 @@ class RESTClientObject(object): r = await self.pool_manager.request(**args) if _preload_content: - data = await r.text() + data = await r.read() r = RESTResponse(r, data) # log response body diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache index 774dae89c61f..5285a7b80644 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_client.mustache @@ -7,6 +7,7 @@ import atexit import mimetypes from multiprocessing.pool import ThreadPool import os +import re # python 2 and python 3 compatibility library import six @@ -17,7 +18,7 @@ import tornado.gen from {{packageName}} import rest from {{packageName}}.configuration import Configuration -from {{packageName}}.exceptions import ApiValueError +from {{packageName}}.exceptions import ApiValueError, ApiException from {{packageName}}.model_utils import ( ModelNormal, ModelSimple, @@ -176,26 +177,48 @@ class ApiClient(object): # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize( - response_data, - response_type, - _check_type - ) - else: - return_data = None + + if not _preload_content: + {{^tornado}} + return (return_data) + {{/tornado}} + {{#tornado}} + raise tornado.gen.Return(return_data) + {{/tornado}} + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize( + response_data, + response_type, + _check_type + ) + else: + return_data = None {{^tornado}} if _return_http_data_only: diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache index 772efe91b39f..fe7abfdfc048 100644 --- a/modules/openapi-generator/src/main/resources/python/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/rest.mustache @@ -209,11 +209,6 @@ class RESTClientObject(object): if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) diff --git a/modules/openapi-generator/src/main/resources/python/tornado/rest.mustache b/modules/openapi-generator/src/main/resources/python/tornado/rest.mustache index e7a760f37060..2679760ea5bd 100644 --- a/modules/openapi-generator/src/main/resources/python/tornado/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/tornado/rest.mustache @@ -8,7 +8,6 @@ import logging import re # python 2 and python 3 compatibility library -import six from six.moves.urllib.parse import urlencode import tornado import tornado.gen @@ -28,11 +27,7 @@ class RESTResponse(io.IOBase): self.reason = resp.reason if resp.body: - # In Python 3, the response body is utf-8 encoded bytes. - if six.PY3: - self.data = resp.body.decode('utf-8') - else: - self.data = resp.body + self.data = resp.body else: self.data = None diff --git a/samples/client/petstore/python-asyncio/petstore_api/api_client.py b/samples/client/petstore/python-asyncio/petstore_api/api_client.py index 8aae783bfc3b..7e0d28cd4c68 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api_client.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api_client.py @@ -27,7 +27,7 @@ from petstore_api.configuration import Configuration import petstore_api.models from petstore_api import rest -from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiValueError, ApiException class ApiClient(object): @@ -177,22 +177,38 @@ async def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = await self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = await self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: return (return_data) diff --git a/samples/client/petstore/python-asyncio/petstore_api/rest.py b/samples/client/petstore/python-asyncio/petstore_api/rest.py index 1394af356ba2..9310b9dfdec4 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/rest.py +++ b/samples/client/petstore/python-asyncio/petstore_api/rest.py @@ -174,7 +174,7 @@ async def request(self, method, url, query_params=None, headers=None, r = await self.pool_manager.request(**args) if _preload_content: - data = await r.text() + data = await r.read() r = RESTResponse(r, data) # log response body diff --git a/samples/client/petstore/python-experimental/petstore_api/api_client.py b/samples/client/petstore/python-experimental/petstore_api/api_client.py index 2e9d94da16c9..398333268183 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api_client.py +++ b/samples/client/petstore/python-experimental/petstore_api/api_client.py @@ -15,6 +15,7 @@ import mimetypes from multiprocessing.pool import ThreadPool import os +import re # python 2 and python 3 compatibility library import six @@ -22,7 +23,7 @@ from petstore_api import rest from petstore_api.configuration import Configuration -from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiValueError, ApiException from petstore_api.model_utils import ( ModelNormal, ModelSimple, @@ -178,26 +179,43 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize( - response_data, - response_type, - _check_type - ) - else: - return_data = None + + if not _preload_content: + return (return_data) + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize( + response_data, + response_type, + _check_type + ) + else: + return_data = None if _return_http_data_only: return (return_data) diff --git a/samples/client/petstore/python-experimental/petstore_api/rest.py b/samples/client/petstore/python-experimental/petstore_api/rest.py index 7ed815b8a187..973161ca7aef 100644 --- a/samples/client/petstore/python-experimental/petstore_api/rest.py +++ b/samples/client/petstore/python-experimental/petstore_api/rest.py @@ -217,11 +217,6 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) diff --git a/samples/client/petstore/python-experimental/test/test_format_test.py b/samples/client/petstore/python-experimental/test/test_format_test.py index ed926aa031ea..e7a32e3253ff 100644 --- a/samples/client/petstore/python-experimental/test/test_format_test.py +++ b/samples/client/petstore/python-experimental/test/test_format_test.py @@ -150,4 +150,4 @@ def test_string(self): if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/samples/client/petstore/python-experimental/tests/test_api_exception.py b/samples/client/petstore/python-experimental/tests/test_api_exception.py index 026ba5bd79c1..b26ef5252bbf 100644 --- a/samples/client/petstore/python-experimental/tests/test_api_exception.py +++ b/samples/client/petstore/python-experimental/tests/test_api_exception.py @@ -10,6 +10,7 @@ """ import os +import six import sys import unittest diff --git a/samples/client/petstore/python-experimental/tests/test_deserialization.py b/samples/client/petstore/python-experimental/tests/test_deserialization.py index 8ebeb1751ce6..83ecabe81d25 100644 --- a/samples/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/client/petstore/python-experimental/tests/test_deserialization.py @@ -377,6 +377,36 @@ def get_header(name, default=None): finally: os.unlink(file_path) + def test_deserialize_binary_to_str(self): + """Ensures that bytes deserialization works""" + response_types_mixed = (str,) + + # sample from http://www.jtricks.com/download-text + HTTPResponse = namedtuple( + 'urllib3_response_HTTPResponse', + ['status', 'reason', 'data', 'getheaders', 'getheader'] + ) + headers = {} + def get_headers(): + return headers + def get_header(name, default=None): + return headers.get(name, default) + data = "str" + + http_response = HTTPResponse( + status=200, + reason='OK', + data=json.dumps(data).encode("utf-8") if six.PY3 else json.dumps(data), + getheaders=get_headers, + getheader=get_header + ) + + mock_response = RESTResponse(http_response) + + result = self.deserialize(mock_response, response_types_mixed, True) + self.assertEqual(isinstance(result, str), True) + self.assertEqual(result, data) + def test_deserialize_string_boolean_map(self): """ Ensures that string boolean (additional properties) diff --git a/samples/client/petstore/python-experimental/tests/test_pet_api.py b/samples/client/petstore/python-experimental/tests/test_pet_api.py index 919d2505423f..ee7e53ecad85 100644 --- a/samples/client/petstore/python-experimental/tests/test_pet_api.py +++ b/samples/client/petstore/python-experimental/tests/test_pet_api.py @@ -329,7 +329,7 @@ def get_header(name, default=None): http_response = HTTPResponse( status=200, reason='OK', - data=json.dumps(api_respponse), + data=json.dumps(api_respponse).encode('utf-8'), getheaders=get_headers, getheader=get_header ) diff --git a/samples/client/petstore/python-tornado/petstore_api/api_client.py b/samples/client/petstore/python-tornado/petstore_api/api_client.py index 328c1a70e10e..3fc10d72ab50 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api_client.py +++ b/samples/client/petstore/python-tornado/petstore_api/api_client.py @@ -28,7 +28,7 @@ from petstore_api.configuration import Configuration import petstore_api.models from petstore_api import rest -from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiValueError, ApiException class ApiClient(object): @@ -178,22 +178,38 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = yield self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = yield self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + raise tornado.gen.Return(return_data) + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: raise tornado.gen.Return(return_data) diff --git a/samples/client/petstore/python-tornado/petstore_api/rest.py b/samples/client/petstore/python-tornado/petstore_api/rest.py index d5661febf4b5..f3f274480a6a 100644 --- a/samples/client/petstore/python-tornado/petstore_api/rest.py +++ b/samples/client/petstore/python-tornado/petstore_api/rest.py @@ -16,7 +16,6 @@ import re # python 2 and python 3 compatibility library -import six from six.moves.urllib.parse import urlencode import tornado import tornado.gen @@ -36,11 +35,7 @@ def __init__(self, resp): self.reason = resp.reason if resp.body: - # In Python 3, the response body is utf-8 encoded bytes. - if six.PY3: - self.data = resp.body.decode('utf-8') - else: - self.data = resp.body + self.data = resp.body else: self.data = None diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index a80084e04b0f..7b1b0010a49a 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -27,7 +27,7 @@ from petstore_api.configuration import Configuration import petstore_api.models from petstore_api import rest -from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiValueError, ApiException class ApiClient(object): @@ -176,22 +176,38 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: return (return_data) diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index 7ed815b8a187..973161ca7aef 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -217,11 +217,6 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) diff --git a/samples/client/petstore/python/test/test_format_test.py b/samples/client/petstore/python/test/test_format_test.py index 70255fccd1d3..e64c47b385d7 100644 --- a/samples/client/petstore/python/test/test_format_test.py +++ b/samples/client/petstore/python/test/test_format_test.py @@ -36,19 +36,19 @@ def make_instance(self, include_optional): # model = petstore_api.models.format_test.FormatTest() # noqa: E501 if include_optional : return FormatTest( - integer = 1E+1, - int32 = 2E+1, - int64 = 56, - number = 32.1, - float = 54.3, - double = 67.8, - string = 'a', - byte = 'YQ==', - binary = bytes(b'blah'), - date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', - password = '0123456789', + integer = 1E+1, + int32 = 2E+1, + int64 = 56, + number = 32.1, + float = 54.3, + double = 67.8, + string = 'a', + byte = 'YQ==', + binary = 'bytes', + date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', + password = '0123456789', big_decimal = 1 ) else : diff --git a/samples/client/petstore/python/tests/test_api_exception.py b/samples/client/petstore/python/tests/test_api_exception.py index 75bf81a8de07..b076628c0a0b 100644 --- a/samples/client/petstore/python/tests/test_api_exception.py +++ b/samples/client/petstore/python/tests/test_api_exception.py @@ -10,6 +10,7 @@ """ import os +import six import sys import unittest diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py index 544a21c79ddd..1edccecef670 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api_client.py @@ -15,6 +15,7 @@ import mimetypes from multiprocessing.pool import ThreadPool import os +import re # python 2 and python 3 compatibility library import six @@ -22,7 +23,7 @@ from petstore_api import rest from petstore_api.configuration import Configuration -from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiValueError, ApiException from petstore_api.model_utils import ( ModelNormal, ModelSimple, @@ -178,26 +179,43 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize( - response_data, - response_type, - _check_type - ) - else: - return_data = None + + if not _preload_content: + return (return_data) + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize( + response_data, + response_type, + _check_type + ) + else: + return_data = None if _return_http_data_only: return (return_data) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/rest.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/rest.py index 7ed815b8a187..973161ca7aef 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/rest.py @@ -217,11 +217,6 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index a80084e04b0f..7b1b0010a49a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -27,7 +27,7 @@ from petstore_api.configuration import Configuration import petstore_api.models from petstore_api import rest -from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiValueError, ApiException class ApiClient(object): @@ -176,22 +176,38 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: return (return_data) diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py index 7ed815b8a187..973161ca7aef 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py @@ -217,11 +217,6 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) diff --git a/samples/server/petstore/php-slim4/lib/Model/EnumClass.php b/samples/server/petstore/php-slim4/lib/Model/EnumClass.php index 3ddd829b3137..c3998d8602c5 100644 --- a/samples/server/petstore/php-slim4/lib/Model/EnumClass.php +++ b/samples/server/petstore/php-slim4/lib/Model/EnumClass.php @@ -30,8 +30,8 @@ class EnumClass implements ModelInterface private const MODEL_SCHEMA = <<<'SCHEMA' { "type" : "string", - "default" : "-efg", - "enum" : [ "_abc", "-efg", "(xyz)" ] + "enum" : [ "_abc", "-efg", "(xyz)" ], + "default" : "-efg" } SCHEMA; From 3b0bd368a6e101d844d47220686674e0ff16550b Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Tue, 28 Apr 2020 00:09:14 +0800 Subject: [PATCH 21/78] Update Java (feign) client dependency (#6068) * update feign dependency * update feign samples --- .../libraries/feign/build.gradle.mustache | 4 ++-- .../Java/libraries/feign/build.sbt.mustache | 8 +++---- .../Java/libraries/feign/pom.mustache | 24 +++++++++++++++---- .../client/petstore/java/feign/build.gradle | 2 +- samples/client/petstore/java/feign/build.sbt | 2 +- samples/client/petstore/java/feign/pom.xml | 22 ++++++++++++++--- .../petstore/java/feign10x/build.gradle | 4 ++-- .../client/petstore/java/feign10x/build.sbt | 8 +++---- samples/client/petstore/java/feign10x/pom.xml | 24 +++++++++++++++---- 9 files changed, 73 insertions(+), 25 deletions(-) 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 2a6c4c79fbc5..86cdad95f82f 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 @@ -119,14 +119,14 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" + swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" jackson_databind_version = "2.10.3" jackson_databind_nullable_version = "0.2.1" {{#threetenbp}} jackson_threetenbp_version = "2.9.10" {{/threetenbp}} - feign_version = "{{#useFeign10}}10.7.4{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" + feign_version = "{{#useFeign10}}11.0{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" feign_form_version = "{{#useFeign10}}3.8.0{{/useFeign10}}{{^useFeign10}}2.1.0{{/useFeign10}}" junit_version = "4.13" oltu_version = "1.0.1" 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 8fa1d345b26f..cd55527b8ec4 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 @@ -9,10 +9,10 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.22" % "compile", - "io.github.openfeign" % "feign-core" % "{{#useFeign10}}10.7.4{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" % "compile", - "io.github.openfeign" % "feign-jackson" % "{{#useFeign10}}10.7.4{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" % "compile", - "io.github.openfeign" % "feign-slf4j" % "{{#useFeign10}}10.7.4{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "io.github.openfeign" % "feign-core" % "{{#useFeign10}}11.0{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" % "compile", + "io.github.openfeign" % "feign-jackson" % "{{#useFeign10}}11.0{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" % "compile", + "io.github.openfeign" % "feign-slf4j" % "{{#useFeign10}}11.0{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}" % "compile", "io.github.openfeign.form" % "feign-form" % "{{#useFeign10}}3.8.0{{/useFeign10}}{{^useFeign10}}2.1.0{{/useFeign10}}" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", 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 86f6f397781d..a40806b32e98 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 @@ -63,7 +63,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.12</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -73,7 +73,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> - <forkMode>pertest</forkMode> + <threadCount>10</threadCount> </configuration> </plugin> <plugin> @@ -139,6 +139,22 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + <fork>true</fork> + <meminitial>128m</meminitial> + <maxmem>512m</maxmem> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. --> + </compilerArgs> + </configuration> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -314,8 +330,8 @@ <java.version>{{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}}</java.version> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> - <swagger-annotations-version>1.5.21</swagger-annotations-version> - <feign-version>{{#useFeign10}}10.7.4{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}</feign-version> + <swagger-annotations-version>1.5.24</swagger-annotations-version> + <feign-version>{{#useFeign10}}11.0{{/useFeign10}}{{^useFeign10}}9.7.0{{/useFeign10}}</feign-version> <feign-form-version>{{#useFeign10}}3.8.0{{/useFeign10}}{{^useFeign10}}2.1.0{{/useFeign10}}</feign-form-version> <jackson-version>2.10.3</jackson-version> <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index b44f6694d154..4768524c68d1 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -95,7 +95,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" + swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" jackson_databind_version = "2.10.3" jackson_databind_nullable_version = "0.2.1" diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index 4e32526ee17d..f706a6d48600 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.22" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", "io.github.openfeign" % "feign-core" % "9.7.0" % "compile", "io.github.openfeign" % "feign-jackson" % "9.7.0" % "compile", "io.github.openfeign" % "feign-slf4j" % "9.7.0" % "compile", diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index f8b07f983a71..5e288b31a459 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -56,7 +56,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.12</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -66,7 +66,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> - <forkMode>pertest</forkMode> + <threadCount>10</threadCount> </configuration> </plugin> <plugin> @@ -132,6 +132,22 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + <fork>true</fork> + <meminitial>128m</meminitial> + <maxmem>512m</maxmem> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. --> + </compilerArgs> + </configuration> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -281,7 +297,7 @@ <java.version>1.7</java.version> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> - <swagger-annotations-version>1.5.21</swagger-annotations-version> + <swagger-annotations-version>1.5.24</swagger-annotations-version> <feign-version>9.7.0</feign-version> <feign-form-version>2.1.0</feign-form-version> <jackson-version>2.10.3</jackson-version> diff --git a/samples/client/petstore/java/feign10x/build.gradle b/samples/client/petstore/java/feign10x/build.gradle index a559aaf0b068..5d8ed83e60c2 100644 --- a/samples/client/petstore/java/feign10x/build.gradle +++ b/samples/client/petstore/java/feign10x/build.gradle @@ -95,12 +95,12 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.22" + swagger_annotations_version = "1.5.24" jackson_version = "2.10.3" jackson_databind_version = "2.10.3" jackson_databind_nullable_version = "0.2.1" jackson_threetenbp_version = "2.9.10" - feign_version = "10.7.4" + feign_version = "11.0" feign_form_version = "3.8.0" junit_version = "4.13" oltu_version = "1.0.1" diff --git a/samples/client/petstore/java/feign10x/build.sbt b/samples/client/petstore/java/feign10x/build.sbt index 2ef42df48c01..ff7f74d3359d 100644 --- a/samples/client/petstore/java/feign10x/build.sbt +++ b/samples/client/petstore/java/feign10x/build.sbt @@ -9,10 +9,10 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.22" % "compile", - "io.github.openfeign" % "feign-core" % "10.7.4" % "compile", - "io.github.openfeign" % "feign-jackson" % "10.7.4" % "compile", - "io.github.openfeign" % "feign-slf4j" % "10.7.4" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "io.github.openfeign" % "feign-core" % "11.0" % "compile", + "io.github.openfeign" % "feign-jackson" % "11.0" % "compile", + "io.github.openfeign" % "feign-slf4j" % "11.0" % "compile", "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", diff --git a/samples/client/petstore/java/feign10x/pom.xml b/samples/client/petstore/java/feign10x/pom.xml index 290f88e0aee9..5cb786250a7e 100644 --- a/samples/client/petstore/java/feign10x/pom.xml +++ b/samples/client/petstore/java/feign10x/pom.xml @@ -56,7 +56,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.12</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -66,7 +66,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> - <forkMode>pertest</forkMode> + <threadCount>10</threadCount> </configuration> </plugin> <plugin> @@ -132,6 +132,22 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + <fork>true</fork> + <meminitial>128m</meminitial> + <maxmem>512m</maxmem> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. --> + </compilerArgs> + </configuration> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> @@ -281,8 +297,8 @@ <java.version>1.7</java.version> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> - <swagger-annotations-version>1.5.21</swagger-annotations-version> - <feign-version>10.7.4</feign-version> + <swagger-annotations-version>1.5.24</swagger-annotations-version> + <feign-version>11.0</feign-version> <feign-form-version>3.8.0</feign-form-version> <jackson-version>2.10.3</jackson-version> <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> From 588023686af0bffc161028df2612b27be50808fd Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Tue, 28 Apr 2020 00:09:30 +0800 Subject: [PATCH 22/78] Add HTTP signature authentication support to Java (jersey2-experimental) (#6058) * add fmt-maven-plugin to jersey2 exp * update samples * add http signature auth template * minor fix * fix http beaer auth, update sample * fix http signature auth * fix http signature auth * header support * add query string to path * undo changes in default codegen * ignore fake test * add serialize to string method * add serialzie to string method * add get mapper * auto format java source code * remove plugin * update pom.xml * change back AbstractOpenApiSchema to T * skip mvn code formatter in bin script * undo changes to spec * update samples * add back HttpSignatureAuth.java --- bin/java-petstore-jersey2-experimental.sh | 4 +- .../codegen/languages/JavaClientCodegen.java | 1 + .../jersey2-experimental/ApiClient.mustache | 79 +- .../jersey2-experimental/JSON.mustache | 2 + .../auth/ApiKeyAuth.mustache | 68 + .../auth/Authentication.mustache | 22 + .../auth/HttpBasicAuth.mustache | 62 + .../auth/HttpBearerAuth.mustache | 51 + .../auth/HttpSignatureAuth.mustache | 115 ++ .../jersey2-experimental/auth/OAuth.mustache | 30 + .../auth/OAuthFlow.mustache | 7 + .../jersey2-experimental/pom.mustache | 113 +- ...ith-fake-endpoints-models-for-testing.yaml | 2 +- .../jersey2-experimental/api/openapi.yaml | 1045 ++++++------- .../docs/AdditionalPropertiesClass.md | 13 +- .../docs/AnotherFakeApi.md | 8 +- .../jersey2-experimental/docs/DefaultApi.md | 68 + .../jersey2-experimental/docs/EnumTest.md | 3 + .../java/jersey2-experimental/docs/FakeApi.md | 154 +- .../docs/FakeClassnameTags123Api.md | 8 +- .../java/jersey2-experimental/docs/Foo.md | 12 + .../jersey2-experimental/docs/FormatTest.md | 3 +- .../docs/HealthCheckResult.md | 13 + .../jersey2-experimental/docs/InlineObject.md | 13 + .../docs/InlineObject1.md | 13 + .../docs/InlineObject2.md | 32 + .../docs/InlineObject3.md | 25 + .../docs/InlineObject4.md | 13 + .../docs/InlineObject5.md | 13 + .../docs/InlineResponseDefault.md | 12 + .../docs/NullableClass.md | 23 + .../docs/OuterEnumDefaultValue.md | 15 + .../docs/OuterEnumInteger.md | 15 + .../docs/OuterEnumIntegerDefaultValue.md | 15 + .../java/jersey2-experimental/docs/PetApi.md | 19 +- .../jersey2-experimental/docs/StoreApi.md | 10 +- .../java/jersey2-experimental/docs/UserApi.md | 40 +- .../java/jersey2-experimental/pom.xml | 41 +- .../org/openapitools/client/ApiClient.java | 466 ++++-- .../org/openapitools/client/ApiException.java | 154 +- .../org/openapitools/client/ApiResponse.java | 71 +- .../openapitools/client/Configuration.java | 42 +- .../client/CustomInstantDeserializer.java | 276 ++-- .../java/org/openapitools/client/JSON.java | 12 +- .../java/org/openapitools/client/Pair.java | 66 +- .../client/RFC3339DateFormat.java | 7 +- .../client/ServerConfiguration.java | 91 +- .../openapitools/client/ServerVariable.java | 31 +- .../org/openapitools/client/StringUtil.java | 13 +- .../client/api/AnotherFakeApi.java | 94 +- .../openapitools/client/api/DefaultApi.java | 94 ++ .../org/openapitools/client/api/FakeApi.java | 1359 ++++++++++------- .../client/api/FakeClassnameTags123Api.java | 94 +- .../org/openapitools/client/api/PetApi.java | 680 +++++---- .../org/openapitools/client/api/StoreApi.java | 311 ++-- .../org/openapitools/client/api/UserApi.java | 608 ++++---- .../openapitools/client/auth/ApiKeyAuth.java | 20 +- .../client/auth/Authentication.java | 33 +- .../client/auth/HttpBasicAuth.java | 27 +- .../client/auth/HttpBearerAuth.java | 31 +- .../client/auth/HttpSignatureAuth.java | 141 ++ .../org/openapitools/client/auth/OAuth.java | 20 +- .../openapitools/client/auth/OAuthFlow.java | 8 +- .../client/model/AbstractOpenApiSchema.java | 32 +- .../model/AdditionalPropertiesArray.java | 107 -- .../model/AdditionalPropertiesBoolean.java | 106 -- .../model/AdditionalPropertiesClass.java | 444 +----- .../model/AdditionalPropertiesInteger.java | 106 -- .../model/AdditionalPropertiesNumber.java | 107 -- .../org/openapitools/client/model/Animal.java | 60 +- .../model/ArrayOfArrayOfNumberOnly.java | 37 +- .../client/model/ArrayOfNumberOnly.java | 37 +- .../openapitools/client/model/ArrayTest.java | 64 +- .../org/openapitools/client/model/BigCat.java | 145 -- .../client/model/BigCatAllOf.java | 141 -- .../client/model/Capitalization.java | 100 +- .../org/openapitools/client/model/Cat.java | 42 +- .../openapitools/client/model/CatAllOf.java | 37 +- .../openapitools/client/model/Category.java | 51 +- .../openapitools/client/model/ClassModel.java | 36 +- .../org/openapitools/client/model/Client.java | 37 +- .../org/openapitools/client/model/Dog.java | 42 +- .../openapitools/client/model/DogAllOf.java | 37 +- .../openapitools/client/model/EnumArrays.java | 64 +- .../openapitools/client/model/EnumClass.java | 16 +- .../openapitools/client/model/EnumTest.java | 233 ++- .../client/model/FileSchemaTestClass.java | 47 +- ...ditionalPropertiesString.java => Foo.java} | 73 +- .../openapitools/client/model/FormatTest.java | 283 ++-- .../client/model/HasOnlyReadOnly.java | 50 +- .../client/model/HealthCheckResult.java | 104 ++ ...opertiesAnyType.java => InlineObject.java} | 81 +- .../client/model/InlineObject1.java | 117 ++ .../client/model/InlineObject2.java | 198 +++ .../client/model/InlineObject3.java | 481 ++++++ .../client/model/InlineObject4.java | 111 ++ .../client/model/InlineObject5.java | 116 ++ ...Object.java => InlineResponseDefault.java} | 73 +- .../openapitools/client/model/MapTest.java | 78 +- ...ropertiesAndAdditionalPropertiesClass.java | 64 +- .../client/model/Model200Response.java | 46 +- .../client/model/ModelApiResponse.java | 59 +- .../client/model/ModelReturn.java | 36 +- .../org/openapitools/client/model/Name.java | 68 +- .../client/model/NullableClass.java | 612 ++++++++ .../openapitools/client/model/NumberOnly.java | 37 +- .../org/openapitools/client/model/Order.java | 103 +- .../client/model/OuterComposite.java | 59 +- .../openapitools/client/model/OuterEnum.java | 18 +- .../client/model/OuterEnumDefaultValue.java | 52 + .../client/model/OuterEnumInteger.java | 52 + .../model/OuterEnumIntegerDefaultValue.java | 52 + .../org/openapitools/client/model/Pet.java | 105 +- .../client/model/ReadOnlyFirst.java | 51 +- .../client/model/SpecialModelName.java | 45 +- .../org/openapitools/client/model/Tag.java | 51 +- .../client/model/TypeHolderDefault.java | 229 --- .../client/model/TypeHolderExample.java | 259 ---- .../org/openapitools/client/model/User.java | 119 +- .../openapitools/client/model/XmlItem.java | 1045 ------------- .../client/api/AnotherFakeApiTest.java | 48 +- .../client/api/DefaultApiTest.java | 29 + .../openapitools/client/api/FakeApiTest.java | 535 ++++--- .../api/FakeClassnameTags123ApiTest.java | 48 +- .../openapitools/client/api/PetApiTest.java | 286 ++-- .../openapitools/client/api/StoreApiTest.java | 133 +- .../openapitools/client/api/UserApiTest.java | 243 ++- .../AdditionalPropertiesAnyTypeTest.java | 51 - .../model/AdditionalPropertiesArrayTest.java | 52 - .../AdditionalPropertiesBooleanTest.java | 51 - .../model/AdditionalPropertiesClassTest.java | 137 +- .../AdditionalPropertiesIntegerTest.java | 51 - .../model/AdditionalPropertiesNumberTest.java | 52 - .../model/AdditionalPropertiesObjectTest.java | 51 - .../model/AdditionalPropertiesStringTest.java | 51 - .../openapitools/client/model/AnimalTest.java | 63 +- .../model/ArrayOfArrayOfNumberOnlyTest.java | 50 +- .../client/model/ArrayOfNumberOnlyTest.java | 50 +- .../client/model/ArrayTestTest.java | 78 +- .../client/model/BigCatAllOfTest.java | 49 - .../openapitools/client/model/BigCatTest.java | 75 - .../client/model/CapitalizationTest.java | 117 +- .../client/model/CatAllOfTest.java | 47 +- .../openapitools/client/model/CatTest.java | 77 +- .../client/model/CategoryTest.java | 61 +- .../client/model/ClassModelTest.java | 47 +- .../openapitools/client/model/ClientTest.java | 47 +- .../client/model/DogAllOfTest.java | 47 +- .../openapitools/client/model/DogTest.java | 77 +- .../client/model/EnumArraysTest.java | 63 +- .../client/model/EnumClassTest.java | 23 +- .../client/model/EnumTestTest.java | 108 +- .../client/model/FileSchemaTestClassTest.java | 63 +- .../openapitools/client/model/FooTest.java | 32 + .../client/model/FormatTestTest.java | 240 ++- .../client/model/HasOnlyReadOnlyTest.java | 61 +- .../client/model/HealthCheckResultTest.java | 32 + .../client/model/InlineObject1Test.java | 38 + .../client/model/InlineObject2Test.java | 38 + .../client/model/InlineObject3Test.java | 110 ++ .../client/model/InlineObject4Test.java | 38 + .../client/model/InlineObject5Test.java | 38 + .../client/model/InlineObjectTest.java | 38 + .../model/InlineResponseDefaultTest.java | 32 + .../client/model/MapTestTest.java | 92 +- ...rtiesAndAdditionalPropertiesClassTest.java | 82 +- .../client/model/Model200ResponseTest.java | 61 +- .../client/model/ModelApiResponseTest.java | 75 +- .../client/model/ModelReturnTest.java | 47 +- .../openapitools/client/model/NameTest.java | 89 +- .../client/model/NullableClassTest.java | 98 ++ .../client/model/NumberOnlyTest.java | 48 +- .../openapitools/client/model/OrderTest.java | 118 +- .../client/model/OuterCompositeTest.java | 76 +- .../model/OuterEnumDefaultValueTest.java | 24 + .../OuterEnumIntegerDefaultValueTest.java | 24 + .../client/model/OuterEnumIntegerTest.java | 24 + .../client/model/OuterEnumTest.java | 23 +- .../openapitools/client/model/PetTest.java | 121 +- .../client/model/ReadOnlyFirstTest.java | 61 +- .../client/model/SpecialModelNameTest.java | 47 +- .../openapitools/client/model/TagTest.java | 61 +- .../client/model/TypeHolderDefaultTest.java | 84 - .../client/model/TypeHolderExampleTest.java | 92 -- .../openapitools/client/model/UserTest.java | 127 +- .../client/model/XmlItemTest.java | 276 ---- .../petstore/go/go-petstore/api/openapi.yaml | 3 +- .../petstore/go/go-petstore/docs/FakeApi.md | 2 +- .../php/OpenAPIClient-php/docs/Api/FakeApi.md | 7 +- .../client/petstore/python/docs/FakeApi.md | 68 +- .../python/petstore_api/api/fake_api.py | 2 +- .../petstore/ruby-faraday/docs/FakeApi.md | 5 +- .../ruby-faraday/lib/petstore/api/fake_api.rb | 2 +- .../client/petstore/ruby/docs/FakeApi.md | 5 +- .../ruby/lib/petstore/api/fake_api.rb | 2 +- .../java/org/openapitools/api/FakeApi.java | 4 +- 196 files changed, 9345 insertions(+), 10148 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/ApiKeyAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/Authentication.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBasicAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBearerAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuth.mustache create mode 100644 modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuthFlow.mustache create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/DefaultApi.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/Foo.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/HealthCheckResult.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineObject.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineObject1.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineObject2.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineObject3.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineObject4.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineObject5.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/InlineResponseDefault.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/NullableClass.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/OuterEnumDefaultValue.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/OuterEnumInteger.md create mode 100644 samples/client/petstore/java/jersey2-experimental/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java rename samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/{AdditionalPropertiesString.java => Foo.java} (53%) create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java rename samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/{AdditionalPropertiesAnyType.java => InlineObject.java} (59%) create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java rename samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/{AdditionalPropertiesObject.java => InlineResponseDefault.java} (53%) create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/DefaultApiTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FooTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject1Test.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject2Test.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject3Test.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject4Test.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject5Test.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObjectTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NullableClassTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java create mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java delete mode 100644 samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/bin/java-petstore-jersey2-experimental.sh b/bin/java-petstore-jersey2-experimental.sh index a4ab8a13a843..2bd023c97b47 100755 --- a/bin/java-petstore-jersey2-experimental.sh +++ b/bin/java-petstore-jersey2-experimental.sh @@ -27,13 +27,15 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2-experimental.json -o samples/client/petstore/java/jersey2-experimental -t modules/openapi-generator/src/main/resources/Java --additional-properties hideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2-experimental.json -o samples/client/petstore/java/jersey2-experimental -t modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/jersey2-experimental/src/main" rm -rf samples/client/petstore/java/jersey2-experimental/src/main find samples/client/petstore/java/jersey2-experimental -maxdepth 1 -type f ! -name "README.md" -exec rm {} + java $JAVA_OPTS -jar $executable $ags +#mvn com.coveo:fmt-maven-plugin:format -f samples/client/petstore/java/jersey2-experimental/pom.xml + # copy additional manually written unit-tests #mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client #mkdir samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/auth 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 5caf5c0b679f..e708b1f7e624 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 @@ -373,6 +373,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java")); supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java")); if (JERSEY2_EXPERIMENTAL.equals(getLibrary())) { + supportingFiles.add(new SupportingFile("auth/HttpSignatureAuth.mustache", authFolder, "HttpSignatureAuth.java")); supportingFiles.add(new SupportingFile("AbstractOpenApiSchema.mustache", (sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar), "AbstractOpenApiSchema.java")); } forceSerializationLibrary(SERIALIZATION_LIBRARY_JACKSON); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache index 618264dc90c0..10a976f6d760 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiClient.mustache @@ -23,6 +23,7 @@ import org.glassfish.jersey.media.multipart.MultiPartFeature; import java.io.IOException; import java.io.InputStream; +import java.net.URI; {{^supportJava6}} import java.nio.file.Files; import java.nio.file.StandardCopyOption; @@ -56,6 +57,7 @@ import java.util.regex.Pattern; import {{invokerPackage}}.auth.Authentication; import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.HttpBearerAuth; +import {{invokerPackage}}.auth.HttpSignatureAuth; import {{invokerPackage}}.auth.ApiKeyAuth; import {{invokerPackage}}.model.AbstractOpenApiSchema; @@ -159,11 +161,26 @@ public class ApiClient { setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap<String, Authentication>();{{#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}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + authentications = new HashMap<String, Authentication>(); + {{#authMethods}} + {{#isBasic}} + {{#isBasicBasic}} + authentications.put("{{name}}", new HttpBasicAuth()); + {{/isBasicBasic}} + {{#isBasicBearer}} + authentications.put("{{name}}", new HttpBearerAuth("{{scheme}}")); + {{/isBasicBearer}} + {{#isHttpSignature}} + authentications.put("{{name}}", new HttpSignatureAuth("{{name}}", null, null)); + {{/isHttpSignature}} + {{/isBasic}} + {{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}")); + {{/isApiKey}} + {{#isOAuth}} + authentications.put("{{name}}", new OAuth()); + {{/isOAuth}} + {{/authMethods}} // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -701,6 +718,38 @@ public class ApiClient { return entity; } + /** + * Serialize the given Java object into string according the given + * Content-Type (only JSON, HTTP form is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return String + * @throws ApiException API exception + */ + public String serializeToString(Object obj, Map<String, Object> formParams, String contentType) throws ApiException { + try { + if (contentType.startsWith("multipart/form-data")) { + throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + String formString = ""; + for (Entry<String, Object> param : formParams.entrySet()) { + formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; + } + + if (formString.length() == 0) { // empty string + return formString; + } else { + return formString.substring(0, formString.length() - 1); + } + } else { + return json.getMapper().writeValueAsString(obj); + } + } catch (Exception ex) { + throw new ApiException("Failed to perform serializeToString: " + ex.toString()); + } + } + public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ Object result = null; @@ -862,7 +911,6 @@ public class ApiClient { * @throws ApiException API exception */ public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); // Not using `.target(targetURL).path(path)` below, // to support (constant) query string in `path`, e.g. "/posts?draft=1" @@ -935,6 +983,14 @@ public class ApiClient { Entity<?> entity = serialize(body, formParams, contentType); + // put all headers in one place + Map<String, String> allHeaderParams = new HashMap<>(); + allHeaderParams.putAll(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + // update different parameters (e.g. headers) for authentication + updateParamsForAuth(authNames, queryParams, allHeaderParams, cookieParams, serializeToString(body, formParams, contentType), method, target.getUri()); + Response response = null; try { @@ -1061,12 +1117,17 @@ public class ApiClient { * @param queryParams List of query parameters * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters + * @param method HTTP method (e.g. POST) + * @param uri HTTP URI */ - protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, + Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { for (String authName : authNames) { Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams, cookieParams); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache index b442f0836da8..e25b307f7d0c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache @@ -62,4 +62,6 @@ public class JSON implements ContextResolver<ObjectMapper> { public ObjectMapper getContext(Class<?> type) { return mapper; } + + public ObjectMapper getMapper() { return mapper; } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/ApiKeyAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/ApiKeyAuth.mustache new file mode 100644 index 000000000000..1731f936fb87 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/ApiKeyAuth.mustache @@ -0,0 +1,68 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/Authentication.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/Authentication.mustache new file mode 100644 index 000000000000..46d9c1ab6ace --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/Authentication.mustache @@ -0,0 +1,22 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException; + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBasicAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBasicAuth.mustache new file mode 100644 index 000000000000..898bb97ee782 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBasicAuth.mustache @@ -0,0 +1,62 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +{{^java8}} +import com.migcomponents.migbase64.Base64; +{{/java8}} +{{#java8}} +import java.util.Base64; +import java.nio.charset.StandardCharsets; +{{/java8}} + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{^java8}} +import java.io.UnsupportedEncodingException; +{{/java8}} + +{{>generatedAnnotation}} +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); +{{^java8}} + try { + headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } +{{/java8}} +{{#java8}} + headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); +{{/java8}} + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBearerAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBearerAuth.mustache new file mode 100644 index 000000000000..110a11ea7798 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpBearerAuth.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache new file mode 100644 index 000000000000..3a856e3bc3c5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache @@ -0,0 +1,115 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.Key; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.List; + +import org.tomitribe.auth.signatures.*; + +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + private String name; + + private Algorithm algorithm; + + private List<String> headers; + + public HttpSignatureAuth(String name, Algorithm algorithm, List<String> headers) { + this.name = name; + this.algorithm = algorithm; + this.headers = headers; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Algorithm getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + public List<String> getHeaders() { + return headers; + } + + public void setHeaders(List<String> headers) { + this.headers = headers; + } + + public Signer getSigner() { + return signer; + } + + public void setSigner(Signer signer) { + this.signer = signer; + } + + public void setup(Key key) throws ApiException { + if (key == null) { + throw new ApiException("key (java.security.Key) cannot be null"); + } + + signer = new Signer(key, new Signature(name, algorithm, null, headers)); + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, + String payload, String method, URI uri) throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); + } + + if (headers.contains("digest")) { + headerParams.put("digest", "SHA-256=" + new String(Base64.getEncoder().encode(MessageDigest.getInstance("SHA-256").digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException("Signer cannot be null. Please run the method `setup` to set it up correctly"); + } + + // construct the path with the URL query string + String path = uri.getPath(); + + List<String> urlQueries = new ArrayList<String>(); + for (Pair queryParam : queryParams) { + urlQueries.add(queryParam.getName() + "=" + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); + } + + if (!urlQueries.isEmpty()) { + path = path + "?" + String.join("&", urlQueries); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuth.mustache new file mode 100644 index 000000000000..8622798ad378 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuth.mustache @@ -0,0 +1,30 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +{{>generatedAnnotation}} +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { + if (accessToken != null) { + headerParams.put("Authorization", "Bearer " + accessToken); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuthFlow.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuthFlow.mustache new file mode 100644 index 000000000000..002e9572f33f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/OAuthFlow.mustache @@ -0,0 +1,7 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache index bf1c3648c20e..a71ab2638633 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/pom.mustache @@ -63,7 +63,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.12</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -73,7 +73,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> - <forkMode>pertest</forkMode> + <threadCount>10</threadCount> </configuration> </plugin> <plugin> @@ -142,7 +142,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.6.1</version> + <version>3.8.1</version> <configuration> {{#supportJava6}} <source>1.6</source> @@ -158,6 +158,13 @@ <target>1.7</target> {{/java8}} {{/supportJava6}} + <fork>true</fork> + <meminitial>128m</meminitial> + <maxmem>512m</maxmem> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. --> + </compilerArgs> </configuration> </plugin> <plugin> @@ -283,64 +290,67 @@ <version>${jackson-databind-nullable-version}</version> </dependency> {{#withXml}} - - <!-- XML processing: JAXB --> - <dependency> - <groupId>org.glassfish.jersey.media</groupId> - <artifactId>jersey-media-jaxb</artifactId> - <version>${jersey-version}</version> - </dependency> - + <!-- XML processing: JAXB --> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-jaxb</artifactId> + <version>${jersey-version}</version> + </dependency> {{/withXml}} {{#joda}} - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-joda</artifactId> - <version>${jackson-version}</version> - </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-joda</artifactId> + <version>${jackson-version}</version> + </dependency> {{/joda}} {{#java8}} - <dependency> - <groupId>com.fasterxml.jackson.datatype</groupId> - <artifactId>jackson-datatype-jsr310</artifactId> - <version>${jackson-version}</version> - </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>${jackson-version}</version> + </dependency> {{/java8}} {{#threetenbp}} - <dependency> - <groupId>com.github.joschi.jackson</groupId> - <artifactId>jackson-datatype-threetenbp</artifactId> - <version>${threetenbp-version}</version> - </dependency> + <dependency> + <groupId>com.github.joschi.jackson</groupId> + <artifactId>jackson-datatype-threetenbp</artifactId> + <version>${threetenbp-version}</version> + </dependency> {{/threetenbp}} {{^java8}} - <!-- Base64 encoding that works in both JVM and Android --> - <dependency> - <groupId>com.brsanthu</groupId> - <artifactId>migbase64</artifactId> - <version>2.2</version> - </dependency> + <!-- Base64 encoding that works in both JVM and Android --> + <dependency> + <groupId>com.brsanthu</groupId> + <artifactId>migbase64</artifactId> + <version>2.2</version> + </dependency> {{/java8}} {{#supportJava6}} - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>${commons_lang3_version}</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons_io_version}</version> - </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3-version}</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons-io-version}</version> + </dependency> {{/supportJava6}} + <dependency> + <groupId>org.tomitribe</groupId> + <artifactId>tomitribe-http-signatures</artifactId> + <version>${http-signature-version}</version> + </dependency> {{#useBeanValidation}} - <!-- Bean Validation API support --> - <dependency> - <groupId>javax.validation</groupId> - <artifactId>validation-api</artifactId> - <version>1.1.0.Final</version> - <scope>provided</scope> - </dependency> + <!-- Bean Validation API support --> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>1.1.0.Final</version> + <scope>provided</scope> + </dependency> {{/useBeanValidation}} <!-- test dependencies --> <dependency> @@ -358,8 +368,8 @@ {{/supportJava6}} {{#supportJava6}} <jersey-version>2.6</jersey-version> - <commons_io_version>2.5</commons_io_version> - <commons_lang3_version>3.6</commons_lang3_version> + <commons-io-version>2.5</commons-io-version> + <commons-lang3-version>3.6</commons-lang3-version> {{/supportJava6}} <jackson-version>2.10.3</jackson-version> <jackson-databind-version>2.10.3</jackson-databind-version> @@ -368,5 +378,6 @@ <threetenbp-version>2.9.10</threetenbp-version> {{/threetenbp}} <junit-version>4.13</junit-version> + <http-signature-version>1.3</http-signature-version> </properties> </project> 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 87f547a24b2c..5ee649052b29 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 @@ -1113,7 +1113,7 @@ paths: schema: type: string security: - - http_signature_test + - http_signature_test: [] requestBody: $ref: '#/components/requestBodies/Pet' responses: diff --git a/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml b/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml index 30aad25824c8..755ea4c03013 100644 --- a/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml +++ b/samples/client/petstore/java/jersey2-experimental/api/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.0.0 info: description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: @@ -9,7 +9,28 @@ info: title: OpenAPI Petstore version: 1.0.0 servers: -- url: http://petstore.swagger.io:80/v2 +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 tags: - description: Everything about your Pets name: pet @@ -18,25 +39,23 @@ tags: - description: Operations about user name: user paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_default' + description: response + x-accepts: application/json /pet: post: operationId: addPet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: - "200": - content: {} - description: successful operation "405": - content: {} description: Invalid input security: - petstore_auth: @@ -45,33 +64,18 @@ paths: summary: Add a new pet to the store tags: - pet - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json put: operationId: updatePet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: - "200": - content: {} - description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Pet not found "405": - content: {} description: Validation exception security: - petstore_auth: @@ -80,9 +84,11 @@ paths: summary: Update an existing pet tags: - pet - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 /pet/findByStatus: get: description: Multiple status values can be provided with comma separated strings @@ -118,7 +124,6 @@ paths: type: array description: successful operation "400": - content: {} description: Invalid status value security: - petstore_auth: @@ -160,7 +165,6 @@ paths: type: array description: successful operation "400": - content: {} description: Invalid tag value security: - petstore_auth: @@ -174,23 +178,24 @@ paths: delete: operationId: deletePet parameters: - - in: header + - explode: false + in: header name: api_key + required: false schema: type: string + style: simple - description: Pet id to delete + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: - "200": - content: {} - description: successful operation "400": - content: {} description: Invalid pet value security: - petstore_auth: @@ -205,12 +210,14 @@ paths: operationId: getPetById parameters: - description: ID of pet to return + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: "200": content: @@ -222,10 +229,8 @@ paths: $ref: '#/components/schemas/Pet' description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Pet not found security: - api_key: [] @@ -237,13 +242,16 @@ paths: operationId: updatePetWithForm parameters: - description: ID of pet that needs to be updated + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object' content: application/x-www-form-urlencoded: schema: @@ -254,9 +262,9 @@ paths: status: description: Updated status of the pet type: string + type: object responses: "405": - content: {} description: Invalid input security: - petstore_auth: @@ -272,13 +280,16 @@ paths: operationId: uploadFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object_1' content: multipart/form-data: schema: @@ -290,6 +301,7 @@ paths: description: file to upload format: binary type: string + type: object responses: "200": content: @@ -331,7 +343,7 @@ paths: operationId: placeOrder requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/Order' description: order placed for purchasing the pet @@ -347,13 +359,11 @@ paths: $ref: '#/components/schemas/Order' description: successful operation "400": - content: {} description: Invalid Order summary: Place an order for a pet tags: - store - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /store/order/{order_id}: delete: @@ -362,17 +372,17 @@ paths: operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted + explode: false in: path name: order_id required: true schema: type: string + style: simple responses: "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Order not found summary: Delete purchase order by ID tags: @@ -384,6 +394,7 @@ paths: operationId: getOrderById parameters: - description: ID of pet that needs to be fetched + explode: false in: path name: order_id required: true @@ -392,6 +403,7 @@ paths: maximum: 5 minimum: 1 type: integer + style: simple responses: "200": content: @@ -403,10 +415,8 @@ paths: $ref: '#/components/schemas/Order' description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Order not found summary: Find purchase order by ID tags: @@ -418,81 +428,65 @@ paths: operationId: createUser requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Created user object required: true responses: default: - content: {} description: successful operation summary: Create user tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /user/createWithArray: post: operationId: createUsersWithArrayInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation summary: Creates list of users with given input array tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /user/createWithList: post: operationId: createUsersWithListInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation summary: Creates list of users with given input array tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /user/login: get: operationId: loginUser parameters: - description: The user name for login + explode: true in: query name: username required: true schema: type: string + style: form - description: The password for login in clear text + explode: true in: query name: password required: true schema: type: string + style: form responses: "200": content: @@ -506,16 +500,19 @@ paths: headers: X-Rate-Limit: description: calls per hour allowed by the user + explode: false schema: format: int32 type: integer + style: simple X-Expires-After: description: date in UTC when token expires + explode: false schema: format: date-time type: string + style: simple "400": - content: {} description: Invalid username/password supplied summary: Logs user into the system tags: @@ -526,7 +523,6 @@ paths: operationId: logoutUser responses: default: - content: {} description: successful operation summary: Logs out current logged in user session tags: @@ -538,17 +534,17 @@ paths: operationId: deleteUser parameters: - description: The name that needs to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple responses: "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found summary: Delete user tags: @@ -558,11 +554,13 @@ paths: operationId: getUserByName parameters: - description: The name that needs to be fetched. Use user1 for testing. + explode: false in: path name: username required: true schema: type: string + style: simple responses: "200": content: @@ -574,10 +572,8 @@ paths: $ref: '#/components/schemas/User' description: successful operation "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found summary: Get user by user name tags: @@ -588,42 +584,36 @@ paths: operationId: updateUser parameters: - description: name that need to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Updated user object required: true responses: "400": - content: {} description: Invalid user supplied "404": - content: {} description: User not found summary: Updated user tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /fake_classname_test: patch: description: To test class name in snake case operationId: testClassname requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -636,7 +626,6 @@ paths: summary: To test class name in snake case tags: - fake_classname_tags 123#$%^ - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json /fake: @@ -645,44 +634,60 @@ paths: operationId: testGroupParameters parameters: - description: Required String in group parameters + explode: true in: query name: required_string_group required: true schema: type: integer + style: form - description: Required Boolean in group parameters + explode: false in: header name: required_boolean_group required: true schema: type: boolean + style: simple - description: Required Integer in group parameters + explode: true in: query name: required_int64_group required: true schema: format: int64 type: integer + style: form - description: String in group parameters + explode: true in: query name: string_group + required: false schema: type: integer + style: form - description: Boolean in group parameters + explode: false in: header name: boolean_group + required: false schema: type: boolean + style: simple - description: Integer in group parameters + explode: true in: query name: int64_group + required: false schema: format: int64 type: integer + style: form responses: "400": - content: {} description: Someting wrong + security: + - bearer_test: [] summary: Fake endpoint to test group parameters (optional) tags: - fake @@ -696,6 +701,7 @@ paths: explode: false in: header name: enum_header_string_array + required: false schema: items: default: $ @@ -706,8 +712,10 @@ paths: type: array style: simple - description: Header parameter enum test (string) + explode: false in: header name: enum_header_string + required: false schema: default: -efg enum: @@ -715,10 +723,12 @@ paths: - -efg - (xyz) type: string + style: simple - description: Query parameter enum test (string array) - explode: false + explode: true in: query name: enum_query_string_array + required: false schema: items: default: $ @@ -729,8 +739,10 @@ paths: type: array style: form - description: Query parameter enum test (string) + explode: true in: query name: enum_query_string + required: false schema: default: -efg enum: @@ -738,25 +750,33 @@ paths: - -efg - (xyz) type: string + style: form - description: Query parameter enum test (double) + explode: true in: query name: enum_query_integer + required: false schema: enum: - 1 - -2 format: int32 type: integer + style: form - description: Query parameter enum test (double) + explode: true in: query name: enum_query_double + required: false schema: enum: - 1.1 - -1.2 format: double type: number + style: form requestBody: + $ref: '#/components/requestBodies/inline_object_2' content: application/x-www-form-urlencoded: schema: @@ -778,12 +798,11 @@ paths: - -efg - (xyz) type: string + type: object responses: "400": - content: {} description: Invalid request "404": - content: {} description: Not found summary: To test enum parameters tags: @@ -794,12 +813,7 @@ paths: description: To test "client" model operationId: testClientModel requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -810,24 +824,23 @@ paths: summary: To test "client" model tags: - fake - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json post: - description: |- + description: | Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 operationId: testEndpointParameters requestBody: + $ref: '#/components/requestBodies/inline_object_3' content: application/x-www-form-urlencoded: schema: properties: integer: description: None - format: int32 maximum: 100 minimum: 10 type: integer @@ -895,21 +908,19 @@ paths: - double - number - pattern_without_delimiter - required: true + type: object responses: "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found security: - http_basic_test: [] - summary: |- + summary: | Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 tags: - fake x-contentType: application/x-www-form-urlencoded @@ -920,11 +931,10 @@ paths: operationId: fakeOuterNumberSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterNumber' description: Input number as post body - required: false responses: "200": content: @@ -934,8 +944,7 @@ paths: description: Output number tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/outer/string: post: @@ -943,11 +952,10 @@ paths: operationId: fakeOuterStringSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterString' description: Input string as post body - required: false responses: "200": content: @@ -957,8 +965,7 @@ paths: description: Output string tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/outer/boolean: post: @@ -966,11 +973,10 @@ paths: operationId: fakeOuterBooleanSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterBoolean' description: Input boolean as post body - required: false responses: "200": content: @@ -980,8 +986,7 @@ paths: description: Output boolean tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/outer/composite: post: @@ -989,11 +994,10 @@ paths: operationId: fakeOuterCompositeSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterComposite' description: Input composite as post body - required: false responses: "200": content: @@ -1003,13 +1007,13 @@ paths: description: Output composite tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/jsonFormData: get: operationId: testJsonFormData requestBody: + $ref: '#/components/requestBodies/inline_object_4' content: application/x-www-form-urlencoded: schema: @@ -1023,10 +1027,9 @@ paths: required: - param - param2 - required: true + type: object responses: "200": - content: {} description: successful operation summary: test json serialization of form data tags: @@ -1047,23 +1050,23 @@ paths: required: true responses: "200": - content: {} description: successful operation summary: test inline additionalProperties tags: - fake - x-codegen-request-body-name: param x-contentType: application/json x-accepts: application/json /fake/body-with-query-params: put: operationId: testBodyWithQueryParams parameters: - - in: query + - explode: true + in: query name: query required: true schema: type: string + style: form requestBody: content: application/json: @@ -1072,60 +1075,17 @@ paths: required: true responses: "200": - content: {} description: Success tags: - fake - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json - /fake/create_xml_item: - post: - description: this route creates an XmlItem - operationId: createXmlItem - requestBody: - content: - application/xml: - schema: - $ref: '#/components/schemas/XmlItem' - application/xml; charset=utf-8: - schema: - $ref: '#/components/schemas/XmlItem' - application/xml; charset=utf-16: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml; charset=utf-8: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml; charset=utf-16: - schema: - $ref: '#/components/schemas/XmlItem' - description: XmlItem Body - required: true - responses: - "200": - content: {} - description: successful operation - summary: creates an XmlItem - tags: - - fake - x-codegen-request-body-name: XmlItem - x-contentType: application/xml - x-accepts: application/json /another-fake/dummy: patch: description: To test special tags and operation ID starting with number operationId: 123_test_@#$%_special_tags requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -1136,7 +1096,6 @@ paths: summary: To test special tags tags: - $another-fake? - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json /fake/body-with-file-schema: @@ -1152,11 +1111,9 @@ paths: required: true responses: "200": - content: {} description: Success tags: - fake - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json /fake/test-query-paramters: @@ -1164,7 +1121,7 @@ paths: description: To test the collection format in query parameters operationId: testQueryParameterCollectionFormat parameters: - - explode: false + - explode: true in: query name: pipe required: true @@ -1173,14 +1130,17 @@ paths: type: string type: array style: form - - in: query + - explode: false + in: query name: ioutil required: true schema: items: type: string type: array - - in: query + style: form + - explode: false + in: query name: http required: true schema: @@ -1208,7 +1168,6 @@ paths: style: form responses: "200": - content: {} description: Success tags: - fake @@ -1218,13 +1177,16 @@ paths: operationId: uploadFileWithRequiredFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object_5' content: multipart/form-data: schema: @@ -1238,7 +1200,7 @@ paths: type: string required: - requiredFile - required: true + type: object responses: "200": content: @@ -1255,8 +1217,121 @@ paths: - pet x-contentType: multipart/form-data x-accepts: application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: application/json + /fake/http-signature-test: + get: + operationId: fake-http-signature-test + parameters: + - description: query parameter + explode: true + in: query + name: query_1 + required: false + schema: + type: string + style: form + - description: header parameter + explode: false + in: header + name: header_1 + required: false + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + "200": + description: The instance started successfully + security: + - http_signature_test: [] + summary: test http signature authentication + tags: + - fake + x-contentType: application/json + x-accepts: application/json components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + inline_object_2: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_2' + inline_object_3: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_3' + inline_object_4: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_4' + inline_object_5: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_5' schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string Order: example: petId: 6 @@ -1421,21 +1496,12 @@ components: message: type: string type: object - $special[model.name]: - properties: - $special[property.name]: - format: int64 - type: integer - type: object - xml: - name: $special[model.name] Return: description: Model for testing reserved words properties: return: format: int32 type: integer - type: object xml: name: Return Name: @@ -1455,7 +1521,6 @@ components: type: integer required: - name - type: object xml: name: Name "200_response": @@ -1466,7 +1531,6 @@ components: type: integer class: type: string - type: object xml: name: Name ClassModel: @@ -1474,7 +1538,6 @@ components: properties: _class: type: string - type: object Dog: allOf: - $ref: '#/components/schemas/Animal' @@ -1483,10 +1546,6 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' - BigCat: - allOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -1506,13 +1565,13 @@ components: format_test: properties: integer: - maximum: 1E+2 - minimum: 1E+1 + maximum: 100 + minimum: 10 type: integer int32: format: int32 - maximum: 2E+2 - minimum: 2E+1 + maximum: 200 + minimum: 20 type: integer int64: format: int64 @@ -1536,7 +1595,6 @@ components: type: string byte: format: byte - pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ type: string binary: format: binary @@ -1556,8 +1614,14 @@ components: maxLength: 64 minLength: 10 type: string - BigDecimal: - format: number + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i type: string required: - byte @@ -1600,117 +1664,27 @@ components: type: number outerEnum: $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' required: - enum_string_required type: object AdditionalPropertiesClass: properties: - map_string: + map_property: additionalProperties: type: string type: object - map_number: - additionalProperties: - type: number - type: object - map_integer: - additionalProperties: - type: integer - type: object - map_boolean: - additionalProperties: - type: boolean - type: object - map_array_integer: - additionalProperties: - items: - type: integer - type: array - type: object - map_array_anytype: - additionalProperties: - items: - properties: {} - type: object - type: array - type: object - map_map_string: + map_of_map_property: additionalProperties: additionalProperties: type: string type: object type: object - map_map_anytype: - additionalProperties: - additionalProperties: - properties: {} - type: object - type: object - type: object - anytype_1: - properties: {} - type: object - anytype_2: - type: object - anytype_3: - properties: {} - type: object - type: object - AdditionalPropertiesString: - additionalProperties: - type: string - properties: - name: - type: string - type: object - AdditionalPropertiesInteger: - additionalProperties: - type: integer - properties: - name: - type: string - type: object - AdditionalPropertiesNumber: - additionalProperties: - type: number - properties: - name: - type: string - type: object - AdditionalPropertiesBoolean: - additionalProperties: - type: boolean - properties: - name: - type: string - type: object - AdditionalPropertiesArray: - additionalProperties: - items: - properties: {} - type: object - type: array - properties: - name: - type: string - type: object - AdditionalPropertiesObject: - additionalProperties: - additionalProperties: - properties: {} - type: object - type: object - properties: - name: - type: string - type: object - AdditionalPropertiesAnyType: - additionalProperties: - properties: {} - type: object - properties: - name: - type: string type: object MixedPropertiesAndAdditionalPropertiesClass: properties: @@ -1856,7 +1830,28 @@ components: - placed - approved - delivered + nullable: true type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + type: integer + OuterEnumDefaultValue: + default: placed + enum: + - placed + - approved + - delivered + type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer OuterComposite: example: my_string: my_string @@ -1906,243 +1901,223 @@ components: description: Test capitalization type: string type: object - TypeHolderDefault: + _special_model.name_: properties: - string_item: - default: what - type: string - number_item: - type: number - integer_item: + $special[property.name]: + format: int64 type: integer - bool_item: - default: true - type: boolean - array_item: - items: - type: integer - type: array - required: - - array_item - - bool_item - - integer_item - - number_item - - string_item - type: object - TypeHolderExample: + xml: + name: $special[model.name] + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage properties: - string_item: - example: what + NullableMessage: + nullable: true type: string - number_item: - example: 1.234 - type: number - float_item: - example: 1.234 - format: float - type: number - integer_item: - example: -2 - type: integer - bool_item: - example: true - type: boolean - array_item: - example: - - 0 - - 1 - - 2 - - 3 - items: - type: integer - type: array - required: - - array_item - - bool_item - - float_item - - integer_item - - number_item - - string_item type: object - XmlItem: + NullableClass: + additionalProperties: + nullable: true + type: object properties: - attribute_string: - example: string - type: string - xml: - attribute: true - attribute_number: - example: 1.234 - type: number - xml: - attribute: true - attribute_integer: - example: -2 + integer_prop: + nullable: true type: integer - xml: - attribute: true - attribute_boolean: - example: true - type: boolean - xml: - attribute: true - wrapped_array: - items: - type: integer - type: array - xml: - wrapped: true - name_string: - example: string - type: string - xml: - name: xml_name_string - name_number: - example: 1.234 + number_prop: + nullable: true type: number - xml: - name: xml_name_number - name_integer: - example: -2 - type: integer - xml: - name: xml_name_integer - name_boolean: - example: true + boolean_prop: + nullable: true type: boolean - xml: - name: xml_name_boolean - name_array: - items: - type: integer - xml: - name: xml_name_array_item - type: array - name_wrapped_array: - items: - type: integer - xml: - name: xml_name_wrapped_array_item - type: array - xml: - name: xml_name_wrapped_array - wrapped: true - prefix_string: - example: string + string_prop: + nullable: true type: string - xml: - prefix: ab - prefix_number: - example: 1.234 - type: number - xml: - prefix: cd - prefix_integer: - example: -2 - type: integer - xml: - prefix: ef - prefix_boolean: - example: true - type: boolean - xml: - prefix: gh - prefix_array: + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: items: - type: integer - xml: - prefix: ij + type: object + nullable: true type: array - prefix_wrapped_array: + array_and_items_nullable_prop: items: - type: integer - xml: - prefix: mn + nullable: true + type: object + nullable: true type: array - xml: - prefix: kl - wrapped: true - namespace_string: - example: string - type: string - xml: - namespace: http://a.com/schema - namespace_number: - example: 1.234 - type: number - xml: - namespace: http://b.com/schema - namespace_integer: - example: -2 - type: integer - xml: - namespace: http://c.com/schema - namespace_boolean: - example: true - type: boolean - xml: - namespace: http://d.com/schema - namespace_array: + array_items_nullable: items: - type: integer - xml: - namespace: http://e.com/schema + nullable: true + type: object type: array - namespace_wrapped_array: + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + inline_response_default: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + inline_object_2: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) items: - type: integer - xml: - namespace: http://g.com/schema + default: $ + enum: + - '>' + - $ + type: string type: array - xml: - namespace: http://f.com/schema - wrapped: true - prefix_ns_string: - example: string + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) type: string - xml: - namespace: http://a.com/schema - prefix: a - prefix_ns_number: - example: 1.234 - type: number - xml: - namespace: http://b.com/schema - prefix: b - prefix_ns_integer: - example: -2 + type: object + inline_object_3: + properties: + integer: + description: None + maximum: 100 + minimum: 10 type: integer - xml: - namespace: http://c.com/schema - prefix: c - prefix_ns_boolean: - example: true - type: boolean - xml: - namespace: http://d.com/schema - prefix: d - prefix_ns_array: - items: - type: integer - xml: - namespace: http://e.com/schema - prefix: e - type: array - prefix_ns_wrapped_array: - items: - type: integer - xml: - namespace: http://g.com/schema - prefix: g - type: array - xml: - namespace: http://f.com/schema - prefix: f - wrapped: true + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + inline_object_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + inline_object_5: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile type: object - xml: - namespace: http://a.com/schema - prefix: pre Dog_allOf: properties: breed: @@ -2151,15 +2126,6 @@ components: properties: declawed: type: boolean - BigCat_allOf: - properties: - kind: - enum: - - lions - - tigers - - leopards - - jaguars - type: string securitySchemes: petstore_auth: flows: @@ -2180,4 +2146,11 @@ components: http_basic_test: scheme: basic type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md index 36e181620016..0d9dbd055b6d 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/AdditionalPropertiesClass.md @@ -6,17 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**mapString** | **Map<String, String>** | | [optional] -**mapNumber** | [**Map<String, BigDecimal>**](BigDecimal.md) | | [optional] -**mapInteger** | **Map<String, Integer>** | | [optional] -**mapBoolean** | **Map<String, Boolean>** | | [optional] -**mapArrayInteger** | [**Map<String, List<Integer>>**](List.md) | | [optional] -**mapArrayAnytype** | [**Map<String, List<Object>>**](List.md) | | [optional] -**mapMapString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] -**mapMapAnytype** | [**Map<String, Map<String, Object>>**](Map.md) | | [optional] -**anytype1** | [**Object**](.md) | | [optional] -**anytype2** | [**Object**](.md) | | [optional] -**anytype3** | [**Object**](.md) | | [optional] +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md index 059616ec6baa..6740d5770dae 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/AnotherFakeApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## call123testSpecialTags -> Client call123testSpecialTags(body) +> Client call123testSpecialTags(client) To test special tags @@ -32,9 +32,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.call123testSpecialTags(body); + Client result = apiInstance.call123testSpecialTags(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); @@ -52,7 +52,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/java/jersey2-experimental/docs/DefaultApi.md b/samples/client/petstore/java/jersey2-experimental/docs/DefaultApi.md new file mode 100644 index 000000000000..afb01fb82916 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/DefaultApi.md @@ -0,0 +1,68 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | + + + +## fooGet + +> InlineResponseDefault fooGet() + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + InlineResponseDefault result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md b/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md index 61eb95f22fe9..1692bd664d04 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/EnumTest.md @@ -11,6 +11,9 @@ Name | Type | Description | Notes **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md b/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md index 543c51f066c5..ec633273558a 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/FakeApi.md @@ -4,7 +4,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -12,7 +13,7 @@ Method | HTTP request | Description [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model -[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties @@ -21,13 +22,70 @@ Method | HTTP request | Description -## createXmlItem +## fakeHealthGet -> createXmlItem(xmlItem) +> HealthCheckResult fakeHealthGet() -creates an XmlItem +Health check endpoint -this route creates an XmlItem +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + HealthCheckResult result = apiInstance.fakeHealthGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeHealthGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | The instance started successfully | - | + + +## fakeHttpSignatureTest + +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication ### Example @@ -36,6 +94,7 @@ this route creates an XmlItem import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.FakeApi; @@ -43,13 +102,16 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + FakeApi apiInstance = new FakeApi(defaultClient); - XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + String query1 = "query1_example"; // String | query parameter + String header1 = "header1_example"; // String | header parameter try { - apiInstance.createXmlItem(xmlItem); + apiInstance.fakeHttpSignatureTest(pet, query1, header1); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Exception when calling FakeApi#fakeHttpSignatureTest"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -64,7 +126,9 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] + **header1** | **String**| header parameter | [optional] ### Return type @@ -72,17 +136,17 @@ null (empty response body) ### Authorization -No authorization required +[http_signature_test](../README.md#http_signature_test) ### HTTP request headers -- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 +- **Content-Type**: application/json, application/xml - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | +| **200** | The instance started successfully | - | ## fakeOuterBooleanSerialize @@ -141,7 +205,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -152,7 +216,7 @@ No authorization required ## fakeOuterCompositeSerialize -> OuterComposite fakeOuterCompositeSerialize(body) +> OuterComposite fakeOuterCompositeSerialize(outerComposite) @@ -174,9 +238,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); @@ -194,7 +258,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] ### Return type @@ -206,7 +270,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -271,7 +335,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -336,7 +400,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -347,7 +411,7 @@ No authorization required ## testBodyWithFileSchema -> testBodyWithFileSchema(body) +> testBodyWithFileSchema(fileSchemaTestClass) @@ -369,9 +433,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | try { - apiInstance.testBodyWithFileSchema(body); + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); System.err.println("Status code: " + e.getCode()); @@ -388,7 +452,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -411,7 +475,7 @@ No authorization required ## testBodyWithQueryParams -> testBodyWithQueryParams(query, body) +> testBodyWithQueryParams(query, user) @@ -432,9 +496,9 @@ public class Example { FakeApi apiInstance = new FakeApi(defaultClient); String query = "query_example"; // String | - User body = new User(); // User | + User user = new User(); // User | try { - apiInstance.testBodyWithQueryParams(query, body); + apiInstance.testBodyWithQueryParams(query, user); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); System.err.println("Status code: " + e.getCode()); @@ -452,7 +516,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **query** | **String**| | - **body** | [**User**](User.md)| | + **user** | [**User**](User.md)| | ### Return type @@ -475,7 +539,7 @@ No authorization required ## testClientModel -> Client testClientModel(body) +> Client testClientModel(client) To test \"client\" model @@ -497,9 +561,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.testClientModel(body); + Client result = apiInstance.testClientModel(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testClientModel"); @@ -517,7 +581,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type @@ -542,12 +606,13 @@ No authorization required > testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 +假端點 +偽のエンドポイント +가짜 엔드 포인트 + ### Example @@ -732,6 +797,7 @@ Fake endpoint to test group parameters (optional) import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.FakeApi; @@ -739,6 +805,10 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); FakeApi apiInstance = new FakeApi(defaultClient); Integer requiredStringGroup = 56; // Integer | Required String in group parameters @@ -785,7 +855,7 @@ null (empty response body) ### Authorization -No authorization required +[bearer_test](../README.md#bearer_test) ### HTTP request headers @@ -800,7 +870,7 @@ No authorization required ## testInlineAdditionalProperties -> testInlineAdditionalProperties(param) +> testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -820,9 +890,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - Map<String, String> param = new HashMap(); // Map<String, String> | request body + Map<String, String> requestBody = new HashMap(); // Map<String, String> | request body try { - apiInstance.testInlineAdditionalProperties(param); + apiInstance.testInlineAdditionalProperties(requestBody); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); System.err.println("Status code: " + e.getCode()); @@ -839,7 +909,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | [**Map<String, String>**](String.md)| request body | + **requestBody** | [**Map<String, String>**](String.md)| request body | ### Return type diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md index 14a74a37a4e2..db98afa721ec 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/FakeClassnameTags123Api.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## testClassname -> Client testClassname(body) +> Client testClassname(client) To test class name in snake case @@ -39,9 +39,9 @@ public class Example { //api_key_query.setApiKeyPrefix("Token"); FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.testClassname(body); + Client result = apiInstance.testClassname(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); @@ -59,7 +59,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/java/jersey2-experimental/docs/Foo.md b/samples/client/petstore/java/jersey2-experimental/docs/Foo.md new file mode 100644 index 000000000000..02c7ef53f5fa --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/Foo.md @@ -0,0 +1,12 @@ + + +# Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md b/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md index d138e921902a..742bccb77e98 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/FormatTest.md @@ -19,7 +19,8 @@ Name | Type | Description | Notes **dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] **uuid** | [**UUID**](UUID.md) | | [optional] **password** | **String** | | -**bigDecimal** | [**BigDecimal**](BigDecimal.md) | | [optional] +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/java/jersey2-experimental/docs/HealthCheckResult.md b/samples/client/petstore/java/jersey2-experimental/docs/HealthCheckResult.md new file mode 100644 index 000000000000..11bb9026e461 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/HealthCheckResult.md @@ -0,0 +1,13 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineObject.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject.md new file mode 100644 index 000000000000..999fe3ef00ad --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject.md @@ -0,0 +1,13 @@ + + +# InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Updated name of the pet | [optional] +**status** | **String** | Updated status of the pet | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineObject1.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject1.md new file mode 100644 index 000000000000..b3828dfae456 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject1.md @@ -0,0 +1,13 @@ + + +# InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**file** | [**File**](File.md) | file to upload | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineObject2.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject2.md new file mode 100644 index 000000000000..7e4ed7591c2a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject2.md @@ -0,0 +1,32 @@ + + +# InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumFormStringArray** | [**List<EnumFormStringArrayEnum>**](#List<EnumFormStringArrayEnum>) | Form parameter enum test (string array) | [optional] +**enumFormString** | [**EnumFormStringEnum**](#EnumFormStringEnum) | Form parameter enum test (string) | [optional] + + + +## Enum: List<EnumFormStringArrayEnum> + +Name | Value +---- | ----- +GREATER_THAN | ">" +DOLLAR | "$" + + + +## Enum: EnumFormStringEnum + +Name | Value +---- | ----- +_ABC | "_abc" +_EFG | "-efg" +_XYZ_ | "(xyz)" + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineObject3.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject3.md new file mode 100644 index 000000000000..c1ebfe2578d6 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject3.md @@ -0,0 +1,25 @@ + + +# InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | None | [optional] +**int32** | **Integer** | None | [optional] +**int64** | **Long** | None | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | None | +**_float** | **Float** | None | [optional] +**_double** | **Double** | None | +**string** | **String** | None | [optional] +**patternWithoutDelimiter** | **String** | None | +**_byte** | **byte[]** | None | +**binary** | [**File**](File.md) | None | [optional] +**date** | [**LocalDate**](LocalDate.md) | None | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | None | [optional] +**password** | **String** | None | [optional] +**callback** | **String** | None | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineObject4.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject4.md new file mode 100644 index 000000000000..5ebef872403a --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject4.md @@ -0,0 +1,13 @@ + + +# InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | +**param2** | **String** | field2 | + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineObject5.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject5.md new file mode 100644 index 000000000000..42d2673574b7 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineObject5.md @@ -0,0 +1,13 @@ + + +# InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**requiredFile** | [**File**](File.md) | file to upload | + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/InlineResponseDefault.md b/samples/client/petstore/java/jersey2-experimental/docs/InlineResponseDefault.md new file mode 100644 index 000000000000..63c30c2b7334 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/InlineResponseDefault.md @@ -0,0 +1,12 @@ + + +# InlineResponseDefault + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/NullableClass.md b/samples/client/petstore/java/jersey2-experimental/docs/NullableClass.md new file mode 100644 index 000000000000..7567ec0c0579 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/NullableClass.md @@ -0,0 +1,23 @@ + + +# NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **Integer** | | [optional] +**numberProp** | [**BigDecimal**](BigDecimal.md) | | [optional] +**booleanProp** | **Boolean** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**LocalDate**](LocalDate.md) | | [optional] +**datetimeProp** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**arrayNullableProp** | **List<Object>** | | [optional] +**arrayAndItemsNullableProp** | **List<Object>** | | [optional] +**arrayItemsNullable** | **List<Object>** | | [optional] +**objectNullableProp** | **Map<String, Object>** | | [optional] +**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] +**objectItemsNullable** | **Map<String, Object>** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumDefaultValue.md b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumInteger.md b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md b/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md index 875a8e6783e9..0c3b8e70e3b5 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/PetApi.md @@ -18,7 +18,7 @@ Method | HTTP request | Description ## addPet -> addPet(body) +> addPet(pet) Add a new pet to the store @@ -43,9 +43,9 @@ public class Example { petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - apiInstance.addPet(body); + apiInstance.addPet(pet); } catch (ApiException e) { System.err.println("Exception when calling PetApi#addPet"); System.err.println("Status code: " + e.getCode()); @@ -62,7 +62,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -80,7 +80,6 @@ null (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | | **405** | Invalid input | - | @@ -150,7 +149,6 @@ null (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | | **400** | Invalid pet value | - | @@ -372,7 +370,7 @@ Name | Type | Description | Notes ## updatePet -> updatePet(body) +> updatePet(pet) Update an existing pet @@ -397,9 +395,9 @@ public class Example { petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - apiInstance.updatePet(body); + apiInstance.updatePet(pet); } catch (ApiException e) { System.err.println("Exception when calling PetApi#updatePet"); System.err.println("Status code: " + e.getCode()); @@ -416,7 +414,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -434,7 +432,6 @@ null (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 | - | diff --git a/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md b/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md index 6625d5969ee4..5d2d7ad5118b 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/StoreApi.md @@ -213,7 +213,7 @@ No authorization required ## placeOrder -> Order placeOrder(body) +> Order placeOrder(order) Place an order for a pet @@ -233,9 +233,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); StoreApi apiInstance = new StoreApi(defaultClient); - Order body = new Order(); // Order | order placed for purchasing the pet + Order order = new Order(); // Order | order placed for purchasing the pet try { - Order result = apiInstance.placeOrder(body); + Order result = apiInstance.placeOrder(order); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling StoreApi#placeOrder"); @@ -253,7 +253,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -265,7 +265,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/xml, application/json ### HTTP response details diff --git a/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md b/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md index ca9f550c3167..d7e613c24af5 100644 --- a/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-experimental/docs/UserApi.md @@ -17,7 +17,7 @@ Method | HTTP request | Description ## createUser -> createUser(body) +> createUser(user) Create user @@ -39,9 +39,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - User body = new User(); // User | Created user object + User user = new User(); // User | Created user object try { - apiInstance.createUser(body); + apiInstance.createUser(user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUser"); System.err.println("Status code: " + e.getCode()); @@ -58,7 +58,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -70,7 +70,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details @@ -81,7 +81,7 @@ No authorization required ## createUsersWithArrayInput -> createUsersWithArrayInput(body) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -101,9 +101,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - List<User> body = Arrays.asList(); // List<User> | List of user object + List<User> user = Arrays.asList(); // List<User> | List of user object try { - apiInstance.createUsersWithArrayInput(body); + apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); System.err.println("Status code: " + e.getCode()); @@ -120,7 +120,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -132,7 +132,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details @@ -143,7 +143,7 @@ No authorization required ## createUsersWithListInput -> createUsersWithListInput(body) +> createUsersWithListInput(user) Creates list of users with given input array @@ -163,9 +163,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - List<User> body = Arrays.asList(); // List<User> | List of user object + List<User> user = Arrays.asList(); // List<User> | List of user object try { - apiInstance.createUsersWithListInput(body); + apiInstance.createUsersWithListInput(user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUsersWithListInput"); System.err.println("Status code: " + e.getCode()); @@ -182,7 +182,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -194,7 +194,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details @@ -459,7 +459,7 @@ No authorization required ## updateUser -> updateUser(username, body) +> updateUser(username, user) Updated user @@ -482,9 +482,9 @@ public class Example { UserApi apiInstance = new UserApi(defaultClient); String username = "username_example"; // String | name that need to be deleted - User body = new User(); // User | Updated user object + User user = new User(); // User | Updated user object try { - apiInstance.updateUser(username, body); + apiInstance.updateUser(username, user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#updateUser"); System.err.println("Status code: " + e.getCode()); @@ -502,7 +502,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -514,7 +514,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details diff --git a/samples/client/petstore/java/jersey2-experimental/pom.xml b/samples/client/petstore/java/jersey2-experimental/pom.xml index 3affc56f001f..84d5d5ce1801 100644 --- a/samples/client/petstore/java/jersey2-experimental/pom.xml +++ b/samples/client/petstore/java/jersey2-experimental/pom.xml @@ -56,7 +56,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.12</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -66,7 +66,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> - <forkMode>pertest</forkMode> + <threadCount>10</threadCount> </configuration> </plugin> <plugin> @@ -135,10 +135,17 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.6.1</version> + <version>3.8.1</version> <configuration> <source>1.7</source> <target>1.7</target> + <fork>true</fork> + <meminitial>128m</meminitial> + <maxmem>512m</maxmem> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. --> + </compilerArgs> </configuration> </plugin> <plugin> @@ -261,17 +268,22 @@ <artifactId>jackson-databind-nullable</artifactId> <version>${jackson-databind-nullable-version}</version> </dependency> - <dependency> - <groupId>com.github.joschi.jackson</groupId> - <artifactId>jackson-datatype-threetenbp</artifactId> - <version>${threetenbp-version}</version> - </dependency> - <!-- Base64 encoding that works in both JVM and Android --> - <dependency> - <groupId>com.brsanthu</groupId> - <artifactId>migbase64</artifactId> - <version>2.2</version> - </dependency> + <dependency> + <groupId>com.github.joschi.jackson</groupId> + <artifactId>jackson-datatype-threetenbp</artifactId> + <version>${threetenbp-version}</version> + </dependency> + <!-- Base64 encoding that works in both JVM and Android --> + <dependency> + <groupId>com.brsanthu</groupId> + <artifactId>migbase64</artifactId> + <version>2.2</version> + </dependency> + <dependency> + <groupId>org.tomitribe</groupId> + <artifactId>tomitribe-http-signatures</artifactId> + <version>${http-signature-version}</version> + </dependency> <!-- test dependencies --> <dependency> <groupId>junit</groupId> @@ -289,5 +301,6 @@ <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> <threetenbp-version>2.9.10</threetenbp-version> <junit-version>4.13</junit-version> + <http-signature-version>1.3</http-signature-version> </properties> </project> diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java index 30609a4a8e40..fdbba2916ec9 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java @@ -1,5 +1,26 @@ package org.openapitools.client; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; @@ -10,69 +31,97 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; - import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.HttpUrlConnectorProvider; import org.glassfish.jersey.jackson.JacksonFeature; +import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.media.multipart.FormDataBodyPart; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.MultiPart; import org.glassfish.jersey.media.multipart.MultiPartFeature; - -import java.io.IOException; -import java.io.InputStream; - -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import org.glassfish.jersey.logging.LoggingFeature; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Date; -import java.util.TimeZone; - -import java.net.URLEncoder; - -import java.io.File; -import java.io.UnsupportedEncodingException; - -import java.text.DateFormat; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - +import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; -import org.openapitools.client.auth.ApiKeyAuth; -import org.openapitools.client.model.AbstractOpenApiSchema; - +import org.openapitools.client.auth.HttpSignatureAuth; import org.openapitools.client.auth.OAuth; - +import org.openapitools.client.model.AbstractOpenApiSchema; public class ApiClient { protected Map<String, String> defaultHeaderMap = new HashMap<String, String>(); protected Map<String, String> defaultCookieMap = new HashMap<String, String>(); protected String basePath = "http://petstore.swagger.io:80/v2"; - protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList( - new ServerConfiguration( - "http://petstore.swagger.io:80/v2", - "No description provided", - new HashMap<String, ServerVariable>() - ) - )); + protected List<ServerConfiguration> servers = + new ArrayList<ServerConfiguration>( + Arrays.asList( + new ServerConfiguration( + "http://{server}.swagger.io:{port}/v2", + "petstore server", + new HashMap<String, ServerVariable>() { + { + put( + "server", + new ServerVariable( + "No description provided", + "petstore", + new HashSet<String>( + Arrays.asList("petstore", "qa-petstore", "dev-petstore")))); + put( + "port", + new ServerVariable( + "No description provided", + "80", + new HashSet<String>(Arrays.asList("80", "8080")))); + } + }), + new ServerConfiguration( + "https://localhost:8080/{version}", + "The local server", + new HashMap<String, ServerVariable>() { + { + put( + "version", + new ServerVariable( + "No description provided", + "v2", + new HashSet<String>(Arrays.asList("v1", "v2")))); + } + }))); protected Integer serverIndex = 0; protected Map<String, String> serverVariables = null; - protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{ - }}; + protected Map<String, List<ServerConfiguration>> operationServers = + new HashMap<String, List<ServerConfiguration>>() { + { + put( + "PetApi.addPet", + new ArrayList<ServerConfiguration>( + Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap<String, ServerVariable>()), + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap<String, ServerVariable>())))); + put( + "PetApi.updatePet", + new ArrayList<ServerConfiguration>( + Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap<String, ServerVariable>()), + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap<String, ServerVariable>())))); + } + }; protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>(); - protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>(); + protected Map<String, Map<String, String>> operationServerVariables = + new HashMap<String, Map<String, String>>(); protected boolean debugging = false; protected int connectionTimeout = 0; private int readTimeout = 0; @@ -99,7 +148,10 @@ public ApiClient() { authentications = new HashMap<String, Authentication>(); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put( + "http_signature_test", new HttpSignatureAuth("http_signature_test", null, null)); authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -110,6 +162,7 @@ public ApiClient() { /** * Gets the JSON instance to do JSON serialization and deserialization. + * * @return JSON */ public JSON getJSON() { @@ -163,6 +216,7 @@ public ApiClient setServerVariables(Map<String, String> serverVariables) { /** * Get authentications (key: authentication name, value: authentication). + * * @return Map of authentication object */ public Map<String, Authentication> getAuthentications() { @@ -181,6 +235,7 @@ public Authentication getAuthentication(String authName) { /** * Helper method to set username for the first HTTP basic authentication. + * * @param username Username */ public void setUsername(String username) { @@ -195,6 +250,7 @@ public void setUsername(String username) { /** * Helper method to set password for the first HTTP basic authentication. + * * @param password Password */ public void setPassword(String password) { @@ -209,6 +265,7 @@ public void setPassword(String password) { /** * Helper method to set API key value for the first API key authentication. + * * @param apiKey API key */ public void setApiKey(String apiKey) { @@ -242,6 +299,7 @@ public void configureApiKeys(HashMap<String, String> secrets) { /** * Helper method to set API key prefix for the first API key authentication. + * * @param apiKeyPrefix API key prefix */ public void setApiKeyPrefix(String apiKeyPrefix) { @@ -256,6 +314,7 @@ public void setApiKeyPrefix(String apiKeyPrefix) { /** * Helper method to set bearer token for the first Bearer authentication. + * * @param bearerToken Bearer token */ public void setBearerToken(String bearerToken) { @@ -270,6 +329,7 @@ public void setBearerToken(String bearerToken) { /** * Helper method to set access token for the first OAuth2 authentication. + * * @param accessToken Access token */ public void setAccessToken(String accessToken) { @@ -284,6 +344,7 @@ public void setAccessToken(String accessToken) { /** * Set the User-Agent header's value (by adding to the default header map). + * * @param userAgent Http user agent * @return API client */ @@ -318,6 +379,7 @@ public ApiClient addDefaultCookie(String key, String value) { /** * Check that whether debugging is enabled for this API client. + * * @return True if debugging is switched on */ public boolean isDebugging() { @@ -338,9 +400,8 @@ public ApiClient setDebugging(boolean debugging) { } /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is <code>null</code>, i.e. using - * the system's default tempopary folder. + * The path of temporary folder used to store downloaded files from endpoints with file response. + * The default value is <code>null</code>, i.e. using the system's default tempopary folder. * * @return Temp folder path */ @@ -350,6 +411,7 @@ public String getTempFolderPath() { /** * Set temp folder path + * * @param tempFolderPath Temp folder path * @return API client */ @@ -360,6 +422,7 @@ public ApiClient setTempFolderPath(String tempFolderPath) { /** * Connect timeout (in milliseconds). + * * @return Connection timeout */ public int getConnectTimeout() { @@ -367,9 +430,9 @@ public int getConnectTimeout() { } /** - * Set the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * Set the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values must + * be between 1 and {@link Integer#MAX_VALUE}. + * * @param connectionTimeout Connection timeout in milliseconds * @return API client */ @@ -381,6 +444,7 @@ public ApiClient setConnectTimeout(int connectionTimeout) { /** * read timeout (in milliseconds). + * * @return Read timeout */ public int getReadTimeout() { @@ -388,9 +452,9 @@ public int getReadTimeout() { } /** - * Set the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * Set the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be + * between 1 and {@link Integer#MAX_VALUE}. + * * @param readTimeout Read timeout in milliseconds * @return API client */ @@ -402,6 +466,7 @@ public ApiClient setReadTimeout(int readTimeout) { /** * Get the date format used to parse/format date parameters. + * * @return Date format */ public DateFormat getDateFormat() { @@ -410,6 +475,7 @@ public DateFormat getDateFormat() { /** * Set the date format used to parse/format date parameters. + * * @param dateFormat Date format * @return API client */ @@ -422,6 +488,7 @@ public ApiClient setDateFormat(DateFormat dateFormat) { /** * Parse the given string into Date object. + * * @param str String * @return Date */ @@ -435,6 +502,7 @@ public Date parseDate(String str) { /** * Format the given Date object into string. + * * @param date Date * @return Date in string format */ @@ -444,6 +512,7 @@ public String formatDate(Date date) { /** * Format the given parameter object into string. + * * @param param Object * @return Object in string format */ @@ -454,8 +523,8 @@ public String parameterToString(Object param) { return formatDate((Date) param); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for(Object o : (Collection)param) { - if(b.length() > 0) { + for (Object o : (Collection) param) { + if (b.length() > 0) { b.append(','); } b.append(String.valueOf(o)); @@ -473,7 +542,7 @@ public String parameterToString(Object param) { * @param value Value * @return List of pairs */ - public List<Pair> parameterToPairs(String collectionFormat, String name, Object value){ + public List<Pair> parameterToPairs(String collectionFormat, String name, Object value) { List<Pair> params = new ArrayList<Pair>(); // preconditions @@ -487,12 +556,13 @@ public List<Pair> parameterToPairs(String collectionFormat, String name, Object return params; } - if (valueCollection.isEmpty()){ + if (valueCollection.isEmpty()) { return params; } // get the collection format (default: csv) - String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + String format = + (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // create the params based on the collection format if ("multi".equals(format)) { @@ -515,7 +585,7 @@ public List<Pair> parameterToPairs(String collectionFormat, String name, Object delimiter = "|"; } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : valueCollection) { sb.append(delimiter); sb.append(parameterToString(item)); @@ -527,13 +597,9 @@ public List<Pair> parameterToPairs(String collectionFormat, String name, Object } /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON + * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; + * charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON + * * @param mime MIME * @return True if the MIME type is JSON */ @@ -543,13 +609,12 @@ public boolean isJsonMime(String mime) { } /** - * 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) + * 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) * * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). + * @return The Accept header to use. If the given array is empty, null will be returned (not to + * set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { if (accepts.length == 0) { @@ -564,13 +629,11 @@ public String selectHeaderAccept(String[] accepts) { } /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. + * Select the Content-Type header's value from the given array: if JSON exists in the given array, + * use it; otherwise use the first one of the array. * * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. + * @return The Content-Type header to use. If the given array is empty, JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0) { @@ -586,6 +649,7 @@ public String selectHeaderContentType(String[] contentTypes) { /** * Escape the given string to be used as URL query value. + * * @param str String * @return Escaped string */ @@ -598,33 +662,41 @@ public String escapeString(String str) { } /** - * Serialize the given Java object into string entity according the given - * Content-Type (only JSON is supported for now). + * Serialize the given Java object into string entity according the given Content-Type (only JSON + * is supported for now). + * * @param obj Object * @param formParams Form parameters * @param contentType Context type * @return Entity * @throws ApiException API exception */ - public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) throws ApiException { + public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) + throws ApiException { Entity<?> entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); - for (Entry<String, Object> param: formParams.entrySet()) { + for (Entry<String, Object> param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) - .fileName(file.getName()).size(file.length()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + FormDataContentDisposition contentDisp = + FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()) + .size(file.length()) + .build(); + multiPart.bodyPart( + new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); } else { - FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); - multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + FormDataContentDisposition contentDisp = + FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart( + new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); } } entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); } else if (contentType.startsWith("application/x-www-form-urlencoded")) { Form form = new Form(); - for (Entry<String, Object> param: formParams.entrySet()) { + for (Entry<String, Object> param : formParams.entrySet()) { form.param(param.getKey(), parameterToString(param.getValue())); } entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); @@ -635,7 +707,47 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co return entity; } - public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ + /** + * Serialize the given Java object into string according the given Content-Type (only JSON, HTTP + * form is supported for now). + * + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return String + * @throws ApiException API exception + */ + public String serializeToString(Object obj, Map<String, Object> formParams, String contentType) + throws ApiException { + try { + if (contentType.startsWith("multipart/form-data")) { + throw new ApiException( + "multipart/form-data not yet supported for serializeToString (http signature authentication)"); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + String formString = ""; + for (Entry<String, Object> param : formParams.entrySet()) { + formString = + param.getKey() + + "=" + + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + + "&"; + } + + if (formString.length() == 0) { // empty string + return formString; + } else { + return formString.substring(0, formString.length() - 1); + } + } else { + return json.getMapper().writeValueAsString(obj); + } + } catch (Exception ex) { + throw new ApiException("Failed to perform serializeToString: " + ex.toString()); + } + } + + public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) + throws ApiException { Object result = null; int matchCounter = 0; @@ -657,35 +769,44 @@ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenA } else if ("oneOf".equals(schema.getSchemaType())) { matchSchemas.add(schemaName); } else { - throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); + throw new ApiException( + "Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); } } else { - // failed to deserialize the response in the schema provided, proceed to the next one if any + // failed to deserialize the response in the schema provided, proceed to the next one if + // any } } catch (Exception ex) { // failed to deserialize, do nothing and try next one (schema) } - } else {// unknown type - throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); + } else { // unknown type + throw new ApiException( + schemaType.getClass() + + " is not a GenericType and cannot be handled properly in deserialization."); } - } - if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf - throw new ApiException("Response body is invalid as it matches more than one schema (" + String.join(", ", matchSchemas) + ") defined in the oneOf model: " + schema.getClass().getName()); + if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) { // more than 1 match for oneOf + throw new ApiException( + "Response body is invalid as it matches more than one schema (" + + String.join(", ", matchSchemas) + + ") defined in the oneOf model: " + + schema.getClass().getName()); } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas - throw new ApiException("Response body is invalid as it doens't match any schemas (" + String.join(", ", schema.getSchemas().keySet()) + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + throw new ApiException( + "Response body is invalid as it doens't match any schemas (" + + String.join(", ", schema.getSchemas().keySet()) + + ") defined in the oneOf/anyOf model: " + + schema.getClass().getName()); } else { // only one matched schema.setActualInstance(result); return schema; } - } - - /** * Deserialize response body to Java object according to the Content-Type. + * * @param <T> Type * @param response Response * @param returnType Return type @@ -720,6 +841,7 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap /** * Download file from the given response. + * * @param response Response * @return File * @throws ApiException If fail to read file content from response and write to disk @@ -727,7 +849,10 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap public File downloadFileFromResponse(Response response) throws ApiException { try { File file = prepareDownloadFile(response); - Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); + Files.copy( + response.readEntity(InputStream.class), + file.toPath(), + StandardCopyOption.REPLACE_EXISTING); return file; } catch (IOException e) { throw new ApiException(e); @@ -741,8 +866,7 @@ public File prepareDownloadFile(Response response) throws IOException { // Get filename from the Content-Disposition header. Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) - filename = matcher.group(1); + if (matcher.find()) filename = matcher.group(1); } String prefix; @@ -759,14 +883,11 @@ public File prepareDownloadFile(Response response) throws IOException { suffix = filename.substring(pos); } // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + if (prefix.length() < 3) prefix = "download-"; } - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + if (tempFolderPath == null) return File.createTempFile(prefix, suffix); + else return File.createTempFile(prefix, suffix, new File(tempFolderPath)); } /** @@ -789,8 +910,21 @@ public File prepareDownloadFile(Response response) throws IOException { * @return The response body in type of string * @throws ApiException API exception */ - public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + public <T> ApiResponse<T> invokeAPI( + String operation, + String path, + String method, + List<Pair> queryParams, + Object body, + Map<String, String> headerParams, + Map<String, String> cookieParams, + Map<String, Object> formParams, + String accept, + String contentType, + String[] authNames, + GenericType<T> returnType, + AbstractOpenApiSchema schema) + throws ApiException { // Not using `.target(targetURL).path(path)` below, // to support (constant) query string in `path`, e.g. "/posts?draft=1" @@ -810,9 +944,10 @@ public <T> ApiResponse<T> invokeAPI(String operation, String path, String method serverConfigurations = servers; } if (index < 0 || index >= serverConfigurations.size()) { - throw new ArrayIndexOutOfBoundsException(String.format( - "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size() - )); + throw new ArrayIndexOutOfBoundsException( + String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", + index, serverConfigurations.size())); } targetURL = serverConfigurations.get(index).URL(variables) + path; } else { @@ -863,6 +998,21 @@ public <T> ApiResponse<T> invokeAPI(String operation, String path, String method Entity<?> entity = serialize(body, formParams, contentType); + // put all headers in one place + Map<String, String> allHeaderParams = new HashMap<>(); + allHeaderParams.putAll(defaultHeaderMap); + allHeaderParams.putAll(headerParams); + + // update different parameters (e.g. headers) for authentication + updateParamsForAuth( + authNames, + queryParams, + allHeaderParams, + cookieParams, + serializeToString(body, formParams, contentType), + method, + target.getUri()); + Response response = null; try { @@ -892,14 +1042,13 @@ public <T> ApiResponse<T> invokeAPI(String operation, String path, String method if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { return new ApiResponse<>(statusCode, responseHeaders); } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) - return new ApiResponse<>(statusCode, responseHeaders); - else - if (schema == null) { - return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); - } else { // oneOf/anyOf - return new ApiResponse<>(statusCode, responseHeaders, (T)deserializeSchemas(response, schema)); - } + if (returnType == null) return new ApiResponse<>(statusCode, responseHeaders); + else if (schema == null) { + return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + } else { // oneOf/anyOf + return new ApiResponse<>( + statusCode, responseHeaders, (T) deserializeSchemas(response, schema)); + } } else { String message = "error"; String respBody = null; @@ -912,30 +1061,53 @@ public <T> ApiResponse<T> invokeAPI(String operation, String path, String method } } throw new ApiException( - response.getStatus(), - message, - buildResponseHeaders(response), - respBody); + response.getStatus(), message, buildResponseHeaders(response), respBody); } } finally { try { response.close(); } catch (Exception e) { - // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue + // it's not critical, since the response object is local in method invokeAPI; that's fine, + // just continue } } } - /** - * @deprecated Add qualified name of the operation as a first parameter. - */ + /** @deprecated Add qualified name of the operation as a first parameter. */ @Deprecated - public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { - return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema); + public <T> ApiResponse<T> invokeAPI( + String path, + String method, + List<Pair> queryParams, + Object body, + Map<String, String> headerParams, + Map<String, String> cookieParams, + Map<String, Object> formParams, + String accept, + String contentType, + String[] authNames, + GenericType<T> returnType, + AbstractOpenApiSchema schema) + throws ApiException { + return invokeAPI( + null, + path, + method, + queryParams, + body, + headerParams, + cookieParams, + formParams, + accept, + contentType, + authNames, + returnType, + schema); } /** * Build the Client used to make HTTP requests. + * * @param debugging Debug setting * @return Client */ @@ -948,13 +1120,21 @@ protected Client buildHttpClient(boolean debugging) { // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); if (debugging) { - 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); + 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); + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME) + .setLevel(java.util.logging.Level.ALL); } else { // suppress warnings for payloads with DELETE calls: - java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); + java.util.logging.Logger.getLogger("org.glassfish.jersey.client") + .setLevel(java.util.logging.Level.SEVERE); } performAdditionalClientConfiguration(clientConfig); return ClientBuilder.newClient(clientConfig); @@ -966,7 +1146,7 @@ protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { protected Map<String, List<String>> buildResponseHeaders(Response response) { Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>(); - for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) { + for (Entry<String, List<Object>> entry : response.getHeaders().entrySet()) { List<Object> values = entry.getValue(); List<String> headers = new ArrayList<String>(); for (Object o : values) { @@ -984,12 +1164,24 @@ protected Map<String, List<String>> buildResponseHeaders(Response response) { * @param queryParams List of query parameters * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters + * @param method HTTP method (e.g. POST) + * @param uri HTTP URI */ - protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + protected void updateParamsForAuth( + String[] authNames, + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException { for (String authName : authNames) { Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams, cookieParams); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java index 6c91e35f27a9..5bdd88d576ed 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java @@ -3,89 +3,95 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client; -import java.util.Map; import java.util.List; - +import java.util.Map; public class ApiException extends Exception { - private int code = 0; - private Map<String, List<String>> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map<String, List<String>> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } + private int code = 0; + private Map<String, List<String>> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException( + String message, + Throwable throwable, + int code, + Map<String, List<String>> responseHeaders, + String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException( + String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException( + String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException( + int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map<String, List<String>> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java index 4a3226d1dbb5..fd4a259e3643 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java @@ -3,14 +3,13 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client; import java.util.List; @@ -22,38 +21,38 @@ * @param <T> The type of data that is deserialized from response body */ public class ApiResponse<T> { - private final int statusCode; - private final Map<String, List<String>> headers; - private final T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map<String, List<String>> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map<String, List<String>> getHeaders() { - return headers; - } - - public T getData() { - return data; - } + private final int statusCode; + private final Map<String, List<String>> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map<String, List<String>> getHeaders() { + return headers; + } + + public T getData() { + return data; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java index acbecda489dd..107ad039b0b6 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java @@ -3,37 +3,35 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client; - public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + /** + * Get the default API client, which would be used when creating API instances without providing + * an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API instances without providing + * an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java index 83d4514b071b..12541a8636a4 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java @@ -9,6 +9,8 @@ import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import java.io.IOException; +import java.math.BigDecimal; import org.threeten.bp.DateTimeException; import org.threeten.bp.DateTimeUtils; import org.threeten.bp.Instant; @@ -19,12 +21,10 @@ import org.threeten.bp.temporal.Temporal; import org.threeten.bp.temporal.TemporalAccessor; -import java.io.IOException; -import java.math.BigDecimal; - /** - * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. - * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link + * ZonedDateTime}s. Adapted from the jackson threetenbp InstantDeserializer to add support for + * deserializing rfc822 format. * * @author Nick Williams */ @@ -32,84 +32,89 @@ public class CustomInstantDeserializer<T extends Temporal> extends ThreeTenDateTimeDeserializerBase<T> { private static final long serialVersionUID = 1L; - public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>( - Instant.class, DateTimeFormatter.ISO_INSTANT, - new Function<TemporalAccessor, Instant>() { - @Override - public Instant apply(TemporalAccessor temporalAccessor) { - return Instant.from(temporalAccessor); - } - }, - new Function<FromIntegerArguments, Instant>() { - @Override - public Instant apply(FromIntegerArguments a) { - return Instant.ofEpochMilli(a.value); - } - }, - new Function<FromDecimalArguments, Instant>() { - @Override - public Instant apply(FromDecimalArguments a) { - return Instant.ofEpochSecond(a.integer, a.fraction); - } - }, - null - ); - - public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>( - OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, - new Function<TemporalAccessor, OffsetDateTime>() { - @Override - public OffsetDateTime apply(TemporalAccessor temporalAccessor) { - return OffsetDateTime.from(temporalAccessor); - } - }, - new Function<FromIntegerArguments, OffsetDateTime>() { - @Override - public OffsetDateTime apply(FromIntegerArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function<FromDecimalArguments, OffsetDateTime>() { - @Override - public OffsetDateTime apply(FromDecimalArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() { - @Override - public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { - return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); - } - } - ); - - public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>( - ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, - new Function<TemporalAccessor, ZonedDateTime>() { - @Override - public ZonedDateTime apply(TemporalAccessor temporalAccessor) { - return ZonedDateTime.from(temporalAccessor); - } - }, - new Function<FromIntegerArguments, ZonedDateTime>() { - @Override - public ZonedDateTime apply(FromIntegerArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function<FromDecimalArguments, ZonedDateTime>() { - @Override - public ZonedDateTime apply(FromDecimalArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() { - @Override - public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { - return zonedDateTime.withZoneSameInstant(zoneId); - } - } - ); + public static final CustomInstantDeserializer<Instant> INSTANT = + new CustomInstantDeserializer<Instant>( + Instant.class, + DateTimeFormatter.ISO_INSTANT, + new Function<TemporalAccessor, Instant>() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, Instant>() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function<FromDecimalArguments, Instant>() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null); + + public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = + new CustomInstantDeserializer<OffsetDateTime>( + OffsetDateTime.class, + DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function<TemporalAccessor, OffsetDateTime>() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, OffsetDateTime>() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function<FromDecimalArguments, OffsetDateTime>() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant( + Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + }); + + public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = + new CustomInstantDeserializer<ZonedDateTime>( + ZonedDateTime.class, + DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function<TemporalAccessor, ZonedDateTime>() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, ZonedDateTime>() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function<FromDecimalArguments, ZonedDateTime>() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant( + Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + }); protected final Function<FromIntegerArguments, T> fromMilliseconds; @@ -119,22 +124,26 @@ public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { protected final BiFunction<T, ZoneId, T> adjust; - protected CustomInstantDeserializer(Class<T> supportedType, - DateTimeFormatter parser, - Function<TemporalAccessor, T> parsedToValue, - Function<FromIntegerArguments, T> fromMilliseconds, - Function<FromDecimalArguments, T> fromNanoseconds, - BiFunction<T, ZoneId, T> adjust) { + protected CustomInstantDeserializer( + Class<T> supportedType, + DateTimeFormatter parser, + Function<TemporalAccessor, T> parsedToValue, + Function<FromIntegerArguments, T> fromMilliseconds, + Function<FromDecimalArguments, T> fromNanoseconds, + BiFunction<T, ZoneId, T> adjust) { super(supportedType, parser); this.parsedToValue = parsedToValue; this.fromMilliseconds = fromMilliseconds; this.fromNanoseconds = fromNanoseconds; - this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() { - @Override - public T apply(T t, ZoneId zoneId) { - return t; - } - } : adjust; + this.adjust = + adjust == null + ? new BiFunction<T, ZoneId, T>() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } + : adjust; } @SuppressWarnings("unchecked") @@ -156,49 +165,50 @@ protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) { @Override public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { - //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only - //string values have to be adjusted to the configured TZ. + // NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + // string values have to be adjusted to the configured TZ. switch (parser.getCurrentTokenId()) { - case JsonTokenId.ID_NUMBER_FLOAT: { - BigDecimal value = parser.getDecimalValue(); - long seconds = value.longValue(); - int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); - return fromNanoseconds.apply(new FromDecimalArguments( - seconds, nanoseconds, getZone(context))); - } - - case JsonTokenId.ID_NUMBER_INT: { - long timestamp = parser.getLongValue(); - if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { - return this.fromNanoseconds.apply(new FromDecimalArguments( - timestamp, 0, this.getZone(context) - )); - } - return this.fromMilliseconds.apply(new FromIntegerArguments( - timestamp, this.getZone(context) - )); - } - - case JsonTokenId.ID_STRING: { - String string = parser.getText().trim(); - if (string.length() == 0) { - return null; + case JsonTokenId.ID_NUMBER_FLOAT: + { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply( + new FromDecimalArguments(seconds, nanoseconds, getZone(context))); } - if (string.endsWith("+0000")) { - string = string.substring(0, string.length() - 5) + "Z"; + + case JsonTokenId.ID_NUMBER_INT: + { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply( + new FromDecimalArguments(timestamp, 0, this.getZone(context))); + } + return this.fromMilliseconds.apply( + new FromIntegerArguments(timestamp, this.getZone(context))); } - T value; - try { - TemporalAccessor acc = _formatter.parse(string); - value = parsedToValue.apply(acc); - if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { - return adjust.apply(value, this.getZone(context)); + + case JsonTokenId.ID_STRING: + { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); } - } catch (DateTimeException e) { - throw _peelDTE(e); + return value; } - return value; - } } throw context.mappingException("Expected type float, integer, or string."); } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java index 6517dc877a39..9ace1af62702 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java @@ -1,15 +1,12 @@ package org.openapitools.client; -import org.threeten.bp.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; -import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; - import java.text.DateFormat; - import javax.ws.rs.ext.ContextResolver; - +import org.openapitools.jackson.nullable.JsonNullableModule; +import org.threeten.bp.*; public class JSON implements ContextResolver<ObjectMapper> { private ObjectMapper mapper; @@ -34,6 +31,7 @@ public JSON() { /** * Set the date format for JSON (de)serialization with Date properties. + * * @param dateFormat Date format */ public void setDateFormat(DateFormat dateFormat) { @@ -44,4 +42,8 @@ public void setDateFormat(DateFormat dateFormat) { public ObjectMapper getContext(Class<?> type) { return mapper; } + + public ObjectMapper getMapper() { + return mapper; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java index ae89aa614543..ce6aa2ef976f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java @@ -3,59 +3,57 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client; - public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } + private String name = ""; + private String value = ""; - private void setName(String name) { - if (!isValidString(name)) { - return; - } + public Pair(String name, String value) { + setName(name); + setValue(value); + } - this.name = name; + private void setName(String name) { + if (!isValidString(name)) { + return; } - private void setValue(String value) { - if (!isValidString(value)) { - return; - } + this.name = name; + } - this.value = value; + private void setValue(String value) { + if (!isValidString(value)) { + return; } - public String getName() { - return this.name; - } + this.value = value; + } - public String getValue() { - return this.value; - } + public String getName() { + return this.name; + } - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } + public String getValue() { + return this.value; + } - if (arg.trim().isEmpty()) { - return false; - } + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } - return true; + if (arg.trim().isEmpty()) { + return false; } + + return true; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java index 9509fd089812..8b88105c7629 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -3,7 +3,7 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,11 +14,9 @@ import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import com.fasterxml.jackson.databind.util.ISO8601Utils; - import java.text.FieldPosition; import java.util.Date; - public class RFC3339DateFormat extends ISO8601DateFormat { // Same as ISO8601DateFormat but serializing milliseconds. @@ -28,5 +26,4 @@ public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fie toAppendTo.append(value); return toAppendTo; } - -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java index a1107a8690e4..b307b65c571e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -2,57 +2,58 @@ import java.util.Map; -/** - * Representing a Server configuration. - */ +/** Representing a Server configuration. */ public class ServerConfiguration { - public String URL; - public String description; - public Map<String, ServerVariable> variables; + public String URL; + public String description; + public Map<String, ServerVariable> variables; - /** - * @param URL A URL to the target host. - * @param description A describtion of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - */ - public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) { - this.URL = URL; - this.description = description; - this.variables = variables; - } + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for + * substitution in the server's URL template. + */ + public ServerConfiguration( + String URL, String description, Map<String, ServerVariable> variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } - /** - * Format URL template using given variables. - * - * @param variables A map between a variable name and its value. - * @return Formatted URL. - */ - public String URL(Map<String, String> variables) { - String url = this.URL; + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map<String, String> variables) { + String url = this.URL; - // go through variables and replace placeholders - for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) { - String name = variable.getKey(); - ServerVariable serverVariable = variable.getValue(); - String value = serverVariable.defaultValue; + // go through variables and replace placeholders + for (Map.Entry<String, ServerVariable> variable : this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; - if (variables != null && variables.containsKey(name)) { - value = variables.get(name); - if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); - } - } - url = url.replaceAll("\\{" + name + "\\}", value); + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException( + "The variable " + name + " in the server URL has invalid value " + value + "."); } - return url; + } + url = url.replaceAll("\\{" + name + "\\}", value); } + return url; + } - /** - * Format URL template using default server variables. - * - * @return Formatted URL. - */ - public String URL() { - return URL(null); - } + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java index c2f13e216662..f5a0c96ed055 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java @@ -2,22 +2,21 @@ import java.util.HashSet; -/** - * Representing a Server Variable for server URL template substitution. - */ +/** Representing a Server Variable for server URL template substitution. */ public class ServerVariable { - public String description; - public String defaultValue; - public HashSet<String> enumValues = null; + public String description; + public String defaultValue; + public HashSet<String> enumValues = null; - /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. - */ - public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { - this.description = description; - this.defaultValue = defaultValue; - this.enumValues = enumValues; - } + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are + * from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java index 266c26be3a50..70cd91e3b294 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java @@ -3,17 +3,15 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client; - public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). @@ -36,12 +34,11 @@ public static boolean containsIgnoreCase(String[] array, String value) { /** * Join an array of strings with the given separator. - * <p> - * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - * </p> * - * @param array The array of strings + * <p>Note: This might be replaced by utility method from commons-lang or guava someday if one of + * those libraries is added as dependency. + * + * @param array The array of strings * @param separator The separator * @return the resulting string */ diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index e06e72ecac6a..67f9b20ad791 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -1,21 +1,17 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; - -import javax.ws.rs.core.GenericType; - import org.openapitools.client.model.Client; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - public class AnotherFakeApi { private ApiClient apiClient; @@ -35,41 +31,42 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** - * To test special tags - * To test special tags and operation ID starting with number - * @param body client model (required) + * To test special tags To test special tags and operation ID starting with number + * + * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public Client call123testSpecialTags(Client body) throws ApiException { - return call123testSpecialTagsWithHttpInfo(body).getData(); + public Client call123testSpecialTags(Client client) throws ApiException { + return call123testSpecialTagsWithHttpInfo(client).getData(); } /** - * To test special tags - * To test special tags and operation ID starting with number - * @param body client model (required) + * To test special tags To test special tags and operation ID starting with number + * + * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags"); + public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException( + 400, "Missing the required parameter 'client' when calling call123testSpecialTags"); } - + // create path and map variables String localVarPath = "/another-fake/dummy"; @@ -79,26 +76,29 @@ public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body) throw Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<Client> localVarReturnType = new GenericType<Client>() {}; - return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "AnotherFakeApi.call123testSpecialTags", + localVarPath, + "PATCH", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..b70b363a6f27 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,94 @@ +package org.openapitools.client.api; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; +import org.openapitools.client.model.InlineResponseDefault; + +public class DefaultApi { + private ApiClient apiClient; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + /** + * @return InlineResponseDefault + * @throws ApiException if fails to make API call + * @http.response.details + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> response </td><td> - </td></tr> + * </table> + */ + public InlineResponseDefault fooGet() throws ApiException { + return fooGetWithHttpInfo().getData(); + } + + /** + * @return ApiResponse<InlineResponseDefault> + * @throws ApiException if fails to make API call + * @http.response.details + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> response </td><td> - </td></tr> + * </table> + */ + public ApiResponse<InlineResponseDefault> fooGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = {}; + + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + GenericType<InlineResponseDefault> localVarReturnType = + new GenericType<InlineResponseDefault>() {}; + + return apiClient.invokeAPI( + "DefaultApi.fooGet", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java index d077830e35f1..ea5b240a3389 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java @@ -1,28 +1,25 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; +import java.io.File; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; - -import javax.ws.rs.core.GenericType; - -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.HealthCheckResult; import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.Pet; import org.openapitools.client.model.User; -import org.openapitools.client.model.XmlItem; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; public class FakeApi { private ApiClient apiClient; @@ -43,42 +40,112 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** - * creates an XmlItem - * this route creates an XmlItem - * @param xmlItem XmlItem Body (required) + * Health check endpoint + * + * @return HealthCheckResult * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + * </table> */ - public void createXmlItem(XmlItem xmlItem) throws ApiException { - createXmlItemWithHttpInfo(xmlItem); + public HealthCheckResult fakeHealthGet() throws ApiException { + return fakeHealthGetWithHttpInfo().getData(); } /** - * creates an XmlItem - * this route creates an XmlItem - * @param xmlItem XmlItem Body (required) + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> + * @throws ApiException if fails to make API call + * @http.response.details + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + * </table> + */ + public ApiResponse<HealthCheckResult> fakeHealthGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/health"; + + // query params + List<Pair> localVarQueryParams = new ArrayList<Pair>(); + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); + Map<String, String> localVarCookieParams = new HashMap<String, String>(); + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = {}; + + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {}; + + GenericType<HealthCheckResult> localVarReturnType = new GenericType<HealthCheckResult>() {}; + + return apiClient.invokeAPI( + "FakeApi.fakeHealthGet", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); + } + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) + * @throws ApiException if fails to make API call + * @http.response.details + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + * </table> + */ + public void fakeHttpSignatureTest(Pet pet, String query1, String header1) throws ApiException { + fakeHttpSignatureTestWithHttpInfo(pet, query1, header1); + } + + /** + * test http signature authentication + * + * @param pet Pet object that needs to be added to the store (required) + * @param query1 query parameter (optional) + * @param header1 header parameter (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { - Object localVarPostBody = xmlItem; - - // verify the required parameter 'xmlItem' is set - if (xmlItem == null) { - throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem"); + public ApiResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, String query1, String header1) + throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException( + 400, "Missing the required parameter 'pet' when calling fakeHttpSignatureTest"); } - + // create path and map variables - String localVarPath = "/fake/create_xml_item"; + String localVarPath = "/fake/http-signature-test"; // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -86,57 +153,66 @@ public ApiResponse<Void> createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "query_1", query1)); + + if (header1 != null) localVarHeaderParams.put("header_1", apiClient.parameterToString(header1)); + + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" - }; + final String[] localVarContentTypes = {"application/json", "application/xml"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"http_signature_test"}; + + return apiClient.invokeAPI( + "FakeApi.fakeHttpSignatureTest", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * * Test serialization of outer boolean types + * * @param body Input boolean as post body (optional) * @return Boolean * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> + * </table> */ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); } /** - * * Test serialization of outer boolean types + * * @param body Input boolean as post body (optional) * @return ApiResponse<Boolean> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> + * </table> */ - public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { + public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) + throws ApiException { Object localVarPostBody = body; - + // create path and map variables String localVarPath = "/fake/outer/boolean"; @@ -146,59 +222,64 @@ public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "*/*" - }; + final String[] localVarAccepts = {"*/*"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {}; - return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "FakeApi.fakeOuterBooleanSerialize", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * * Test serialization of object with outer number type - * @param body Input composite as post body (optional) + * + * @param outerComposite Input composite as post body (optional) * @return OuterComposite * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> + * </table> */ - public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { - return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); + public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) + throws ApiException { + return fakeOuterCompositeSerializeWithHttpInfo(outerComposite).getData(); } /** - * * Test serialization of object with outer number type - * @param body Input composite as post body (optional) + * + * @param outerComposite Input composite as post body (optional) * @return ApiResponse<OuterComposite> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> + * </table> */ - public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { - Object localVarPostBody = body; - + public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo( + OuterComposite outerComposite) throws ApiException { + Object localVarPostBody = outerComposite; + // create path and map variables String localVarPath = "/fake/outer/composite"; @@ -208,59 +289,63 @@ public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(Outer Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "*/*" - }; + final String[] localVarAccepts = {"*/*"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {}; - return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "FakeApi.fakeOuterCompositeSerialize", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * * Test serialization of outer number types + * * @param body Input number as post body (optional) * @return BigDecimal * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output number </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output number </td><td> - </td></tr> + * </table> */ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { return fakeOuterNumberSerializeWithHttpInfo(body).getData(); } /** - * * Test serialization of outer number types + * * @param body Input number as post body (optional) * @return ApiResponse<BigDecimal> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output number </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output number </td><td> - </td></tr> + * </table> */ - public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { + public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) + throws ApiException { Object localVarPostBody = body; - + // create path and map variables String localVarPath = "/fake/outer/number"; @@ -270,59 +355,62 @@ public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal b Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "*/*" - }; + final String[] localVarAccepts = {"*/*"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {}; - return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "FakeApi.fakeOuterNumberSerialize", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * * Test serialization of outer string types + * * @param body Input string as post body (optional) * @return String * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output string </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output string </td><td> - </td></tr> + * </table> */ public String fakeOuterStringSerialize(String body) throws ApiException { return fakeOuterStringSerializeWithHttpInfo(body).getData(); } /** - * * Test serialization of outer string types + * * @param body Input string as post body (optional) * @return ApiResponse<String> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Output string </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Output string </td><td> - </td></tr> + * </table> */ public ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { Object localVarPostBody = body; - + // create path and map variables String localVarPath = "/fake/outer/string"; @@ -332,63 +420,69 @@ public ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body) thr Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "*/*" - }; + final String[] localVarAccepts = {"*/*"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<String> localVarReturnType = new GenericType<String>() {}; - return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "FakeApi.fakeOuterStringSerialize", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * * For this test, the body for this request much reference a schema named `File`. - * @param body (required) + * + * @param fileSchemaTestClass (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Success </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Success </td><td> - </td></tr> + * </table> */ - public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { - testBodyWithFileSchemaWithHttpInfo(body); + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); } /** - * * For this test, the body for this request much reference a schema named `File`. - * @param body (required) + * + * @param fileSchemaTestClass (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Success </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Success </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema"); + public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo( + FileSchemaTestClass fileSchemaTestClass) throws ApiException { + Object localVarPostBody = fileSchemaTestClass; + + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException( + 400, + "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); } - + // create path and map variables String localVarPath = "/fake/body-with-file-schema"; @@ -398,68 +492,71 @@ public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "FakeApi.testBodyWithFileSchema", + localVarPath, + "PUT", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * - * - * @param query (required) - * @param body (required) + * @param query (required) + * @param user (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Success </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Success </td><td> - </td></tr> + * </table> */ - public void testBodyWithQueryParams(String query, User body) throws ApiException { - testBodyWithQueryParamsWithHttpInfo(query, body); + public void testBodyWithQueryParams(String query, User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); } /** - * - * - * @param query (required) - * @param body (required) + * @param query (required) + * @param user (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Success </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Success </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { - Object localVarPostBody = body; - + public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User user) + throws ApiException { + Object localVarPostBody = user; + // verify the required parameter 'query' is set if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + throw new ApiException( + 400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException( + 400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); } - + // create path and map variables String localVarPath = "/fake/body-with-query-params"; @@ -471,61 +568,67 @@ public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); - - - - final String[] localVarAccepts = { - - }; + final String[] localVarAccepts = {}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "FakeApi.testBodyWithQueryParams", + localVarPath, + "PUT", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * To test \"client\" model - * To test \"client\" model - * @param body client model (required) + * To test \"client\" model To test \"client\" model + * + * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public Client testClientModel(Client body) throws ApiException { - return testClientModelWithHttpInfo(body).getData(); + public Client testClientModel(Client client) throws ApiException { + return testClientModelWithHttpInfo(client).getData(); } /** - * To test \"client\" model - * To test \"client\" model - * @param body client model (required) + * To test \"client\" model To test \"client\" model + * + * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Client> testClientModelWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); + public ApiResponse<Client> testClientModelWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException( + 400, "Missing the required parameter 'client' when calling testClientModel"); } - + // create path and map variables String localVarPath = "/fake"; @@ -535,31 +638,35 @@ public ApiResponse<Client> testClientModelWithHttpInfo(Client body) throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<Client> localVarReturnType = new GenericType<Client>() {}; - return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "FakeApi.testClientModel", + localVarPath, + "PATCH", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing + * various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * * @param number None (required) * @param _double None (required) * @param patternWithoutDelimiter None (required) @@ -576,19 +683,49 @@ public ApiResponse<Client> testClientModelWithHttpInfo(Client body) throws ApiEx * @param paramCallback None (optional) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ - public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { - testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + public void testEndpointParameters( + BigDecimal number, + Double _double, + String patternWithoutDelimiter, + byte[] _byte, + Integer integer, + Integer int32, + Long int64, + Float _float, + String string, + File binary, + LocalDate date, + OffsetDateTime dateTime, + String password, + String paramCallback) + throws ApiException { + testEndpointParametersWithHttpInfo( + number, + _double, + patternWithoutDelimiter, + _byte, + integer, + int32, + int64, + _float, + string, + binary, + date, + dateTime, + password, + paramCallback); } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing + * various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * * @param number None (required) * @param _double None (required) * @param patternWithoutDelimiter None (required) @@ -606,35 +743,55 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + public ApiResponse<Void> testEndpointParametersWithHttpInfo( + BigDecimal number, + Double _double, + String patternWithoutDelimiter, + byte[] _byte, + Integer integer, + Integer int32, + Long int64, + Float _float, + String string, + File binary, + LocalDate date, + OffsetDateTime dateTime, + String password, + String paramCallback) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'number' is set if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + throw new ApiException( + 400, "Missing the required parameter 'number' when calling testEndpointParameters"); } - + // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + throw new ApiException( + 400, "Missing the required parameter '_double' when calling testEndpointParameters"); } - + // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + throw new ApiException( + 400, + "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } - + // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + throw new ApiException( + 400, "Missing the required parameter '_byte' when calling testEndpointParameters"); } - + // create path and map variables String localVarPath = "/fake"; @@ -644,60 +801,54 @@ public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, D Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - if (integer != null) - localVarFormParams.put("integer", integer); -if (int32 != null) - localVarFormParams.put("int32", int32); -if (int64 != null) - localVarFormParams.put("int64", int64); -if (number != null) - localVarFormParams.put("number", number); -if (_float != null) - localVarFormParams.put("float", _float); -if (_double != null) - localVarFormParams.put("double", _double); -if (string != null) - localVarFormParams.put("string", string); -if (patternWithoutDelimiter != null) + if (integer != null) localVarFormParams.put("integer", integer); + if (int32 != null) localVarFormParams.put("int32", int32); + if (int64 != null) localVarFormParams.put("int64", int64); + if (number != null) localVarFormParams.put("number", number); + if (_float != null) localVarFormParams.put("float", _float); + if (_double != null) localVarFormParams.put("double", _double); + if (string != null) localVarFormParams.put("string", string); + if (patternWithoutDelimiter != null) localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); -if (_byte != null) - localVarFormParams.put("byte", _byte); -if (binary != null) - localVarFormParams.put("binary", binary); -if (date != null) - localVarFormParams.put("date", date); -if (dateTime != null) - localVarFormParams.put("dateTime", dateTime); -if (password != null) - localVarFormParams.put("password", password); -if (paramCallback != null) - localVarFormParams.put("callback", paramCallback); - - final String[] localVarAccepts = { - - }; + if (_byte != null) localVarFormParams.put("byte", _byte); + if (binary != null) localVarFormParams.put("binary", binary); + if (date != null) localVarFormParams.put("date", date); + if (dateTime != null) localVarFormParams.put("dateTime", dateTime); + if (password != null) localVarFormParams.put("password", password); + if (paramCallback != null) localVarFormParams.put("callback", paramCallback); + + final String[] localVarAccepts = {}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_basic_test" }; - - return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"http_basic_test"}; + + return apiClient.invokeAPI( + "FakeApi.testEndpointParameters", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * To test enum parameters - * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * To test enum parameters To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to + * new ArrayList<String>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new + * ArrayList<String>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) @@ -705,22 +856,41 @@ public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, D * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> - <tr><td> 404 </td><td> Not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * </table> */ - public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { - testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + public void testEnumParameters( + List<String> enumHeaderStringArray, + String enumHeaderString, + List<String> enumQueryStringArray, + String enumQueryString, + Integer enumQueryInteger, + Double enumQueryDouble, + List<String> enumFormStringArray, + String enumFormString) + throws ApiException { + testEnumParametersWithHttpInfo( + enumHeaderStringArray, + enumHeaderString, + enumQueryStringArray, + enumQueryString, + enumQueryInteger, + enumQueryDouble, + enumFormStringArray, + enumFormString); } /** - * To test enum parameters - * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) + * To test enum parameters To test enum parameters + * + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to + * new ArrayList<String>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new + * ArrayList<String>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) @@ -729,15 +899,24 @@ public void testEnumParameters(List<String> enumHeaderStringArray, String enumHe * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> - <tr><td> 404 </td><td> Not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> + * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { + public ApiResponse<Void> testEnumParametersWithHttpInfo( + List<String> enumHeaderStringArray, + String enumHeaderString, + List<String> enumQueryStringArray, + String enumQueryString, + Integer enumQueryInteger, + Double enumQueryDouble, + List<String> enumFormStringArray, + String enumFormString) + throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/fake"; @@ -747,57 +926,81 @@ public ApiResponse<Void> testEnumParametersWithHttpInfo(List<String> enumHeaderS Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); if (enumHeaderStringArray != null) - localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); -if (enumHeaderString != null) + localVarHeaderParams.put( + "enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); + if (enumHeaderString != null) localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); - if (enumFormStringArray != null) localVarFormParams.put("enum_form_string_array", enumFormStringArray); -if (enumFormString != null) - localVarFormParams.put("enum_form_string", enumFormString); + if (enumFormString != null) localVarFormParams.put("enum_form_string", enumFormString); + + final String[] localVarAccepts = {}; - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "FakeApi.testEnumParameters", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } -private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + private ApiResponse<Void> testGroupParametersWithHttpInfo( + Integer requiredStringGroup, + Boolean requiredBooleanGroup, + Long requiredInt64Group, + Integer stringGroup, + Boolean booleanGroup, + Long int64Group) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + throw new ApiException( + 400, + "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); } - + // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + throw new ApiException( + 400, + "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); } - + // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + throw new ApiException( + 400, + "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); } - + // create path and map variables String localVarPath = "/fake"; @@ -807,33 +1010,43 @@ private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredString Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); if (requiredBooleanGroup != null) - localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); -if (booleanGroup != null) + localVarHeaderParams.put( + "required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); + if (booleanGroup != null) localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup)); - - - final String[] localVarAccepts = { - - }; + final String[] localVarAccepts = {}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; - String[] localVarAuthNames = new String[] { }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"bearer_test"}; + + return apiClient.invokeAPI( + "FakeApi.testGroupParameters", + localVarPath, + "DELETE", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } public class APItestGroupParametersRequest { @@ -844,12 +1057,11 @@ public class APItestGroupParametersRequest { private Boolean booleanGroup; private Long int64Group; - private APItestGroupParametersRequest() { - } - + private APItestGroupParametersRequest() {} /** * Set requiredStringGroup + * * @param requiredStringGroup Required String in group parameters (required) * @return APItestGroupParametersRequest */ @@ -857,10 +1069,10 @@ public APItestGroupParametersRequest requiredStringGroup(Integer requiredStringG this.requiredStringGroup = requiredStringGroup; return this; } - /** * Set requiredBooleanGroup + * * @param requiredBooleanGroup Required Boolean in group parameters (required) * @return APItestGroupParametersRequest */ @@ -868,10 +1080,10 @@ public APItestGroupParametersRequest requiredBooleanGroup(Boolean requiredBoolea this.requiredBooleanGroup = requiredBooleanGroup; return this; } - /** * Set requiredInt64Group + * * @param requiredInt64Group Required Integer in group parameters (required) * @return APItestGroupParametersRequest */ @@ -879,10 +1091,10 @@ public APItestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) this.requiredInt64Group = requiredInt64Group; return this; } - /** * Set stringGroup + * * @param stringGroup String in group parameters (optional) * @return APItestGroupParametersRequest */ @@ -890,10 +1102,10 @@ public APItestGroupParametersRequest stringGroup(Integer stringGroup) { this.stringGroup = stringGroup; return this; } - /** * Set booleanGroup + * * @param booleanGroup Boolean in group parameters (optional) * @return APItestGroupParametersRequest */ @@ -901,10 +1113,10 @@ public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { this.booleanGroup = booleanGroup; return this; } - /** * Set int64Group + * * @param int64Group Integer in group parameters (optional) * @return APItestGroupParametersRequest */ @@ -912,88 +1124,91 @@ public APItestGroupParametersRequest int64Group(Long int64Group) { this.int64Group = int64Group; return this; } - /** * Execute testGroupParameters request - + * * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> - </table> - + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> + * </table> */ - public void execute() throws ApiException { this.executeWithHttpInfo().getData(); } /** * Execute testGroupParameters request with HTTP info returned + * * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> - </table> - + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> executeWithHttpInfo() throws ApiException { - return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + return testGroupParametersWithHttpInfo( + requiredStringGroup, + requiredBooleanGroup, + requiredInt64Group, + stringGroup, + booleanGroup, + int64Group); } } /** - * Fake endpoint to test group parameters (optional) - * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters + * (optional) + * * @return testGroupParametersRequest * @throws ApiException if fails to make API call - - */ - public APItestGroupParametersRequest testGroupParameters() throws ApiException { return new APItestGroupParametersRequest(); } /** * test inline additionalProperties - * - * @param param request body (required) + * + * @param requestBody request body (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public void testInlineAdditionalProperties(Map<String, String> param) throws ApiException { - testInlineAdditionalPropertiesWithHttpInfo(param); + public void testInlineAdditionalProperties(Map<String, String> requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); } /** * test inline additionalProperties - * - * @param param request body (required) + * + * @param requestBody request body (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> param) throws ApiException { - Object localVarPostBody = param; - - // verify the required parameter 'param' is set - if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties"); + public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo( + Map<String, String> requestBody) throws ApiException { + Object localVarPostBody = requestBody; + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException( + 400, + "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); } - + // create path and map variables String localVarPath = "/fake/inline-additionalProperties"; @@ -1003,37 +1218,41 @@ public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "FakeApi.testInlineAdditionalProperties", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * test json serialization of form data - * + * * @param param field1 (required) * @param param2 field2 (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ public void testJsonFormData(String param, String param2) throws ApiException { testJsonFormDataWithHttpInfo(param, param2); @@ -1041,30 +1260,33 @@ public void testJsonFormData(String param, String param2) throws ApiException { /** * test json serialization of form data - * + * * @param param field1 (required) * @param param2 field2 (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { + public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + throw new ApiException( + 400, "Missing the required parameter 'param' when calling testJsonFormData"); } - + // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + throw new ApiException( + 400, "Missing the required parameter 'param2' when calling testJsonFormData"); } - + // create path and map variables String localVarPath = "/fake/jsonFormData"; @@ -1074,93 +1296,118 @@ public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + if (param != null) localVarFormParams.put("param", param); + if (param2 != null) localVarFormParams.put("param2", param2); - - - if (param != null) - localVarFormParams.put("param", param); -if (param2 != null) - localVarFormParams.put("param2", param2); + final String[] localVarAccepts = {}; - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "FakeApi.testJsonFormData", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * * To test the collection format in query parameters - * @param pipe (required) - * @param ioutil (required) - * @param http (required) - * @param url (required) - * @param context (required) + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Success </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Success </td><td> - </td></tr> + * </table> */ - public void testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { + public void testQueryParameterCollectionFormat( + List<String> pipe, + List<String> ioutil, + List<String> http, + List<String> url, + List<String> context) + throws ApiException { testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); } /** - * * To test the collection format in query parameters - * @param pipe (required) - * @param ioutil (required) - * @param http (required) - * @param url (required) - * @param context (required) + * + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> Success </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> Success </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { + public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo( + List<String> pipe, + List<String> ioutil, + List<String> http, + List<String> url, + List<String> context) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + throw new ApiException( + 400, + "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + throw new ApiException( + 400, + "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'http' is set if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + throw new ApiException( + 400, + "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'url' is set if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + throw new ApiException( + 400, + "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'context' is set if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + throw new ApiException( + 400, + "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); } - + // create path and map variables String localVarPath = "/fake/test-query-paramters"; @@ -1170,29 +1417,35 @@ public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(List<Str Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "pipe", pipe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "pipe", pipe)); localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); localVarQueryParams.addAll(apiClient.parameterToPairs("space", "http", http)); localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); - - - - final String[] localVarAccepts = { - - }; + final String[] localVarAccepts = {}; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; - String[] localVarAuthNames = new String[] { }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "FakeApi.testQueryParameterCollectionFormat", + localVarPath, + "PUT", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index c7c0dcafc019..287707679a1f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -1,21 +1,17 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; - -import javax.ws.rs.core.GenericType; - import org.openapitools.client.model.Client; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - public class FakeClassnameTags123Api { private ApiClient apiClient; @@ -35,41 +31,42 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** - * To test class name in snake case - * To test class name in snake case - * @param body client model (required) + * To test class name in snake case To test class name in snake case + * + * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public Client testClassname(Client body) throws ApiException { - return testClassnameWithHttpInfo(body).getData(); + public Client testClassname(Client client) throws ApiException { + return testClassnameWithHttpInfo(client).getData(); } /** - * To test class name in snake case - * To test class name in snake case - * @param body client model (required) + * To test class name in snake case To test class name in snake case + * + * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Client> testClassnameWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + public ApiResponse<Client> testClassnameWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; + + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException( + 400, "Missing the required parameter 'client' when calling testClassname"); } - + // create path and map variables String localVarPath = "/fake_classname_test"; @@ -79,26 +76,29 @@ public ApiResponse<Client> testClassnameWithHttpInfo(Client body) throws ApiExce Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json" - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key_query" }; + String[] localVarAuthNames = new String[] {"api_key_query"}; GenericType<Client> localVarReturnType = new GenericType<Client>() {}; - return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "FakeClassnameTags123Api.testClassname", + localVarPath, + "PATCH", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java index 01476de66bb7..cb2abcf1bc1a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java @@ -1,23 +1,19 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; - -import javax.ws.rs.core.GenericType; - -import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - public class PetApi { private ApiClient apiClient; @@ -38,41 +34,39 @@ public void setApiClient(ApiClient apiClient) { } /** * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) + * + * @param pet Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + * </table> */ - public void addPet(Pet body) throws ApiException { - addPetWithHttpInfo(body); + public void addPet(Pet pet) throws ApiException { + addPetWithHttpInfo(pet); } /** * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store (required) + * + * @param pet Pet object that needs to be added to the store (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + public ApiResponse<Void> addPetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); } - + // create path and map variables String localVarPath = "/pet"; @@ -82,38 +76,41 @@ public ApiResponse<Void> addPetWithHttpInfo(Pet body) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; + final String[] localVarContentTypes = {"application/json", "application/xml"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"petstore_auth"}; + + return apiClient.invokeAPI( + "PetApi.addPet", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * Deletes a pet - * + * * @param petId Pet id to delete (required) - * @param apiKey (optional) + * @param apiKey (optional) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> + * </table> */ public void deletePet(Long petId, String apiKey) throws ApiException { deletePetWithHttpInfo(petId, apiKey); @@ -121,29 +118,29 @@ public void deletePet(Long petId, String apiKey) throws ApiException { /** * Deletes a pet - * + * * @param petId Pet id to delete (required) - * @param apiKey (optional) + * @param apiKey (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> + * </table> */ public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); } - + // create path and map variables - String localVarPath = "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = + "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -151,66 +148,73 @@ public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + if (apiKey != null) localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + final String[] localVarAccepts = {}; - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; - String[] localVarAuthNames = new String[] { "petstore_auth" }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"petstore_auth"}; + + return apiClient.invokeAPI( + "PetApi.deletePet", + localVarPath, + "DELETE", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings + * 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 (required) * @return List<Pet> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> + * </table> */ public List<Pet> findPetsByStatus(List<String> status) throws ApiException { return findPetsByStatusWithHttpInfo(status).getData(); } /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings + * 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 (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> + * </table> */ - public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException { + public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + throw new ApiException( + 400, "Missing the required parameter 'status' when calling findPetsByStatus"); } - + // create path and map variables String localVarPath = "/pet/findByStatus"; @@ -222,39 +226,46 @@ public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] {"petstore_auth"}; GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; - return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "PetApi.findPetsByStatus", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, + * tag3 for testing. + * * @param tags Tags to filter by (required) * @return List<Pet> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> + * </table> + * * @deprecated */ @Deprecated @@ -263,28 +274,31 @@ public List<Pet> findPetsByTags(List<String> tags) throws ApiException { } /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, + * tag3 for testing. + * * @param tags Tags to filter by (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> + * </table> + * * @deprecated */ @Deprecated public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + throw new ApiException( + 400, "Missing the required parameter 'tags' when calling findPetsByTags"); } - + // create path and map variables String localVarPath = "/pet/findByTags"; @@ -296,70 +310,76 @@ public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) thro localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] {"petstore_auth"}; GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; - return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "PetApi.findPetsByTags", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * Find pet by ID - * Returns a single pet + * Find pet by ID Returns a single pet + * * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + * </table> */ public Pet getPetById(Long petId) throws ApiException { return getPetByIdWithHttpInfo(petId).getData(); } /** - * Find pet by ID - * Returns a single pet + * Find pet by ID Returns a single pet + * * @param petId ID of pet to return (required) * @return ApiResponse<Pet> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + * </table> */ public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); } - + // create path and map variables - String localVarPath = "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = + "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -367,69 +387,71 @@ public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "api_key" }; + String[] localVarAuthNames = new String[] {"api_key"}; GenericType<Pet> localVarReturnType = new GenericType<Pet>() {}; - return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "PetApi.getPetById", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** * Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) + * + * @param pet Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + * <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> + * </table> */ - public void updatePet(Pet body) throws ApiException { - updatePetWithHttpInfo(body); + public void updatePet(Pet pet) throws ApiException { + updatePetWithHttpInfo(pet); } /** * Update an existing pet - * - * @param body Pet object that needs to be added to the store (required) + * + * @param pet Pet object that needs to be added to the store (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + * <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + public ApiResponse<Void> updatePetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; + + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); } - + // create path and map variables String localVarPath = "/pet"; @@ -439,38 +461,42 @@ public ApiResponse<Void> updatePetWithHttpInfo(Pet body) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/json", "application/xml" - }; + final String[] localVarContentTypes = {"application/json", "application/xml"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"petstore_auth"}; + + return apiClient.invokeAPI( + "PetApi.updatePet", + localVarPath, + "PUT", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * Updates a pet in the store with form data - * + * * @param petId ID of pet that needs to be updated (required) * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + * </table> */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { updatePetWithFormWithHttpInfo(petId, name, status); @@ -478,29 +504,32 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api /** * Updates a pet in the store with form data - * + * * @param petId ID of pet that needs to be updated (required) * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { + public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + throw new ApiException( + 400, "Missing the required parameter 'petId' when calling updatePetWithForm"); } - + // create path and map variables - String localVarPath = "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = + "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -508,73 +537,79 @@ public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + if (name != null) localVarFormParams.put("name", name); + if (status != null) localVarFormParams.put("status", status); - - - if (name != null) - localVarFormParams.put("name", name); -if (status != null) - localVarFormParams.put("status", status); + final String[] localVarAccepts = {}; - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "application/x-www-form-urlencoded" - }; + final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; - - return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {"petstore_auth"}; + + return apiClient.invokeAPI( + "PetApi.updatePetWithForm", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * uploads an image - * + * * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) + throws ApiException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); } /** * uploads an image - * + * * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { + public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo( + Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); } - + // create path and map variables - String localVarPath = "/pet/{petId}/uploadImage" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = + "/pet/{petId}/uploadImage" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -582,80 +617,90 @@ public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String a Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); -if (file != null) - localVarFormParams.put("file", file); + if (file != null) localVarFormParams.put("file", file); - final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "multipart/form-data" - }; + final String[] localVarContentTypes = {"multipart/form-data"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] {"petstore_auth"}; GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; - return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "PetApi.uploadFile", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** * uploads an image (required) - * + * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { - return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); + public ModelApiResponse uploadFileWithRequiredFile( + Long petId, File requiredFile, String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata) + .getData(); } /** * uploads an image (required) - * + * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo( + Long petId, File requiredFile, String additionalMetadata) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + throw new ApiException( + 400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); } - + // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + throw new ApiException( + 400, + "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); } - + // create path and map variables - String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = + "/fake/{petId}/uploadImageWithRequiredFile" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -663,30 +708,33 @@ public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); -if (requiredFile != null) - localVarFormParams.put("requiredFile", requiredFile); + if (requiredFile != null) localVarFormParams.put("requiredFile", requiredFile); - final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - "multipart/form-data" - }; + final String[] localVarContentTypes = {"multipart/form-data"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] {"petstore_auth"}; GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; - return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "PetApi.uploadFileWithRequiredFile", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java index 11496944ef28..90fdbd917a02 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java @@ -1,21 +1,17 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; - -import javax.ws.rs.core.GenericType; - import org.openapitools.client.model.Order; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - public class StoreApi { private ApiClient apiClient; @@ -35,45 +31,49 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * 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 (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + * </table> */ public void deleteOrder(String orderId) throws ApiException { 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 + * 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 (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + * </table> */ public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + throw new ApiException( + 400, "Missing the required parameter 'orderId' when calling deleteOrder"); } - + // create path and map variables - String localVarPath = "/store/order/{order_id}" - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + String localVarPath = + "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -81,55 +81,60 @@ public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiExcep Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; - String[] localVarAuthNames = new String[] { }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "StoreApi.deleteOrder", + localVarPath, + "DELETE", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * Returns pet inventories by status - * Returns a map of status codes to quantities + * Returns pet inventories by status Returns a map of status codes to quantities + * * @return Map<String, Integer> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ public Map<String, Integer> getInventory() throws ApiException { return getInventoryWithHttpInfo().getData(); } /** - * Returns pet inventories by status - * Returns a map of status codes to quantities + * Returns pet inventories by status Returns a map of status codes to quantities + * * @return ApiResponse<Map<String, Integer>> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * </table> */ public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/store/inventory"; @@ -139,71 +144,80 @@ public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/json" - }; + final String[] localVarAccepts = {"application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { "api_key" }; + final String[] localVarContentTypes = {}; - GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + String[] localVarAuthNames = new String[] {"api_key"}; + + GenericType<Map<String, Integer>> localVarReturnType = + new GenericType<Map<String, Integer>>() {}; + + return apiClient.invokeAPI( + "StoreApi.getInventory", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * 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 (required) * @return Order * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + * </table> */ public Order getOrderById(Long orderId) throws ApiException { return getOrderByIdWithHttpInfo(orderId).getData(); } /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * 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 (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + * </table> */ public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + throw new ApiException( + 400, "Missing the required parameter 'orderId' when calling getOrderById"); } - + // create path and map variables - String localVarPath = "/store/order/{order_id}" - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + String localVarPath = + "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -211,66 +225,70 @@ public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<Order> localVarReturnType = new GenericType<Order>() {}; - return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "StoreApi.getOrderById", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) + * + * @param order order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> + * </table> */ - public Order placeOrder(Order body) throws ApiException { - return placeOrderWithHttpInfo(body).getData(); + public Order placeOrder(Order order) throws ApiException { + return placeOrderWithHttpInfo(order).getData(); } /** * Place an order for a pet - * - * @param body order placed for purchasing the pet (required) + * + * @param order order placed for purchasing the pet (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> + * </table> */ - public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + public ApiResponse<Order> placeOrderWithHttpInfo(Order order) throws ApiException { + Object localVarPostBody = order; + + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); } - + // create path and map variables String localVarPath = "/store/order"; @@ -280,26 +298,29 @@ public ApiResponse<Order> placeOrderWithHttpInfo(Order body) throws ApiException Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<Order> localVarReturnType = new GenericType<Order>() {}; - return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "StoreApi.placeOrder", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java index 1f9d6afe1169..369322b43c92 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java @@ -1,21 +1,17 @@ package org.openapitools.client.api; -import org.openapitools.client.ApiException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; - -import javax.ws.rs.core.GenericType; - import org.openapitools.client.model.User; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - public class UserApi { private ApiClient apiClient; @@ -35,40 +31,40 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object (required) + * Create user This can only be done by the logged in user. + * + * @param user Created user object (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public void createUser(User body) throws ApiException { - createUserWithHttpInfo(body); + public void createUser(User user) throws ApiException { + createUserWithHttpInfo(user); } /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object (required) + * Create user This can only be done by the logged in user. + * + * @param user Created user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + public ApiResponse<Void> createUserWithHttpInfo(User user) throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); } - + // create path and map variables String localVarPath = "/user"; @@ -78,61 +74,67 @@ public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "UserApi.createUser", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * Creates list of users with given input array - * - * @param body List of user object (required) + * + * @param user List of user object (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public void createUsersWithArrayInput(List<User> body) throws ApiException { - createUsersWithArrayInputWithHttpInfo(body); + public void createUsersWithArrayInput(List<User> user) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user); } /** * Creates list of users with given input array - * - * @param body List of user object (required) + * + * @param user List of user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user) + throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException( + 400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); } - + // create path and map variables String localVarPath = "/user/createWithArray"; @@ -142,61 +144,67 @@ public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> body) Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "UserApi.createUsersWithArrayInput", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * Creates list of users with given input array - * - * @param body List of user object (required) + * + * @param user List of user object (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public void createUsersWithListInput(List<User> body) throws ApiException { - createUsersWithListInputWithHttpInfo(body); + public void createUsersWithListInput(List<User> user) throws ApiException { + createUsersWithListInputWithHttpInfo(user); } /** * Creates list of users with given input array - * - * @param body List of user object (required) + * + * @param user List of user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) throws ApiException { - Object localVarPostBody = body; - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user) + throws ApiException { + Object localVarPostBody = user; + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException( + 400, "Missing the required parameter 'user' when calling createUsersWithListInput"); } - + // create path and map variables String localVarPath = "/user/createWithList"; @@ -206,66 +214,72 @@ public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> body) t Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "UserApi.createUsersWithListInput", + localVarPath, + "POST", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * Delete user - * This can only be done by the logged in user. + * Delete user This can only be done by the logged in user. + * * @param username The name that needs to be deleted (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ public void deleteUser(String username) throws ApiException { deleteUserWithHttpInfo(username); } /** - * Delete user - * This can only be done by the logged in user. + * Delete user This can only be done by the logged in user. + * * @param username The name that needs to be deleted (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + throw new ApiException( + 400, "Missing the required parameter 'username' when calling deleteUser"); } - + // create path and map variables - String localVarPath = "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + String localVarPath = + "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -273,39 +287,44 @@ public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiExcep Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; - String[] localVarAuthNames = new String[] { }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "UserApi.deleteUser", + localVarPath, + "DELETE", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** * Get user by user name - * + * * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ public User getUserByName(String username) throws ApiException { return getUserByNameWithHttpInfo(username).getData(); @@ -313,29 +332,31 @@ public User getUserByName(String username) throws ApiException { /** * Get user by user name - * + * * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return ApiResponse<User> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + throw new ApiException( + 400, "Missing the required parameter 'username' when calling getUserByName"); } - + // create path and map variables - String localVarPath = "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + String localVarPath = + "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -343,41 +364,45 @@ public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<User> localVarReturnType = new GenericType<User>() {}; - return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "UserApi.getUserByName", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** * Logs user into the system - * + * * @param username The user name for login (required) * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> - <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> + * <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> + * </table> */ public String loginUser(String username, String password) throws ApiException { return loginUserWithHttpInfo(username, password).getData(); @@ -385,31 +410,34 @@ public String loginUser(String username, String password) throws ApiException { /** * Logs user into the system - * + * * @param username The user name for login (required) * @param password The password for login in clear text (required) * @return ApiResponse<String> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> - <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> + * <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> + * </table> */ - public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException { + public ApiResponse<String> loginUserWithHttpInfo(String username, String password) + throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + throw new ApiException( + 400, "Missing the required parameter 'username' when calling loginUser"); } - + // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + throw new ApiException( + 400, "Missing the required parameter 'password' when calling loginUser"); } - + // create path and map variables String localVarPath = "/user/login"; @@ -422,36 +450,41 @@ public ApiResponse<String> loginUserWithHttpInfo(String username, String passwor localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); - - - - final String[] localVarAccepts = { - "application/xml", "application/json" - }; + final String[] localVarAccepts = {"application/xml", "application/json"}; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {}; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] {}; GenericType<String> localVarReturnType = new GenericType<String>() {}; - return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, localVarReturnType, null); + return apiClient.invokeAPI( + "UserApi.loginUser", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + null); } /** * Logs out current logged in user session - * + * * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ public void logoutUser() throws ApiException { logoutUserWithHttpInfo(); @@ -459,18 +492,18 @@ public void logoutUser() throws ApiException { /** * Logs out current logged in user session - * + * * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + * </table> */ public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/user/logout"; @@ -480,73 +513,80 @@ public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = {}; - String[] localVarAuthNames = new String[] { }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "UserApi.logoutUser", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } /** - * Updated user - * This can only be done by the logged in user. + * Updated user This can only be done by the logged in user. + * * @param username name that need to be deleted (required) - * @param body Updated user object (required) + * @param user Updated user object (required) * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ - public void updateUser(String username, User body) throws ApiException { - updateUserWithHttpInfo(username, body); + public void updateUser(String username, User user) throws ApiException { + updateUserWithHttpInfo(username, user); } /** - * Updated user - * This can only be done by the logged in user. + * Updated user This can only be done by the logged in user. + * * @param username name that need to be deleted (required) - * @param body Updated user object (required) + * @param user Updated user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - <table summary="Response Details" border="1"> - <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> - <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - </table> + * <table summary="Response Details" border="1"> + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + * <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> + * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + * </table> */ - public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) throws ApiException { - Object localVarPostBody = body; - + public ApiResponse<Void> updateUserWithHttpInfo(String username, User user) throws ApiException { + Object localVarPostBody = user; + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + throw new ApiException( + 400, "Missing the required parameter 'username' when calling updateUser"); } - - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); } - + // create path and map variables - String localVarPath = "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + String localVarPath = + "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -554,24 +594,28 @@ public ApiResponse<Void> updateUserWithHttpInfo(String username, User body) thro Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + final String[] localVarAccepts = {}; - - - - final String[] localVarAccepts = { - - }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = { - - }; + final String[] localVarContentTypes = {"application/json"}; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; - - return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, - localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + String[] localVarAuthNames = new String[] {}; + + return apiClient.invokeAPI( + "UserApi.updateUser", + localVarPath, + "PUT", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + null, + null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index a9427105d811..e77ca74a38f5 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -3,21 +3,20 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.auth; -import org.openapitools.client.Pair; - -import java.util.Map; +import java.net.URI; import java.util.List; - +import java.util.Map; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; public class ApiKeyAuth implements Authentication { private final String location; @@ -56,7 +55,14 @@ public void setApiKeyPrefix(String apiKeyPrefix) { } @Override - public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + public void applyToParams( + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException { if (apiKey == null) { return; } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java index 5c558b1d5abd..b2f568ccf5cc 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java @@ -3,28 +3,35 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.auth; -import org.openapitools.client.Pair; - -import java.util.Map; +import java.net.URI; import java.util.List; +import java.util.Map; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams); + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams( + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException; } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 98993417bee7..208509bfe862 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -3,25 +3,22 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.auth; -import org.openapitools.client.Pair; - import com.migcomponents.migbase64.Base64; - -import java.util.Map; -import java.util.List; - import java.io.UnsupportedEncodingException; - +import java.net.URI; +import java.util.List; +import java.util.Map; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; public class HttpBasicAuth implements Authentication { private String username; @@ -44,13 +41,21 @@ public void setPassword(String password) { } @Override - public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + public void applyToParams( + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException { if (username == null && password == null) { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); try { - headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); + headerParams.put( + "Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index e20259cb94ca..c932a7456626 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -3,21 +3,20 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.auth; -import org.openapitools.client.Pair; - -import java.util.Map; +import java.net.URI; import java.util.List; - +import java.util.Map; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; public class HttpBearerAuth implements Authentication { private final String scheme; @@ -28,7 +27,8 @@ public HttpBearerAuth(String scheme) { } /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * Gets the token, which together with the scheme, will be sent as the value of the Authorization + * header. * * @return The bearer token */ @@ -37,7 +37,8 @@ public String getBearerToken() { } /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * Sets the token, which together with the scheme, will be sent as the value of the Authorization + * header. * * @param bearerToken The bearer token to send in the Authorization header */ @@ -46,12 +47,20 @@ public void setBearerToken(String bearerToken) { } @Override - public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { - if(bearerToken == null) { + public void applyToParams( + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException { + if (bearerToken == null) { return; } - headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + headerParams.put( + "Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); } private static String upperCaseBearer(String scheme) { diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java new file mode 100644 index 000000000000..c98091bad019 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java @@ -0,0 +1,141 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.auth; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.Key; +import java.security.MessageDigest; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; +import org.tomitribe.auth.signatures.*; + +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + private String name; + + private Algorithm algorithm; + + private List<String> headers; + + public HttpSignatureAuth(String name, Algorithm algorithm, List<String> headers) { + this.name = name; + this.algorithm = algorithm; + this.headers = headers; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Algorithm getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + public List<String> getHeaders() { + return headers; + } + + public void setHeaders(List<String> headers) { + this.headers = headers; + } + + public Signer getSigner() { + return signer; + } + + public void setSigner(Signer signer) { + this.signer = signer; + } + + public void setup(Key key) throws ApiException { + if (key == null) { + throw new ApiException("key (java.security.Key) cannot be null"); + } + + signer = new Signer(key, new Signature(name, algorithm, null, headers)); + } + + @Override + public void applyToParams( + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + headerParams.put( + "date", + new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); + } + + if (headers.contains("digest")) { + headerParams.put( + "digest", + "SHA-256=" + + new String( + Base64.getEncoder() + .encode(MessageDigest.getInstance("SHA-256").digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException( + "Signer cannot be null. Please run the method `setup` to set it up correctly"); + } + + // construct the path with the URL query string + String path = uri.getPath(); + + List<String> urlQueries = new ArrayList<String>(); + for (Pair queryParam : queryParams) { + urlQueries.add( + queryParam.getName() + + "=" + + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); + } + + if (!urlQueries.isEmpty()) { + path = path + "?" + String.join("&", urlQueries); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException( + "Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java index 779680c9b2f9..c7302cbcbd49 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java @@ -3,21 +3,20 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.auth; -import org.openapitools.client.Pair; - -import java.util.Map; +import java.net.URI; import java.util.List; - +import java.util.Map; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; public class OAuth implements Authentication { private String accessToken; @@ -31,7 +30,14 @@ public void setAccessToken(String accessToken) { } @Override - public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) { + public void applyToParams( + List<Pair> queryParams, + Map<String, String> headerParams, + Map<String, String> cookieParams, + String payload, + String method, + URI uri) + throws ApiException { if (accessToken != null) { headerParams.put("Authorization", "Bearer " + accessToken); } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java index b2d11ff0c4f0..1e09cd99afc5 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -3,16 +3,18 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.auth; public enum OAuthFlow { - accessCode, implicit, password, application + accessCode, + implicit, + password, + application } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 28cf630a27a5..54b31cc472b8 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -3,39 +3,39 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import org.openapitools.client.ApiException; -import java.lang.reflect.Type; import java.util.Map; import javax.ws.rs.core.GenericType; - public abstract class AbstractOpenApiSchema { - private Object instance; + private Object instance; - public final String schemaType; + public final String schemaType; - public AbstractOpenApiSchema(String schemaType) { - this.schemaType = schemaType; - } + public AbstractOpenApiSchema(String schemaType) { + this.schemaType = schemaType; + } - public abstract Map<String, GenericType> getSchemas(); + public abstract Map<String, GenericType> getSchemas(); - public Object getActualInstance() {return instance;} + public Object getActualInstance() { + return instance; + } - public void setActualInstance(Object instance) {this.instance = instance;} + public void setActualInstance(Object instance) { + this.instance = instance; + } - public String getSchemaType() { - return schemaType; - } + public String getSchemaType() { + return schemaType; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java deleted file mode 100644 index c03535ab9471..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * AdditionalPropertiesArray - */ -@JsonPropertyOrder({ - AdditionalPropertiesArray.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesArray extends HashMap<String, List> { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - - public AdditionalPropertiesArray name(String name) { - - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; - return Objects.equals(this.name, additionalPropertiesArray.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesArray {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java deleted file mode 100644 index 4356a4f8c1eb..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * AdditionalPropertiesBoolean - */ -@JsonPropertyOrder({ - AdditionalPropertiesBoolean.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - - public AdditionalPropertiesBoolean name(String name) { - - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; - return Objects.equals(this.name, additionalPropertiesBoolean.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesBoolean {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 781d4686e981..7d984f4458d0 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -3,421 +3,99 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; import java.util.HashMap; -import java.util.List; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * AdditionalPropertiesClass - */ +/** AdditionalPropertiesClass */ @JsonPropertyOrder({ - AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 + AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY }) - public class AdditionalPropertiesClass { - public static final String JSON_PROPERTY_MAP_STRING = "map_string"; - private Map<String, String> mapString = null; - - public static final String JSON_PROPERTY_MAP_NUMBER = "map_number"; - private Map<String, BigDecimal> mapNumber = null; - - public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer"; - private Map<String, Integer> mapInteger = null; - - public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean"; - private Map<String, Boolean> mapBoolean = null; - - public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer"; - private Map<String, List<Integer>> mapArrayInteger = null; - - public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype"; - private Map<String, List<Object>> mapArrayAnytype = null; - - public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string"; - private Map<String, Map<String, String>> mapMapString = null; - - public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype"; - private Map<String, Map<String, Object>> mapMapAnytype = null; - - public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; - private Object anytype1; - - public static final String JSON_PROPERTY_ANYTYPE2 = "anytype_2"; - private Object anytype2; - - public static final String JSON_PROPERTY_ANYTYPE3 = "anytype_3"; - private Object anytype3; - - - public AdditionalPropertiesClass mapString(Map<String, String> mapString) { - - this.mapString = mapString; - return this; - } - - public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { - if (this.mapString == null) { - this.mapString = new HashMap<String, String>(); - } - this.mapString.put(key, mapStringItem); - return this; - } - - /** - * Get mapString - * @return mapString - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, String> getMapString() { - return mapString; - } - - - public void setMapString(Map<String, String> mapString) { - this.mapString = mapString; - } - - - public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) { - - this.mapNumber = mapNumber; - return this; - } - - public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { - if (this.mapNumber == null) { - this.mapNumber = new HashMap<String, BigDecimal>(); - } - this.mapNumber.put(key, mapNumberItem); - return this; - } - - /** - * Get mapNumber - * @return mapNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, BigDecimal> getMapNumber() { - return mapNumber; - } - - - public void setMapNumber(Map<String, BigDecimal> mapNumber) { - this.mapNumber = mapNumber; - } - - - public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) { - - this.mapInteger = mapInteger; - return this; - } - - public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { - if (this.mapInteger == null) { - this.mapInteger = new HashMap<String, Integer>(); - } - this.mapInteger.put(key, mapIntegerItem); - return this; - } - - /** - * Get mapInteger - * @return mapInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, Integer> getMapInteger() { - return mapInteger; - } - - - public void setMapInteger(Map<String, Integer> mapInteger) { - this.mapInteger = mapInteger; - } - - - public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) { - - this.mapBoolean = mapBoolean; - return this; - } - - public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { - if (this.mapBoolean == null) { - this.mapBoolean = new HashMap<String, Boolean>(); - } - this.mapBoolean.put(key, mapBooleanItem); - return this; - } - - /** - * Get mapBoolean - * @return mapBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, Boolean> getMapBoolean() { - return mapBoolean; - } - - - public void setMapBoolean(Map<String, Boolean> mapBoolean) { - this.mapBoolean = mapBoolean; - } - - - public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) { - - this.mapArrayInteger = mapArrayInteger; - return this; - } - - public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) { - if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap<String, List<Integer>>(); - } - this.mapArrayInteger.put(key, mapArrayIntegerItem); - return this; - } - - /** - * Get mapArrayInteger - * @return mapArrayInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, List<Integer>> getMapArrayInteger() { - return mapArrayInteger; - } - + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + private Map<String, String> mapProperty = null; - public void setMapArrayInteger(Map<String, List<Integer>> mapArrayInteger) { - this.mapArrayInteger = mapArrayInteger; - } + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + private Map<String, Map<String, String>> mapOfMapProperty = null; + public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) { - public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) { - - this.mapArrayAnytype = mapArrayAnytype; + this.mapProperty = mapProperty; return this; } - public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) { - if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap<String, List<Object>>(); + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<String, String>(); } - this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + this.mapProperty.put(key, mapPropertyItem); return this; } - /** - * Get mapArrayAnytype - * @return mapArrayAnytype - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, List<Object>> getMapArrayAnytype() { - return mapArrayAnytype; - } - - - public void setMapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) { - this.mapArrayAnytype = mapArrayAnytype; - } - - - public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) { - - this.mapMapString = mapMapString; - return this; - } - - public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) { - if (this.mapMapString == null) { - this.mapMapString = new HashMap<String, Map<String, String>>(); - } - this.mapMapString.put(key, mapMapStringItem); - return this; - } - - /** - * Get mapMapString - * @return mapMapString - **/ + /** + * Get mapProperty + * + * @return mapProperty + */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, Map<String, String>> getMapMapString() { - return mapMapString; + public Map<String, String> getMapProperty() { + return mapProperty; } - - public void setMapMapString(Map<String, Map<String, String>> mapMapString) { - this.mapMapString = mapMapString; + public void setMapProperty(Map<String, String> mapProperty) { + this.mapProperty = mapProperty; } + public AdditionalPropertiesClass mapOfMapProperty( + Map<String, Map<String, String>> mapOfMapProperty) { - public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) { - - this.mapMapAnytype = mapMapAnytype; + this.mapOfMapProperty = mapOfMapProperty; return this; } - public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) { - if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap<String, Map<String, Object>>(); + public AdditionalPropertiesClass putMapOfMapPropertyItem( + String key, Map<String, String> mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<String, Map<String, String>>(); } - this.mapMapAnytype.put(key, mapMapAnytypeItem); + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); return this; } - /** - * Get mapMapAnytype - * @return mapMapAnytype - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map<String, Map<String, Object>> getMapMapAnytype() { - return mapMapAnytype; - } - - - public void setMapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) { - this.mapMapAnytype = mapMapAnytype; - } - - - public AdditionalPropertiesClass anytype1(Object anytype1) { - - this.anytype1 = anytype1; - return this; - } - - /** - * Get anytype1 - * @return anytype1 - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE1) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Object getAnytype1() { - return anytype1; - } - - - public void setAnytype1(Object anytype1) { - this.anytype1 = anytype1; - } - - - public AdditionalPropertiesClass anytype2(Object anytype2) { - - this.anytype2 = anytype2; - return this; - } - - /** - * Get anytype2 - * @return anytype2 - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE2) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Object getAnytype2() { - return anytype2; - } - - - public void setAnytype2(Object anytype2) { - this.anytype2 = anytype2; - } - - - public AdditionalPropertiesClass anytype3(Object anytype3) { - - this.anytype3 = anytype3; - return this; - } - - /** - * Get anytype3 - * @return anytype3 - **/ + /** + * Get mapOfMapProperty + * + * @return mapOfMapProperty + */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE3) + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Object getAnytype3() { - return anytype3; + public Map<String, Map<String, String>> getMapOfMapProperty() { + return mapOfMapProperty; } - - public void setAnytype3(Object anytype3) { - this.anytype3 = anytype3; + public void setMapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -427,47 +105,27 @@ public boolean equals(java.lang.Object o) { return false; } AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; - return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && - Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && - Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && - Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && - Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && - Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && - Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && - Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && - Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && - Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && - Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) + && Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); } @Override public int hashCode() { - return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + return Objects.hash(mapProperty, mapOfMapProperty); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AdditionalPropertiesClass {\n"); - sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); - sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); - sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); - sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); - sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); - sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); - sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); - sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); - sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); - sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); - sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -475,6 +133,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java deleted file mode 100644 index 2426e7c974c4..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * AdditionalPropertiesInteger - */ -@JsonPropertyOrder({ - AdditionalPropertiesInteger.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesInteger extends HashMap<String, Integer> { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - - public AdditionalPropertiesInteger name(String name) { - - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; - return Objects.equals(this.name, additionalPropertiesInteger.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesInteger {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java deleted file mode 100644 index da407ccdc473..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * AdditionalPropertiesNumber - */ -@JsonPropertyOrder({ - AdditionalPropertiesNumber.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - - public AdditionalPropertiesNumber name(String name) { - - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; - return Objects.equals(this.name, additionalPropertiesNumber.name) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(name, super.hashCode()); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesNumber {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java index e0ae875483bd..0be31d514fe3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java @@ -3,43 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * Animal - */ -@JsonPropertyOrder({ - Animal.JSON_PROPERTY_CLASS_NAME, - Animal.JSON_PROPERTY_COLOR -}) +import java.util.Objects; -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +/** Animal */ +@JsonPropertyOrder({Animal.JSON_PROPERTY_CLASS_NAME, Animal.JSON_PROPERTY_COLOR}) +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.EXISTING_PROPERTY, + property = "className", + visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), - @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) - public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; private String className; @@ -47,56 +38,51 @@ public class Animal { public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; - public Animal className(String className) { - + this.className = className; return this; } - /** + /** * Get className + * * @return className - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_CLASS_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getClassName() { return className; } - public void setClassName(String className) { this.className = className; } - public Animal color(String color) { - + this.color = color; return this; } - /** + /** * Get color + * * @return color - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getColor() { return color; } - public void setColor(String color) { this.color = color; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -106,8 +92,8 @@ public boolean equals(java.lang.Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && - Objects.equals(this.color, animal.color); + return Objects.equals(this.className, animal.className) + && Objects.equals(this.color, animal.color); } @Override @@ -115,7 +101,6 @@ public int hashCode() { return Objects.hash(className, color); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -127,8 +112,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -136,6 +120,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 96f829bc648b..fc5cfed29072 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -3,43 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * ArrayOfArrayOfNumberOnly - */ -@JsonPropertyOrder({ - ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER -}) +import java.util.Objects; +/** ArrayOfArrayOfNumberOnly */ +@JsonPropertyOrder({ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER}) public class ArrayOfArrayOfNumberOnly { public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; private List<List<BigDecimal>> arrayArrayNumber = null; - public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { - + this.arrayArrayNumber = arrayArrayNumber; return this; } @@ -52,25 +41,23 @@ public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayAr return this; } - /** + /** * Get arrayArrayNumber + * * @return arrayArrayNumber - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<List<BigDecimal>> getArrayArrayNumber() { return arrayArrayNumber; } - public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { this.arrayArrayNumber = arrayArrayNumber; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,7 +75,6 @@ public int hashCode() { return Objects.hash(arrayArrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -99,8 +85,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -108,6 +93,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 37e40dbd3ec8..6d4b1ba077e6 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -3,43 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * ArrayOfNumberOnly - */ -@JsonPropertyOrder({ - ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER -}) +import java.util.Objects; +/** ArrayOfNumberOnly */ +@JsonPropertyOrder({ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER}) public class ArrayOfNumberOnly { public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; private List<BigDecimal> arrayNumber = null; - public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) { - + this.arrayNumber = arrayNumber; return this; } @@ -52,25 +41,23 @@ public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { return this; } - /** + /** * Get arrayNumber + * * @return arrayNumber - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<BigDecimal> getArrayNumber() { return arrayNumber; } - public void setArrayNumber(List<BigDecimal> arrayNumber) { this.arrayNumber = arrayNumber; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,7 +75,6 @@ public int hashCode() { return Objects.hash(arrayNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -99,8 +85,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -108,6 +93,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java index de7c895ac93a..b7b468f33edd 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -3,38 +3,29 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import org.openapitools.client.model.ReadOnlyFirst; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * ArrayTest - */ +/** ArrayTest */ @JsonPropertyOrder({ ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL }) - public class ArrayTest { public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; private List<String> arrayOfString = null; @@ -45,9 +36,8 @@ public class ArrayTest { public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; private List<List<ReadOnlyFirst>> arrayArrayOfModel = null; - public ArrayTest arrayOfString(List<String> arrayOfString) { - + this.arrayOfString = arrayOfString; return this; } @@ -60,27 +50,25 @@ public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { return this; } - /** + /** * Get arrayOfString + * * @return arrayOfString - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<String> getArrayOfString() { return arrayOfString; } - public void setArrayOfString(List<String> arrayOfString) { this.arrayOfString = arrayOfString; } - public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { - + this.arrayArrayOfInteger = arrayArrayOfInteger; return this; } @@ -93,27 +81,25 @@ public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) return this; } - /** + /** * Get arrayArrayOfInteger + * * @return arrayArrayOfInteger - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<List<Long>> getArrayArrayOfInteger() { return arrayArrayOfInteger; } - public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { this.arrayArrayOfInteger = arrayArrayOfInteger; } - public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { - + this.arrayArrayOfModel = arrayArrayOfModel; return this; } @@ -126,25 +112,23 @@ public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelI return this; } - /** + /** * Get arrayArrayOfModel + * * @return arrayArrayOfModel - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<List<ReadOnlyFirst>> getArrayArrayOfModel() { return arrayArrayOfModel; } - public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { this.arrayArrayOfModel = arrayArrayOfModel; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -154,9 +138,9 @@ public boolean equals(java.lang.Object o) { return false; } ArrayTest arrayTest = (ArrayTest) o; - return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && - Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && - Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) + && Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) + && Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); } @Override @@ -164,21 +148,21 @@ public int hashCode() { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArrayTest {\n"); sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); - sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfInteger: ") + .append(toIndentedString(arrayArrayOfInteger)) + .append("\n"); sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -186,6 +170,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java deleted file mode 100644 index 84b3f05703b2..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCat.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * BigCat - */ -@JsonPropertyOrder({ - BigCat.JSON_PROPERTY_KIND -}) - -public class BigCat extends Cat { - /** - * Gets or Sets kind - */ - public enum KindEnum { - LIONS("lions"), - - TIGERS("tigers"), - - LEOPARDS("leopards"), - - JAGUARS("jaguars"); - - private String value; - - KindEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static KindEnum fromValue(String value) { - for (KindEnum b : KindEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } - - public static final String JSON_PROPERTY_KIND = "kind"; - private KindEnum kind; - - - public BigCat kind(KindEnum kind) { - - this.kind = kind; - return this; - } - - /** - * Get kind - * @return kind - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_KIND) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public KindEnum getKind() { - return kind; - } - - - public void setKind(KindEnum kind) { - this.kind = kind; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BigCat bigCat = (BigCat) o; - return Objects.equals(this.kind, bigCat.kind) && - super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(kind, super.hashCode()); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BigCat {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java deleted file mode 100644 index 7ce0ddb21f5a..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * BigCatAllOf - */ -@JsonPropertyOrder({ - BigCatAllOf.JSON_PROPERTY_KIND -}) - -public class BigCatAllOf { - /** - * Gets or Sets kind - */ - public enum KindEnum { - LIONS("lions"), - - TIGERS("tigers"), - - LEOPARDS("leopards"), - - JAGUARS("jaguars"); - - private String value; - - KindEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static KindEnum fromValue(String value) { - for (KindEnum b : KindEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - } - - public static final String JSON_PROPERTY_KIND = "kind"; - private KindEnum kind; - - - public BigCatAllOf kind(KindEnum kind) { - - this.kind = kind; - return this; - } - - /** - * Get kind - * @return kind - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_KIND) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public KindEnum getKind() { - return kind; - } - - - public void setKind(KindEnum kind) { - this.kind = kind; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BigCatAllOf bigCatAllOf = (BigCatAllOf) o; - return Objects.equals(this.kind, bigCatAllOf.kind); - } - - @Override - public int hashCode() { - return Objects.hash(kind); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BigCatAllOf {\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java index 033e97881105..a152526a20d8 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java @@ -3,29 +3,22 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * Capitalization - */ +/** Capitalization */ @JsonPropertyOrder({ Capitalization.JSON_PROPERTY_SMALL_CAMEL, Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, @@ -34,7 +27,6 @@ Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E }) - public class Capitalization { public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; private String smallCamel; @@ -54,157 +46,144 @@ public class Capitalization { public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; private String ATT_NAME; - public Capitalization smallCamel(String smallCamel) { - + this.smallCamel = smallCamel; return this; } - /** + /** * Get smallCamel + * * @return smallCamel - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSmallCamel() { return smallCamel; } - public void setSmallCamel(String smallCamel) { this.smallCamel = smallCamel; } - public Capitalization capitalCamel(String capitalCamel) { - + this.capitalCamel = capitalCamel; return this; } - /** + /** * Get capitalCamel + * * @return capitalCamel - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCapitalCamel() { return capitalCamel; } - public void setCapitalCamel(String capitalCamel) { this.capitalCamel = capitalCamel; } - public Capitalization smallSnake(String smallSnake) { - + this.smallSnake = smallSnake; return this; } - /** + /** * Get smallSnake + * * @return smallSnake - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getSmallSnake() { return smallSnake; } - public void setSmallSnake(String smallSnake) { this.smallSnake = smallSnake; } - public Capitalization capitalSnake(String capitalSnake) { - + this.capitalSnake = capitalSnake; return this; } - /** + /** * Get capitalSnake + * * @return capitalSnake - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCapitalSnake() { return capitalSnake; } - public void setCapitalSnake(String capitalSnake) { this.capitalSnake = capitalSnake; } - public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { - + this.scAETHFlowPoints = scAETHFlowPoints; return this; } - /** + /** * Get scAETHFlowPoints + * * @return scAETHFlowPoints - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getScAETHFlowPoints() { return scAETHFlowPoints; } - public void setScAETHFlowPoints(String scAETHFlowPoints) { this.scAETHFlowPoints = scAETHFlowPoints; } - public Capitalization ATT_NAME(String ATT_NAME) { - + this.ATT_NAME = ATT_NAME; return this; } - /** - * Name of the pet + /** + * Name of the pet + * * @return ATT_NAME - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Name of the pet ") @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getATTNAME() { return ATT_NAME; } - public void setATTNAME(String ATT_NAME) { this.ATT_NAME = ATT_NAME; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -214,20 +193,20 @@ public boolean equals(java.lang.Object o) { return false; } Capitalization capitalization = (Capitalization) o; - return Objects.equals(this.smallCamel, capitalization.smallCamel) && - Objects.equals(this.capitalCamel, capitalization.capitalCamel) && - Objects.equals(this.smallSnake, capitalization.smallSnake) && - Objects.equals(this.capitalSnake, capitalization.capitalSnake) && - Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && - Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + return Objects.equals(this.smallCamel, capitalization.smallCamel) + && Objects.equals(this.capitalCamel, capitalization.capitalCamel) + && Objects.equals(this.smallSnake, capitalization.smallSnake) + && Objects.equals(this.capitalSnake, capitalization.capitalSnake) + && Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) + && Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); } @Override public int hashCode() { - return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + return Objects.hash( + smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -243,8 +222,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -252,6 +230,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java index 484725c76fe0..ac0b84d82e4b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java @@ -3,65 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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.CatAllOf; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * Cat - */ -@JsonPropertyOrder({ - Cat.JSON_PROPERTY_DECLAWED -}) - +/** Cat */ +@JsonPropertyOrder({Cat.JSON_PROPERTY_DECLAWED}) public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; private Boolean declawed; - public Cat declawed(Boolean declawed) { - + this.declawed = declawed; return this; } - /** + /** * Get declawed + * * @return declawed - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DECLAWED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getDeclawed() { return declawed; } - public void setDeclawed(Boolean declawed) { this.declawed = declawed; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -71,8 +56,7 @@ public boolean equals(java.lang.Object o) { return false; } Cat cat = (Cat) o; - return Objects.equals(this.declawed, cat.declawed) && - super.equals(o); + return Objects.equals(this.declawed, cat.declawed) && super.equals(o); } @Override @@ -80,7 +64,6 @@ public int hashCode() { return Objects.hash(declawed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -92,8 +75,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -101,6 +83,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java index 3e7b991436aa..a7e4beaad66a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -3,63 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * CatAllOf - */ -@JsonPropertyOrder({ - CatAllOf.JSON_PROPERTY_DECLAWED -}) - +/** CatAllOf */ +@JsonPropertyOrder({CatAllOf.JSON_PROPERTY_DECLAWED}) public class CatAllOf { public static final String JSON_PROPERTY_DECLAWED = "declawed"; private Boolean declawed; - public CatAllOf declawed(Boolean declawed) { - + this.declawed = declawed; return this; } - /** + /** * Get declawed + * * @return declawed - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DECLAWED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getDeclawed() { return declawed; } - public void setDeclawed(Boolean declawed) { this.declawed = declawed; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,7 +64,6 @@ public int hashCode() { return Objects.hash(declawed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -88,8 +74,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -97,6 +82,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java index 868ba8750742..617b395ecfab 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java @@ -3,34 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * Category - */ -@JsonPropertyOrder({ - Category.JSON_PROPERTY_ID, - Category.JSON_PROPERTY_NAME -}) - +/** Category */ +@JsonPropertyOrder({Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME}) public class Category { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -38,56 +27,51 @@ public class Category { public static final String JSON_PROPERTY_NAME = "name"; private String name = "default-name"; - public Category id(Long id) { - + this.id = id; return this; } - /** + /** * Get id + * * @return id - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - public Category name(String name) { - + this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { return name; } - public void setName(String name) { this.name = name; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -97,8 +81,7 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(this.id, category.id) && Objects.equals(this.name, category.name); } @Override @@ -106,7 +89,6 @@ public int hashCode() { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -118,8 +100,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -127,6 +108,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java index 4de7664b26a7..13bf74694c85 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java @@ -3,64 +3,52 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * Model for testing model with \"_class\" property - */ +/** Model for testing model with \"_class\" property */ @ApiModel(description = "Model for testing model with \"_class\" property") -@JsonPropertyOrder({ - ClassModel.JSON_PROPERTY_PROPERTY_CLASS -}) - +@JsonPropertyOrder({ClassModel.JSON_PROPERTY_PROPERTY_CLASS}) public class ClassModel { public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; private String propertyClass; - public ClassModel propertyClass(String propertyClass) { - + this.propertyClass = propertyClass; return this; } - /** + /** * Get propertyClass + * * @return propertyClass - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPropertyClass() { return propertyClass; } - public void setPropertyClass(String propertyClass) { this.propertyClass = propertyClass; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,7 +66,6 @@ public int hashCode() { return Objects.hash(propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -89,8 +76,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -98,6 +84,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java index 02b0aac2247a..8aeda7b92c70 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java @@ -3,63 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * Client - */ -@JsonPropertyOrder({ - Client.JSON_PROPERTY_CLIENT -}) - +/** Client */ +@JsonPropertyOrder({Client.JSON_PROPERTY_CLIENT}) public class Client { public static final String JSON_PROPERTY_CLIENT = "client"; private String client; - public Client client(String client) { - + this.client = client; return this; } - /** + /** * Get client + * * @return client - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CLIENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getClient() { return client; } - public void setClient(String client) { this.client = client; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,7 +64,6 @@ public int hashCode() { return Objects.hash(client); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -88,8 +74,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -97,6 +82,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java index 78044654d500..7c8b535861c8 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java @@ -3,65 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * Dog - */ -@JsonPropertyOrder({ - Dog.JSON_PROPERTY_BREED -}) - +/** Dog */ +@JsonPropertyOrder({Dog.JSON_PROPERTY_BREED}) public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; private String breed; - public Dog breed(String breed) { - + this.breed = breed; return this; } - /** + /** * Get breed + * * @return breed - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BREED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBreed() { return breed; } - public void setBreed(String breed) { this.breed = breed; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -71,8 +56,7 @@ public boolean equals(java.lang.Object o) { return false; } Dog dog = (Dog) o; - return Objects.equals(this.breed, dog.breed) && - super.equals(o); + return Objects.equals(this.breed, dog.breed) && super.equals(o); } @Override @@ -80,7 +64,6 @@ public int hashCode() { return Objects.hash(breed, super.hashCode()); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -92,8 +75,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -101,6 +83,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java index dd42595cf202..d474f9b5b1b6 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -3,63 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * DogAllOf - */ -@JsonPropertyOrder({ - DogAllOf.JSON_PROPERTY_BREED -}) - +/** DogAllOf */ +@JsonPropertyOrder({DogAllOf.JSON_PROPERTY_BREED}) public class DogAllOf { public static final String JSON_PROPERTY_BREED = "breed"; private String breed; - public DogAllOf breed(String breed) { - + this.breed = breed; return this; } - /** + /** * Get breed + * * @return breed - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BREED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBreed() { return breed; } - public void setBreed(String breed) { this.breed = breed; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,7 +64,6 @@ public int hashCode() { return Objects.hash(breed); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -88,8 +74,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -97,6 +82,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java index aff182cd4983..8e72331cc30b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -3,43 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * EnumArrays - */ -@JsonPropertyOrder({ - EnumArrays.JSON_PROPERTY_JUST_SYMBOL, - EnumArrays.JSON_PROPERTY_ARRAY_ENUM -}) +import java.util.Objects; +/** EnumArrays */ +@JsonPropertyOrder({EnumArrays.JSON_PROPERTY_JUST_SYMBOL, EnumArrays.JSON_PROPERTY_ARRAY_ENUM}) public class EnumArrays { - /** - * Gets or Sets justSymbol - */ + /** Gets or Sets justSymbol */ public enum JustSymbolEnum { GREATER_THAN_OR_EQUAL_TO(">="), - + DOLLAR("$"); private String value; @@ -72,12 +61,10 @@ public static JustSymbolEnum fromValue(String value) { public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; private JustSymbolEnum justSymbol; - /** - * Gets or Sets arrayEnum - */ + /** Gets or Sets arrayEnum */ public enum ArrayEnumEnum { FISH("fish"), - + CRAB("crab"); private String value; @@ -110,34 +97,31 @@ public static ArrayEnumEnum fromValue(String value) { public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; private List<ArrayEnumEnum> arrayEnum = null; - public EnumArrays justSymbol(JustSymbolEnum justSymbol) { - + this.justSymbol = justSymbol; return this; } - /** + /** * Get justSymbol + * * @return justSymbol - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JustSymbolEnum getJustSymbol() { return justSymbol; } - public void setJustSymbol(JustSymbolEnum justSymbol) { this.justSymbol = justSymbol; } - public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) { - + this.arrayEnum = arrayEnum; return this; } @@ -150,25 +134,23 @@ public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { return this; } - /** + /** * Get arrayEnum + * * @return arrayEnum - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<ArrayEnumEnum> getArrayEnum() { return arrayEnum; } - public void setArrayEnum(List<ArrayEnumEnum> arrayEnum) { this.arrayEnum = arrayEnum; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -178,8 +160,8 @@ public boolean equals(java.lang.Object o) { return false; } EnumArrays enumArrays = (EnumArrays) o; - return Objects.equals(this.justSymbol, enumArrays.justSymbol) && - Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + return Objects.equals(this.justSymbol, enumArrays.justSymbol) + && Objects.equals(this.arrayEnum, enumArrays.arrayEnum); } @Override @@ -187,7 +169,6 @@ public int hashCode() { return Objects.hash(justSymbol, arrayEnum); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -199,8 +180,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -208,6 +188,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java index e9102d974276..f1f1c4348c94 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java @@ -3,32 +3,25 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** - * Gets or Sets EnumClass - */ +/** Gets or Sets EnumClass */ public enum EnumClass { - _ABC("_abc"), - + _EFG("-efg"), - + _XYZ_("(xyz)"); private String value; @@ -57,4 +50,3 @@ public static EnumClass fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java index 51a1a645a109..f58b5a2d335d 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java @@ -3,47 +3,43 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.openapitools.client.model.OuterEnum; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; -/** - * EnumTest - */ +/** EnumTest */ @JsonPropertyOrder({ EnumTest.JSON_PROPERTY_ENUM_STRING, EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, EnumTest.JSON_PROPERTY_ENUM_INTEGER, EnumTest.JSON_PROPERTY_ENUM_NUMBER, - EnumTest.JSON_PROPERTY_OUTER_ENUM + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE }) - public class EnumTest { - /** - * Gets or Sets enumString - */ + /** Gets or Sets enumString */ public enum EnumStringEnum { UPPER("UPPER"), - + LOWER("lower"), - + EMPTY(""); private String value; @@ -76,14 +72,12 @@ public static EnumStringEnum fromValue(String value) { public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; private EnumStringEnum enumString; - /** - * Gets or Sets enumStringRequired - */ + /** Gets or Sets enumStringRequired */ public enum EnumStringRequiredEnum { UPPER("UPPER"), - + LOWER("lower"), - + EMPTY(""); private String value; @@ -116,12 +110,10 @@ public static EnumStringRequiredEnum fromValue(String value) { public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; private EnumStringRequiredEnum enumStringRequired; - /** - * Gets or Sets enumInteger - */ + /** Gets or Sets enumInteger */ public enum EnumIntegerEnum { NUMBER_1(1), - + NUMBER_MINUS_1(-1); private Integer value; @@ -154,12 +146,10 @@ public static EnumIntegerEnum fromValue(Integer value) { public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; private EnumIntegerEnum enumInteger; - /** - * Gets or Sets enumNumber - */ + /** Gets or Sets enumNumber */ public enum EnumNumberEnum { NUMBER_1_DOT_1(1.1), - + NUMBER_MINUS_1_DOT_2(-1.2); private Double value; @@ -193,132 +183,213 @@ public static EnumNumberEnum fromValue(Double value) { private EnumNumberEnum enumNumber; public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; - private OuterEnum outerEnum; + private JsonNullable<OuterEnum> outerEnum = JsonNullable.<OuterEnum>undefined(); + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = + "outerEnumIntegerDefaultValue"; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = + OuterEnumIntegerDefaultValue.NUMBER_0; public EnumTest enumString(EnumStringEnum enumString) { - + this.enumString = enumString; return this; } - /** + /** * Get enumString + * * @return enumString - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ENUM_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EnumStringEnum getEnumString() { return enumString; } - public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } - public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { - + this.enumStringRequired = enumStringRequired; return this; } - /** + /** * Get enumStringRequired + * * @return enumStringRequired - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } - public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { this.enumStringRequired = enumStringRequired; } - public EnumTest enumInteger(EnumIntegerEnum enumInteger) { - + this.enumInteger = enumInteger; return this; } - /** + /** * Get enumInteger + * * @return enumInteger - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EnumIntegerEnum getEnumInteger() { return enumInteger; } - public void setEnumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; } - public EnumTest enumNumber(EnumNumberEnum enumNumber) { - + this.enumNumber = enumNumber; return this; } - /** + /** * Get enumNumber + * * @return enumNumber - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public EnumNumberEnum getEnumNumber() { return enumNumber; } - public void setEnumNumber(EnumNumberEnum enumNumber) { this.enumNumber = enumNumber; } - public EnumTest outerEnum(OuterEnum outerEnum) { - - this.outerEnum = outerEnum; + this.outerEnum = JsonNullable.<OuterEnum>of(outerEnum); + return this; } - /** + /** * Get outerEnum + * * @return outerEnum - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonIgnore + public OuterEnum getOuterEnum() { + return outerEnum.orElse(null); + } + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public OuterEnum getOuterEnum() { + public JsonNullable<OuterEnum> getOuterEnum_JsonNullable() { return outerEnum; } + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + public void setOuterEnum_JsonNullable(JsonNullable<OuterEnum> outerEnum) { + this.outerEnum = outerEnum; + } public void setOuterEnum(OuterEnum outerEnum) { - this.outerEnum = outerEnum; + this.outerEnum = JsonNullable.<OuterEnum>of(outerEnum); + } + + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * + * @return outerEnumInteger + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * + * @return outerEnumDefaultValue + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + public EnumTest outerEnumIntegerDefaultValue( + OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; } + /** + * Get outerEnumIntegerDefaultValue + * + * @return outerEnumIntegerDefaultValue + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + public void setOuterEnumIntegerDefaultValue( + OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } @Override public boolean equals(java.lang.Object o) { @@ -329,19 +400,29 @@ public boolean equals(java.lang.Object o) { return false; } EnumTest enumTest = (EnumTest) o; - return Objects.equals(this.enumString, enumTest.enumString) && - Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && - Objects.equals(this.enumInteger, enumTest.enumInteger) && - Objects.equals(this.enumNumber, enumTest.enumNumber) && - Objects.equals(this.outerEnum, enumTest.outerEnum); + return Objects.equals(this.enumString, enumTest.enumString) + && Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) + && Objects.equals(this.enumInteger, enumTest.enumInteger) + && Objects.equals(this.enumNumber, enumTest.enumNumber) + && Objects.equals(this.outerEnum, enumTest.outerEnum) + && Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) + && Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) + && Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); } @Override public int hashCode() { - return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + return Objects.hash( + enumString, + enumStringRequired, + enumInteger, + enumNumber, + outerEnum, + outerEnumInteger, + outerEnumDefaultValue, + outerEnumIntegerDefaultValue); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -351,13 +432,19 @@ public String toString() { sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ") + .append(toIndentedString(outerEnumDefaultValue)) + .append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ") + .append(toIndentedString(outerEnumIntegerDefaultValue)) + .append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -365,6 +452,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index 8166597792d0..e596551a7714 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -3,36 +3,28 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * FileSchemaTestClass - */ +/** FileSchemaTestClass */ @JsonPropertyOrder({ FileSchemaTestClass.JSON_PROPERTY_FILE, FileSchemaTestClass.JSON_PROPERTY_FILES }) - public class FileSchemaTestClass { public static final String JSON_PROPERTY_FILE = "file"; private java.io.File file; @@ -40,34 +32,31 @@ public class FileSchemaTestClass { public static final String JSON_PROPERTY_FILES = "files"; private List<java.io.File> files = null; - public FileSchemaTestClass file(java.io.File file) { - + this.file = file; return this; } - /** + /** * Get file + * * @return file - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public java.io.File getFile() { return file; } - public void setFile(java.io.File file) { this.file = file; } - public FileSchemaTestClass files(List<java.io.File> files) { - + this.files = files; return this; } @@ -80,25 +69,23 @@ public FileSchemaTestClass addFilesItem(java.io.File filesItem) { return this; } - /** + /** * Get files + * * @return files - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<java.io.File> getFiles() { return files; } - public void setFiles(List<java.io.File> files) { this.files = files; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -108,8 +95,8 @@ public boolean equals(java.lang.Object o) { return false; } FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; - return Objects.equals(this.file, fileSchemaTestClass.file) && - Objects.equals(this.files, fileSchemaTestClass.files); + return Objects.equals(this.file, fileSchemaTestClass.file) + && Objects.equals(this.files, fileSchemaTestClass.files); } @Override @@ -117,7 +104,6 @@ public int hashCode() { return Objects.hash(file, files); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -129,8 +115,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -138,6 +123,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java similarity index 53% rename from samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java rename to samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java index ed080254966e..8dddfe49d020 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java @@ -3,65 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * AdditionalPropertiesString - */ -@JsonPropertyOrder({ - AdditionalPropertiesString.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesString extends HashMap<String, String> { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; +/** Foo */ +@JsonPropertyOrder({Foo.JSON_PROPERTY_BAR}) +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar = "bar"; + public Foo bar(String bar) { - public AdditionalPropertiesString name(String name) { - - this.name = name; + this.bar = bar; return this; } - /** - * Get name - * @return name - **/ + /** + * Get bar + * + * @return bar + */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) + @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; + public String getBar() { + return bar; } - - public void setName(String name) { - this.name = name; + public void setBar(String bar) { + this.bar = bar; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -70,30 +55,26 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; - return Objects.equals(this.name, additionalPropertiesString.name) && - super.equals(o); + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(bar); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesString {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -101,6 +82,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java index 4dee7f6c9dcc..bbecfc092727 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java @@ -3,34 +3,28 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Objects; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** - * FormatTest - */ +/** FormatTest */ @JsonPropertyOrder({ FormatTest.JSON_PROPERTY_INTEGER, FormatTest.JSON_PROPERTY_INT32, @@ -45,9 +39,9 @@ FormatTest.JSON_PROPERTY_DATE_TIME, FormatTest.JSON_PROPERTY_UUID, FormatTest.JSON_PROPERTY_PASSWORD, - FormatTest.JSON_PROPERTY_BIG_DECIMAL + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER }) - public class FormatTest { public static final String JSON_PROPERTY_INTEGER = "integer"; private Integer integer; @@ -88,365 +82,356 @@ public class FormatTest { public static final String JSON_PROPERTY_PASSWORD = "password"; private String password; - public static final String JSON_PROPERTY_BIG_DECIMAL = "BigDecimal"; - private BigDecimal bigDecimal; + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + private String patternWithDigits; + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = + "pattern_with_digits_and_delimiter"; + private String patternWithDigitsAndDelimiter; public FormatTest integer(Integer integer) { - + this.integer = integer; return this; } - /** - * Get integer - * minimum: 10 - * maximum: 100 + /** + * Get integer minimum: 10 maximum: 100 + * * @return integer - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getInteger() { return integer; } - public void setInteger(Integer integer) { this.integer = integer; } - public FormatTest int32(Integer int32) { - + this.int32 = int32; return this; } - /** - * Get int32 - * minimum: 20 - * maximum: 200 + /** + * Get int32 minimum: 20 maximum: 200 + * * @return int32 - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INT32) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getInt32() { return int32; } - public void setInt32(Integer int32) { this.int32 = int32; } - public FormatTest int64(Long int64) { - + this.int64 = int64; return this; } - /** + /** * Get int64 + * * @return int64 - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INT64) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getInt64() { return int64; } - public void setInt64(Long int64) { this.int64 = int64; } - public FormatTest number(BigDecimal number) { - + this.number = number; return this; } - /** - * Get number - * minimum: 32.1 - * maximum: 543.2 + /** + * Get number minimum: 32.1 maximum: 543.2 + * * @return number - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_NUMBER) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public BigDecimal getNumber() { return number; } - public void setNumber(BigDecimal number) { this.number = number; } - public FormatTest _float(Float _float) { - + this._float = _float; return this; } - /** - * Get _float - * minimum: 54.3 - * maximum: 987.6 + /** + * Get _float minimum: 54.3 maximum: 987.6 + * * @return _float - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FLOAT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Float getFloat() { return _float; } - public void setFloat(Float _float) { this._float = _float; } - public FormatTest _double(Double _double) { - + this._double = _double; return this; } - /** - * Get _double - * minimum: 67.8 - * maximum: 123.4 + /** + * Get _double minimum: 67.8 maximum: 123.4 + * * @return _double - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DOUBLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Double getDouble() { return _double; } - public void setDouble(Double _double) { this._double = _double; } - public FormatTest string(String string) { - + this.string = string; return this; } - /** + /** * Get string + * * @return string - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getString() { return string; } - public void setString(String string) { this.string = string; } - public FormatTest _byte(byte[] _byte) { - + this._byte = _byte; return this; } - /** + /** * Get _byte + * * @return _byte - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_BYTE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public byte[] getByte() { return _byte; } - public void setByte(byte[] _byte) { this._byte = _byte; } - public FormatTest binary(File binary) { - + this.binary = binary; return this; } - /** + /** * Get binary + * * @return binary - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BINARY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public File getBinary() { return binary; } - public void setBinary(File binary) { this.binary = binary; } - public FormatTest date(LocalDate date) { - + this.date = date; return this; } - /** + /** * Get date + * * @return date - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_DATE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public LocalDate getDate() { return date; } - public void setDate(LocalDate date) { this.date = date; } - public FormatTest dateTime(OffsetDateTime dateTime) { - + this.dateTime = dateTime; return this; } - /** + /** * Get dateTime + * * @return dateTime - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DATE_TIME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getDateTime() { return dateTime; } - public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } - public FormatTest uuid(UUID uuid) { - + this.uuid = uuid; return this; } - /** + /** * Get uuid + * * @return uuid - **/ + */ @javax.annotation.Nullable @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") @JsonProperty(JSON_PROPERTY_UUID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UUID getUuid() { return uuid; } - public void setUuid(UUID uuid) { this.uuid = uuid; } - public FormatTest password(String password) { - + this.password = password; return this; } - /** + /** * Get password + * * @return password - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } + public FormatTest patternWithDigits(String patternWithDigits) { - public FormatTest bigDecimal(BigDecimal bigDecimal) { - - this.bigDecimal = bigDecimal; + this.patternWithDigits = patternWithDigits; return this; } - /** - * Get bigDecimal - * @return bigDecimal - **/ + /** + * A string that is a 10 digit number. Can have leading zeros. + * + * @return patternWithDigits + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPatternWithDigits() { + return patternWithDigits; + } - public BigDecimal getBigDecimal() { - return bigDecimal; + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; } + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } - public void setBigDecimal(BigDecimal bigDecimal) { - this.bigDecimal = bigDecimal; + /** + * A string starting with 'image_' (case insensitive) and one to three digits following + * i.e. Image_01. + * + * @return patternWithDigitsAndDelimiter + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = + "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; } + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } @Override public boolean equals(java.lang.Object o) { @@ -457,28 +442,44 @@ public boolean equals(java.lang.Object o) { return false; } FormatTest formatTest = (FormatTest) o; - return Objects.equals(this.integer, formatTest.integer) && - Objects.equals(this.int32, formatTest.int32) && - Objects.equals(this.int64, formatTest.int64) && - Objects.equals(this.number, formatTest.number) && - Objects.equals(this._float, formatTest._float) && - Objects.equals(this._double, formatTest._double) && - Objects.equals(this.string, formatTest.string) && - Arrays.equals(this._byte, formatTest._byte) && - Objects.equals(this.binary, formatTest.binary) && - Objects.equals(this.date, formatTest.date) && - Objects.equals(this.dateTime, formatTest.dateTime) && - Objects.equals(this.uuid, formatTest.uuid) && - Objects.equals(this.password, formatTest.password) && - Objects.equals(this.bigDecimal, formatTest.bigDecimal); + return Objects.equals(this.integer, formatTest.integer) + && Objects.equals(this.int32, formatTest.int32) + && Objects.equals(this.int64, formatTest.int64) + && Objects.equals(this.number, formatTest.number) + && Objects.equals(this._float, formatTest._float) + && Objects.equals(this._double, formatTest._double) + && Objects.equals(this.string, formatTest.string) + && Arrays.equals(this._byte, formatTest._byte) + && Objects.equals(this.binary, formatTest.binary) + && Objects.equals(this.date, formatTest.date) + && Objects.equals(this.dateTime, formatTest.dateTime) + && Objects.equals(this.uuid, formatTest.uuid) + && Objects.equals(this.password, formatTest.password) + && Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) + && Objects.equals( + this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_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, + patternWithDigits, + patternWithDigitsAndDelimiter); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -496,14 +497,16 @@ public String toString() { sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ") + .append(toIndentedString(patternWithDigitsAndDelimiter)) + .append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -511,6 +514,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 0a3f0d464360..24bbe4252c51 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -3,34 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * HasOnlyReadOnly - */ -@JsonPropertyOrder({ - HasOnlyReadOnly.JSON_PROPERTY_BAR, - HasOnlyReadOnly.JSON_PROPERTY_FOO -}) - +/** HasOnlyReadOnly */ +@JsonPropertyOrder({HasOnlyReadOnly.JSON_PROPERTY_BAR, HasOnlyReadOnly.JSON_PROPERTY_FOO}) public class HasOnlyReadOnly { public static final String JSON_PROPERTY_BAR = "bar"; private String bar; @@ -38,39 +27,32 @@ public class HasOnlyReadOnly { public static final String JSON_PROPERTY_FOO = "foo"; private String foo; - - /** + /** * Get bar + * * @return bar - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBar() { return bar; } - - - - /** + /** * Get foo + * * @return foo - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FOO) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFoo() { return foo; } - - - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -80,8 +62,8 @@ public boolean equals(java.lang.Object o) { return false; } HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; - return Objects.equals(this.bar, hasOnlyReadOnly.bar) && - Objects.equals(this.foo, hasOnlyReadOnly.foo); + return Objects.equals(this.bar, hasOnlyReadOnly.bar) + && Objects.equals(this.foo, hasOnlyReadOnly.foo); } @Override @@ -89,7 +71,6 @@ public int hashCode() { return Objects.hash(bar, foo); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -101,8 +82,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -110,6 +90,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..acaf6793dc26 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,104 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer + * in generated model. + */ +@ApiModel( + description = + "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonPropertyOrder({HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE}) +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + private JsonNullable<String> nullableMessage = JsonNullable.<String>undefined(); + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.<String>of(nullableMessage); + + return this; + } + + /** + * Get nullableMessage + * + * @return nullableMessage + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public String getNullableMessage() { + return nullableMessage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<String> getNullableMessage_JsonNullable() { + return nullableMessage; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + public void setNullableMessage_JsonNullable(JsonNullable<String> nullableMessage) { + this.nullableMessage = nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.<String>of(nullableMessage); + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java similarity index 59% rename from samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java rename to samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java index 0f1223c2bc61..1141c6634853 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java @@ -3,64 +3,75 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * AdditionalPropertiesAnyType - */ -@JsonPropertyOrder({ - AdditionalPropertiesAnyType.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesAnyType extends HashMap<String, Object> { +/** InlineObject */ +@JsonPropertyOrder({InlineObject.JSON_PROPERTY_NAME, InlineObject.JSON_PROPERTY_STATUS}) +public class InlineObject { public static final String JSON_PROPERTY_NAME = "name"; private String name; + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public InlineObject name(String name) { - public AdditionalPropertiesAnyType name(String name) { - this.name = name; return this; } - /** - * Get name + /** + * Updated name of the pet + * * @return name - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") + @ApiModelProperty(value = "Updated name of the pet") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { return name; } - public void setName(String name) { this.name = name; } + public InlineObject status(String status) { + + this.status = status; + return this; + } + + /** + * Updated status of the pet + * + * @return status + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Updated status of the pet") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } @Override public boolean equals(java.lang.Object o) { @@ -70,30 +81,28 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; - return Objects.equals(this.name, additionalPropertiesAnyType.name) && - super.equals(o); + InlineObject inlineObject = (InlineObject) o; + return Objects.equals(this.name, inlineObject.name) + && Objects.equals(this.status, inlineObject.status); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(name, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesAnyType {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("class InlineObject {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -101,6 +110,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java new file mode 100644 index 000000000000..2bf1fade373c --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.util.Objects; + +/** InlineObject1 */ +@JsonPropertyOrder({ + InlineObject1.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject1.JSON_PROPERTY_FILE +}) +public class InlineObject1 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_FILE = "file"; + private File file; + + public InlineObject1 additionalMetadata(String additionalMetadata) { + + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * + * @return additionalMetadata + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAdditionalMetadata() { + return additionalMetadata; + } + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + public InlineObject1 file(File file) { + + this.file = file; + return this; + } + + /** + * file to upload + * + * @return file + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "file to upload") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getFile() { + return file; + } + + public void setFile(File file) { + this.file = file; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject1 inlineObject1 = (InlineObject1) o; + return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) + && Objects.equals(this.file, inlineObject1.file); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, file); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject1 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java new file mode 100644 index 000000000000..92639fccaeff --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java @@ -0,0 +1,198 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** InlineObject2 */ +@JsonPropertyOrder({ + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING_ARRAY, + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING +}) +public class InlineObject2 { + /** Gets or Sets enumFormStringArray */ + public enum EnumFormStringArrayEnum { + GREATER_THAN(">"), + + DOLLAR("$"); + + private String value; + + EnumFormStringArrayEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringArrayEnum fromValue(String value) { + for (EnumFormStringArrayEnum b : EnumFormStringArrayEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING_ARRAY = "enum_form_string_array"; + private List<EnumFormStringArrayEnum> enumFormStringArray = null; + + /** Form parameter enum test (string) */ + public enum EnumFormStringEnum { + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumFormStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringEnum fromValue(String value) { + for (EnumFormStringEnum b : EnumFormStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING = "enum_form_string"; + private EnumFormStringEnum enumFormString = EnumFormStringEnum._EFG; + + public InlineObject2 enumFormStringArray(List<EnumFormStringArrayEnum> enumFormStringArray) { + + this.enumFormStringArray = enumFormStringArray; + return this; + } + + public InlineObject2 addEnumFormStringArrayItem(EnumFormStringArrayEnum enumFormStringArrayItem) { + if (this.enumFormStringArray == null) { + this.enumFormStringArray = new ArrayList<EnumFormStringArrayEnum>(); + } + this.enumFormStringArray.add(enumFormStringArrayItem); + return this; + } + + /** + * Form parameter enum test (string array) + * + * @return enumFormStringArray + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string array)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<EnumFormStringArrayEnum> getEnumFormStringArray() { + return enumFormStringArray; + } + + public void setEnumFormStringArray(List<EnumFormStringArrayEnum> enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + } + + public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + + this.enumFormString = enumFormString; + return this; + } + + /** + * Form parameter enum test (string) + * + * @return enumFormString + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumFormStringEnum getEnumFormString() { + return enumFormString; + } + + public void setEnumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject2 inlineObject2 = (InlineObject2) o; + return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) + && Objects.equals(this.enumFormString, inlineObject2.enumFormString); + } + + @Override + public int hashCode() { + return Objects.hash(enumFormStringArray, enumFormString); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject2 {\n"); + sb.append(" enumFormStringArray: ") + .append(toIndentedString(enumFormStringArray)) + .append("\n"); + sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java new file mode 100644 index 000000000000..e95a6cbf369d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java @@ -0,0 +1,481 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Objects; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +/** InlineObject3 */ +@JsonPropertyOrder({ + InlineObject3.JSON_PROPERTY_INTEGER, + InlineObject3.JSON_PROPERTY_INT32, + InlineObject3.JSON_PROPERTY_INT64, + InlineObject3.JSON_PROPERTY_NUMBER, + InlineObject3.JSON_PROPERTY_FLOAT, + InlineObject3.JSON_PROPERTY_DOUBLE, + InlineObject3.JSON_PROPERTY_STRING, + InlineObject3.JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER, + InlineObject3.JSON_PROPERTY_BYTE, + InlineObject3.JSON_PROPERTY_BINARY, + InlineObject3.JSON_PROPERTY_DATE, + InlineObject3.JSON_PROPERTY_DATE_TIME, + InlineObject3.JSON_PROPERTY_PASSWORD, + InlineObject3.JSON_PROPERTY_CALLBACK +}) +public class InlineObject3 { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER = "pattern_without_delimiter"; + private String patternWithoutDelimiter; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_CALLBACK = "callback"; + private String callback; + + public InlineObject3 integer(Integer integer) { + + this.integer = integer; + return this; + } + + /** + * None minimum: 10 maximum: 100 + * + * @return integer + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public InlineObject3 int32(Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * None minimum: 20 maximum: 200 + * + * @return int32 + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public InlineObject3 int64(Long int64) { + + this.int64 = int64; + return this; + } + + /** + * None + * + * @return int64 + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public InlineObject3 number(BigDecimal number) { + + this.number = number; + return this; + } + + /** + * None minimum: 32.1 maximum: 543.2 + * + * @return number + */ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public InlineObject3 _float(Float _float) { + + this._float = _float; + return this; + } + + /** + * None maximum: 987.6 + * + * @return _float + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public InlineObject3 _double(Double _double) { + + this._double = _double; + return this; + } + + /** + * None minimum: 67.8 maximum: 123.4 + * + * @return _double + */ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public InlineObject3 string(String string) { + + this.string = string; + return this; + } + + /** + * None + * + * @return string + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + + this.patternWithoutDelimiter = patternWithoutDelimiter; + return this; + } + + /** + * None + * + * @return patternWithoutDelimiter + */ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPatternWithoutDelimiter() { + return patternWithoutDelimiter; + } + + public void setPatternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + } + + public InlineObject3 _byte(byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * None + * + * @return _byte + */ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public InlineObject3 binary(File binary) { + + this.binary = binary; + return this; + } + + /** + * None + * + * @return binary + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public InlineObject3 date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * None + * + * @return date + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public InlineObject3 dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * None + * + * @return dateTime + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public InlineObject3 password(String password) { + + this.password = password; + return this; + } + + /** + * None + * + * @return password + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public InlineObject3 callback(String callback) { + + this.callback = callback; + return this; + } + + /** + * None + * + * @return callback + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_CALLBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCallback() { + return callback; + } + + public void setCallback(String callback) { + this.callback = callback; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject3 inlineObject3 = (InlineObject3) o; + return Objects.equals(this.integer, inlineObject3.integer) + && Objects.equals(this.int32, inlineObject3.int32) + && Objects.equals(this.int64, inlineObject3.int64) + && Objects.equals(this.number, inlineObject3.number) + && Objects.equals(this._float, inlineObject3._float) + && Objects.equals(this._double, inlineObject3._double) + && Objects.equals(this.string, inlineObject3.string) + && Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) + && Arrays.equals(this._byte, inlineObject3._byte) + && Objects.equals(this.binary, inlineObject3.binary) + && Objects.equals(this.date, inlineObject3.date) + && Objects.equals(this.dateTime, inlineObject3.dateTime) + && Objects.equals(this.password, inlineObject3.password) + && Objects.equals(this.callback, inlineObject3.callback); + } + + @Override + public int hashCode() { + return Objects.hash( + integer, + int32, + int64, + number, + _float, + _double, + string, + patternWithoutDelimiter, + Arrays.hashCode(_byte), + binary, + date, + dateTime, + password, + callback); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject3 {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" patternWithoutDelimiter: ") + .append(toIndentedString(patternWithoutDelimiter)) + .append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" callback: ").append(toIndentedString(callback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java new file mode 100644 index 000000000000..8704fc9a4b1b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java @@ -0,0 +1,111 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; + +/** InlineObject4 */ +@JsonPropertyOrder({InlineObject4.JSON_PROPERTY_PARAM, InlineObject4.JSON_PROPERTY_PARAM2}) +public class InlineObject4 { + public static final String JSON_PROPERTY_PARAM = "param"; + private String param; + + public static final String JSON_PROPERTY_PARAM2 = "param2"; + private String param2; + + public InlineObject4 param(String param) { + + this.param = param; + return this; + } + + /** + * field1 + * + * @return param + */ + @ApiModelProperty(required = true, value = "field1") + @JsonProperty(JSON_PROPERTY_PARAM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getParam() { + return param; + } + + public void setParam(String param) { + this.param = param; + } + + public InlineObject4 param2(String param2) { + + this.param2 = param2; + return this; + } + + /** + * field2 + * + * @return param2 + */ + @ApiModelProperty(required = true, value = "field2") + @JsonProperty(JSON_PROPERTY_PARAM2) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getParam2() { + return param2; + } + + public void setParam2(String param2) { + this.param2 = param2; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject4 inlineObject4 = (InlineObject4) o; + return Objects.equals(this.param, inlineObject4.param) + && Objects.equals(this.param2, inlineObject4.param2); + } + + @Override + public int hashCode() { + return Objects.hash(param, param2); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject4 {\n"); + sb.append(" param: ").append(toIndentedString(param)).append("\n"); + sb.append(" param2: ").append(toIndentedString(param2)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java new file mode 100644 index 000000000000..d5426d00c120 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java @@ -0,0 +1,116 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.util.Objects; + +/** InlineObject5 */ +@JsonPropertyOrder({ + InlineObject5.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject5.JSON_PROPERTY_REQUIRED_FILE +}) +public class InlineObject5 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_REQUIRED_FILE = "requiredFile"; + private File requiredFile; + + public InlineObject5 additionalMetadata(String additionalMetadata) { + + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * + * @return additionalMetadata + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAdditionalMetadata() { + return additionalMetadata; + } + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + public InlineObject5 requiredFile(File requiredFile) { + + this.requiredFile = requiredFile; + return this; + } + + /** + * file to upload + * + * @return requiredFile + */ + @ApiModelProperty(required = true, value = "file to upload") + @JsonProperty(JSON_PROPERTY_REQUIRED_FILE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public File getRequiredFile() { + return requiredFile; + } + + public void setRequiredFile(File requiredFile) { + this.requiredFile = requiredFile; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject5 inlineObject5 = (InlineObject5) o; + return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) + && Objects.equals(this.requiredFile, inlineObject5.requiredFile); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, requiredFile); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject5 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" requiredFile: ").append(toIndentedString(requiredFile)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java similarity index 53% rename from samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java rename to samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java index 5e468870311e..f9e010ddc702 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java @@ -3,65 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * AdditionalPropertiesObject - */ -@JsonPropertyOrder({ - AdditionalPropertiesObject.JSON_PROPERTY_NAME -}) - -public class AdditionalPropertiesObject extends HashMap<String, Map> { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; +/** InlineResponseDefault */ +@JsonPropertyOrder({InlineResponseDefault.JSON_PROPERTY_STRING}) +public class InlineResponseDefault { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; + public InlineResponseDefault string(Foo string) { - public AdditionalPropertiesObject name(String name) { - - this.name = name; + this.string = string; return this; } - /** - * Get name - * @return name - **/ + /** + * Get string + * + * @return string + */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) + @JsonProperty(JSON_PROPERTY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; + public Foo getString() { + return string; } - - public void setName(String name) { - this.name = name; + public void setString(Foo string) { + this.string = string; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -70,30 +55,26 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; - return Objects.equals(this.name, additionalPropertiesObject.name) && - super.equals(o); + InlineResponseDefault inlineResponseDefault = (InlineResponseDefault) o; + return Objects.equals(this.string, inlineResponseDefault.string); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(string); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesObject {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("class InlineResponseDefault {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -101,6 +82,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java index 113f92dd9cbe..d5d3dfe599d7 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java @@ -3,49 +3,40 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; 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 com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * MapTest - */ +/** MapTest */ @JsonPropertyOrder({ MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, MapTest.JSON_PROPERTY_DIRECT_MAP, MapTest.JSON_PROPERTY_INDIRECT_MAP }) - public class MapTest { public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; private Map<String, Map<String, String>> mapMapOfString = null; - /** - * Gets or Sets inner - */ + /** Gets or Sets inner */ public enum InnerEnum { UPPER("UPPER"), - + LOWER("lower"); private String value; @@ -84,9 +75,8 @@ public static InnerEnum fromValue(String value) { public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; private Map<String, Boolean> indirectMap = null; - public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) { - + this.mapMapOfString = mapMapOfString; return this; } @@ -99,27 +89,25 @@ public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStr return this; } - /** + /** * Get mapMapOfString + * * @return mapMapOfString - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map<String, Map<String, String>> getMapMapOfString() { return mapMapOfString; } - public void setMapMapOfString(Map<String, Map<String, String>> mapMapOfString) { this.mapMapOfString = mapMapOfString; } - public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { - + this.mapOfEnumString = mapOfEnumString; return this; } @@ -132,27 +120,25 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - /** + /** * Get mapOfEnumString + * * @return mapOfEnumString - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map<String, InnerEnum> getMapOfEnumString() { return mapOfEnumString; } - public void setMapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { this.mapOfEnumString = mapOfEnumString; } - public MapTest directMap(Map<String, Boolean> directMap) { - + this.directMap = directMap; return this; } @@ -165,27 +151,25 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - /** + /** * Get directMap + * * @return directMap - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DIRECT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map<String, Boolean> getDirectMap() { return directMap; } - public void setDirectMap(Map<String, Boolean> directMap) { this.directMap = directMap; } - public MapTest indirectMap(Map<String, Boolean> indirectMap) { - + this.indirectMap = indirectMap; return this; } @@ -198,25 +182,23 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - /** + /** * Get indirectMap + * * @return indirectMap - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map<String, Boolean> getIndirectMap() { return indirectMap; } - public void setIndirectMap(Map<String, Boolean> indirectMap) { this.indirectMap = indirectMap; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -226,10 +208,10 @@ public boolean equals(java.lang.Object o) { return false; } MapTest mapTest = (MapTest) o; - return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && - Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && - Objects.equals(this.directMap, mapTest.directMap) && - Objects.equals(this.indirectMap, mapTest.indirectMap); + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) + && Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) + && Objects.equals(this.directMap, mapTest.directMap) + && Objects.equals(this.indirectMap, mapTest.indirectMap); } @Override @@ -237,7 +219,6 @@ public int hashCode() { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -251,8 +232,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -260,6 +240,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index d483d69700f8..9a30d1299f9f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -3,41 +3,31 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; -import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.UUID; -import org.openapitools.client.model.Animal; import org.threeten.bp.OffsetDateTime; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** - * MixedPropertiesAndAdditionalPropertiesClass - */ +/** MixedPropertiesAndAdditionalPropertiesClass */ @JsonPropertyOrder({ MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP }) - public class MixedPropertiesAndAdditionalPropertiesClass { public static final String JSON_PROPERTY_UUID = "uuid"; private UUID uuid; @@ -48,59 +38,54 @@ public class MixedPropertiesAndAdditionalPropertiesClass { public static final String JSON_PROPERTY_MAP = "map"; private Map<String, Animal> map = null; - public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { - + this.uuid = uuid; return this; } - /** + /** * Get uuid + * * @return uuid - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_UUID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public UUID getUuid() { return uuid; } - public void setUuid(UUID uuid) { this.uuid = uuid; } - public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { - + this.dateTime = dateTime; return this; } - /** + /** * Get dateTime + * * @return dateTime - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DATE_TIME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getDateTime() { return dateTime; } - public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } - public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) { - + this.map = map; return this; } @@ -113,25 +98,23 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - /** + /** * Get map + * * @return map - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map<String, Animal> getMap() { return map; } - public void setMap(Map<String, Animal> map) { this.map = map; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -140,10 +123,11 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; - return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && - Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && - Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = + (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) + && Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) + && Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); } @Override @@ -151,7 +135,6 @@ public int hashCode() { return Objects.hash(uuid, dateTime, map); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -164,8 +147,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -173,6 +155,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java index dd99468a0059..b3972c060311 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java @@ -3,35 +3,28 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * Model for testing model name starting with number - */ +/** Model for testing model name starting with number */ @ApiModel(description = "Model for testing model name starting with number") @JsonPropertyOrder({ Model200Response.JSON_PROPERTY_NAME, Model200Response.JSON_PROPERTY_PROPERTY_CLASS }) - public class Model200Response { public static final String JSON_PROPERTY_NAME = "name"; private Integer name; @@ -39,57 +32,52 @@ public class Model200Response { public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; private String propertyClass; - public Model200Response name(Integer name) { - + this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getName() { return name; } - public void setName(Integer name) { this.name = name; } - public Model200Response propertyClass(String propertyClass) { - + this.propertyClass = propertyClass; return this; } - /** + /** * Get propertyClass + * * @return propertyClass - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPropertyClass() { return propertyClass; } - public void setPropertyClass(String propertyClass) { this.propertyClass = propertyClass; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -99,8 +87,8 @@ public boolean equals(java.lang.Object o) { return false; } Model200Response _200response = (Model200Response) o; - return Objects.equals(this.name, _200response.name) && - Objects.equals(this.propertyClass, _200response.propertyClass); + return Objects.equals(this.name, _200response.name) + && Objects.equals(this.propertyClass, _200response.propertyClass); } @Override @@ -108,7 +96,6 @@ public int hashCode() { return Objects.hash(name, propertyClass); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -120,8 +107,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -129,6 +115,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 383cafdd3a5a..2efca6f97bd1 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -3,35 +3,27 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * ModelApiResponse - */ +/** ModelApiResponse */ @JsonPropertyOrder({ ModelApiResponse.JSON_PROPERTY_CODE, ModelApiResponse.JSON_PROPERTY_TYPE, ModelApiResponse.JSON_PROPERTY_MESSAGE }) - public class ModelApiResponse { public static final String JSON_PROPERTY_CODE = "code"; private Integer code; @@ -42,82 +34,75 @@ public class ModelApiResponse { public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; - public ModelApiResponse code(Integer code) { - + this.code = code; return this; } - /** + /** * Get code + * * @return code - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getCode() { return code; } - public void setCode(Integer code) { this.code = code; } - public ModelApiResponse type(String type) { - + this.type = type; return this; } - /** + /** * Get type + * * @return type - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getType() { return type; } - public void setType(String type) { this.type = type; } - public ModelApiResponse message(String message) { - + this.message = message; return this; } - /** + /** * Get message + * * @return message - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -127,9 +112,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(this.code, _apiResponse.code) + && Objects.equals(this.type, _apiResponse.type) + && Objects.equals(this.message, _apiResponse.message); } @Override @@ -137,7 +122,6 @@ public int hashCode() { return Objects.hash(code, type, message); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -150,8 +134,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -159,6 +142,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java index b62e13a90a0c..374989b521c5 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -3,64 +3,52 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * Model for testing reserved words - */ +/** Model for testing reserved words */ @ApiModel(description = "Model for testing reserved words") -@JsonPropertyOrder({ - ModelReturn.JSON_PROPERTY_RETURN -}) - +@JsonPropertyOrder({ModelReturn.JSON_PROPERTY_RETURN}) public class ModelReturn { public static final String JSON_PROPERTY_RETURN = "return"; private Integer _return; - public ModelReturn _return(Integer _return) { - + this._return = _return; return this; } - /** + /** * Get _return + * * @return _return - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_RETURN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getReturn() { return _return; } - public void setReturn(Integer _return) { this._return = _return; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,7 +66,6 @@ public int hashCode() { return Objects.hash(_return); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -89,8 +76,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -98,6 +84,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java index bd625c5f66f3..918eb738e286 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java @@ -3,29 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * Model for testing model name same as property name - */ +/** Model for testing model name same as property name */ @ApiModel(description = "Model for testing model name same as property name") @JsonPropertyOrder({ Name.JSON_PROPERTY_NAME, @@ -33,7 +27,6 @@ Name.JSON_PROPERTY_PROPERTY, Name.JSON_PROPERTY_123NUMBER }) - public class Name { public static final String JSON_PROPERTY_NAME = "name"; private Integer name; @@ -47,88 +40,77 @@ public class Name { public static final String JSON_PROPERTY_123NUMBER = "123Number"; private Integer _123number; - public Name name(Integer name) { - + this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Integer getName() { return name; } - public void setName(Integer name) { this.name = name; } - - /** + /** * Get snakeCase + * * @return snakeCase - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SNAKE_CASE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getSnakeCase() { return snakeCase; } - - - public Name property(String property) { - + this.property = property; return this; } - /** + /** * Get property + * * @return property - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getProperty() { return property; } - public void setProperty(String property) { this.property = property; } - - /** + /** * Get _123number + * * @return _123number - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_123NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer get123number() { return _123number; } - - - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -138,10 +120,10 @@ public boolean equals(java.lang.Object o) { return false; } Name name = (Name) o; - return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase) && - Objects.equals(this.property, name.property) && - Objects.equals(this._123number, name._123number); + return Objects.equals(this.name, name.name) + && Objects.equals(this.snakeCase, name.snakeCase) + && Objects.equals(this.property, name.property) + && Objects.equals(this._123number, name._123number); } @Override @@ -149,7 +131,6 @@ public int hashCode() { return Objects.hash(name, snakeCase, property, _123number); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -163,8 +144,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -172,6 +152,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..1c74f6e2158f --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,612 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +/** NullableClass */ +@JsonPropertyOrder({ + NullableClass.JSON_PROPERTY_INTEGER_PROP, + NullableClass.JSON_PROPERTY_NUMBER_PROP, + NullableClass.JSON_PROPERTY_BOOLEAN_PROP, + NullableClass.JSON_PROPERTY_STRING_PROP, + NullableClass.JSON_PROPERTY_DATE_PROP, + NullableClass.JSON_PROPERTY_DATETIME_PROP, + NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE +}) +public class NullableClass extends HashMap<String, Object> { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + private JsonNullable<Integer> integerProp = JsonNullable.<Integer>undefined(); + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + private JsonNullable<BigDecimal> numberProp = JsonNullable.<BigDecimal>undefined(); + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + private JsonNullable<Boolean> booleanProp = JsonNullable.<Boolean>undefined(); + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + private JsonNullable<String> stringProp = JsonNullable.<String>undefined(); + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + private JsonNullable<LocalDate> dateProp = JsonNullable.<LocalDate>undefined(); + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + private JsonNullable<OffsetDateTime> datetimeProp = JsonNullable.<OffsetDateTime>undefined(); + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + private JsonNullable<List<Object>> arrayNullableProp = JsonNullable.<List<Object>>undefined(); + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = + "array_and_items_nullable_prop"; + private JsonNullable<List<Object>> arrayAndItemsNullableProp = + JsonNullable.<List<Object>>undefined(); + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + private List<Object> arrayItemsNullable = null; + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + private JsonNullable<Map<String, Object>> objectNullableProp = + JsonNullable.<Map<String, Object>>undefined(); + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = + "object_and_items_nullable_prop"; + private JsonNullable<Map<String, Object>> objectAndItemsNullableProp = + JsonNullable.<Map<String, Object>>undefined(); + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + private Map<String, Object> objectItemsNullable = null; + + public NullableClass integerProp(Integer integerProp) { + this.integerProp = JsonNullable.<Integer>of(integerProp); + + return this; + } + + /** + * Get integerProp + * + * @return integerProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public Integer getIntegerProp() { + return integerProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Integer> getIntegerProp_JsonNullable() { + return integerProp; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + public void setIntegerProp_JsonNullable(JsonNullable<Integer> integerProp) { + this.integerProp = integerProp; + } + + public void setIntegerProp(Integer integerProp) { + this.integerProp = JsonNullable.<Integer>of(integerProp); + } + + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.<BigDecimal>of(numberProp); + + return this; + } + + /** + * Get numberProp + * + * @return numberProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public BigDecimal getNumberProp() { + return numberProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<BigDecimal> getNumberProp_JsonNullable() { + return numberProp; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + public void setNumberProp_JsonNullable(JsonNullable<BigDecimal> numberProp) { + this.numberProp = numberProp; + } + + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.<BigDecimal>of(numberProp); + } + + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.<Boolean>of(booleanProp); + + return this; + } + + /** + * Get booleanProp + * + * @return booleanProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public Boolean getBooleanProp() { + return booleanProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Boolean> getBooleanProp_JsonNullable() { + return booleanProp; + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + public void setBooleanProp_JsonNullable(JsonNullable<Boolean> booleanProp) { + this.booleanProp = booleanProp; + } + + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.<Boolean>of(booleanProp); + } + + public NullableClass stringProp(String stringProp) { + this.stringProp = JsonNullable.<String>of(stringProp); + + return this; + } + + /** + * Get stringProp + * + * @return stringProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public String getStringProp() { + return stringProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<String> getStringProp_JsonNullable() { + return stringProp; + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + public void setStringProp_JsonNullable(JsonNullable<String> stringProp) { + this.stringProp = stringProp; + } + + public void setStringProp(String stringProp) { + this.stringProp = JsonNullable.<String>of(stringProp); + } + + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.<LocalDate>of(dateProp); + + return this; + } + + /** + * Get dateProp + * + * @return dateProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public LocalDate getDateProp() { + return dateProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<LocalDate> getDateProp_JsonNullable() { + return dateProp; + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + public void setDateProp_JsonNullable(JsonNullable<LocalDate> dateProp) { + this.dateProp = dateProp; + } + + public void setDateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.<LocalDate>of(dateProp); + } + + public NullableClass datetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp); + + return this; + } + + /** + * Get datetimeProp + * + * @return datetimeProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public OffsetDateTime getDatetimeProp() { + return datetimeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<OffsetDateTime> getDatetimeProp_JsonNullable() { + return datetimeProp; + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + public void setDatetimeProp_JsonNullable(JsonNullable<OffsetDateTime> datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public void setDatetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp); + } + + public NullableClass arrayNullableProp(List<Object> arrayNullableProp) { + this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp); + + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + this.arrayNullableProp = JsonNullable.<List<Object>>of(new ArrayList<Object>()); + } + try { + this.arrayNullableProp.get().add(arrayNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayNullableProp + * + * @return arrayNullableProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public List<Object> getArrayNullableProp() { + return arrayNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<List<Object>> getArrayNullableProp_JsonNullable() { + return arrayNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + public void setArrayNullableProp_JsonNullable(JsonNullable<List<Object>> arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public void setArrayNullableProp(List<Object> arrayNullableProp) { + this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp); + } + + public NullableClass arrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp); + + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(new ArrayList<Object>()); + } + try { + this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayAndItemsNullableProp + * + * @return arrayAndItemsNullableProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public List<Object> getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<List<Object>> getArrayAndItemsNullableProp_JsonNullable() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + public void setArrayAndItemsNullableProp_JsonNullable( + JsonNullable<List<Object>> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp); + } + + public NullableClass arrayItemsNullable(List<Object> arrayItemsNullable) { + + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<Object>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * + * @return arrayItemsNullable + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<Object> getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(List<Object> arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass objectNullableProp(Map<String, Object> objectNullableProp) { + this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp); + + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + this.objectNullableProp = JsonNullable.<Map<String, Object>>of(new HashMap<String, Object>()); + } + try { + this.objectNullableProp.get().put(key, objectNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectNullableProp + * + * @return objectNullableProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public Map<String, Object> getObjectNullableProp() { + return objectNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Map<String, Object>> getObjectNullableProp_JsonNullable() { + return objectNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + public void setObjectNullableProp_JsonNullable( + JsonNullable<Map<String, Object>> objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public void setObjectNullableProp(Map<String, Object> objectNullableProp) { + this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp); + } + + public NullableClass objectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = + JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp); + + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem( + String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + this.objectAndItemsNullableProp = + JsonNullable.<Map<String, Object>>of(new HashMap<String, Object>()); + } + try { + this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectAndItemsNullableProp + * + * @return objectAndItemsNullableProp + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + public Map<String, Object> getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Map<String, Object>> getObjectAndItemsNullableProp_JsonNullable() { + return objectAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + public void setObjectAndItemsNullableProp_JsonNullable( + JsonNullable<Map<String, Object>> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = + JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp); + } + + public NullableClass objectItemsNullable(Map<String, Object> objectItemsNullable) { + + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<String, Object>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * + * @return objectItemsNullable + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Object> getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(Map<String, Object> objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) + && Objects.equals(this.numberProp, nullableClass.numberProp) + && Objects.equals(this.booleanProp, nullableClass.booleanProp) + && Objects.equals(this.stringProp, nullableClass.stringProp) + && Objects.equals(this.dateProp, nullableClass.dateProp) + && Objects.equals(this.datetimeProp, nullableClass.datetimeProp) + && Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) + && Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) + && Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) + && Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) + && Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) + && Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash( + integerProp, + numberProp, + booleanProp, + stringProp, + dateProp, + datetimeProp, + arrayNullableProp, + arrayAndItemsNullableProp, + arrayItemsNullable, + objectNullableProp, + objectAndItemsNullableProp, + objectItemsNullable, + super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ") + .append(toIndentedString(arrayAndItemsNullableProp)) + .append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ") + .append(toIndentedString(objectAndItemsNullableProp)) + .append("\n"); + sb.append(" objectItemsNullable: ") + .append(toIndentedString(objectItemsNullable)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java index 5ca72a169fe8..04ea549f07c4 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -3,64 +3,51 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * NumberOnly - */ -@JsonPropertyOrder({ - NumberOnly.JSON_PROPERTY_JUST_NUMBER -}) +import java.util.Objects; +/** NumberOnly */ +@JsonPropertyOrder({NumberOnly.JSON_PROPERTY_JUST_NUMBER}) public class NumberOnly { public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; private BigDecimal justNumber; - public NumberOnly justNumber(BigDecimal justNumber) { - + this.justNumber = justNumber; return this; } - /** + /** * Get justNumber + * * @return justNumber - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_JUST_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public BigDecimal getJustNumber() { return justNumber; } - public void setJustNumber(BigDecimal justNumber) { this.justNumber = justNumber; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,7 +65,6 @@ public int hashCode() { return Objects.hash(justNumber); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -89,8 +75,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -98,6 +83,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java index 6e2816302162..b78b7482b4e3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java @@ -3,30 +3,25 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; import org.threeten.bp.OffsetDateTime; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** - * Order - */ +/** Order */ @JsonPropertyOrder({ Order.JSON_PROPERTY_ID, Order.JSON_PROPERTY_PET_ID, @@ -35,7 +30,6 @@ Order.JSON_PROPERTY_STATUS, Order.JSON_PROPERTY_COMPLETE }) - public class Order { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -49,14 +43,12 @@ public class Order { public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; private OffsetDateTime shipDate; - /** - * Order Status - */ + /** Order Status */ public enum StatusEnum { PLACED("placed"), - + APPROVED("approved"), - + DELIVERED("delivered"); private String value; @@ -92,157 +84,144 @@ public static StatusEnum fromValue(String value) { public static final String JSON_PROPERTY_COMPLETE = "complete"; private Boolean complete = false; - public Order id(Long id) { - + this.id = id; return this; } - /** + /** * Get id + * * @return id - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - public Order petId(Long petId) { - + this.petId = petId; return this; } - /** + /** * Get petId + * * @return petId - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getPetId() { return petId; } - public void setPetId(Long petId) { this.petId = petId; } - public Order quantity(Integer quantity) { - + this.quantity = quantity; return this; } - /** + /** * Get quantity + * * @return quantity - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getQuantity() { return quantity; } - public void setQuantity(Integer quantity) { this.quantity = quantity; } - public Order shipDate(OffsetDateTime shipDate) { - + this.shipDate = shipDate; return this; } - /** + /** * Get shipDate + * * @return shipDate - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getShipDate() { return shipDate; } - public void setShipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; } - public Order status(StatusEnum status) { - + this.status = status; return this; } - /** + /** * Order Status + * * @return status - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public StatusEnum getStatus() { return status; } - public void setStatus(StatusEnum status) { this.status = status; } - public Order complete(Boolean complete) { - + this.complete = complete; return this; } - /** + /** * Get complete + * * @return complete - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getComplete() { return complete; } - public void setComplete(Boolean complete) { this.complete = complete; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -252,12 +231,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(this.id, order.id) + && Objects.equals(this.petId, order.petId) + && Objects.equals(this.quantity, order.quantity) + && Objects.equals(this.shipDate, order.shipDate) + && Objects.equals(this.status, order.status) + && Objects.equals(this.complete, order.complete); } @Override @@ -265,7 +244,6 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -281,8 +259,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -290,6 +267,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java index d4d9ac6ba110..1fd74d7906f4 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -3,36 +3,28 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * OuterComposite - */ +/** OuterComposite */ @JsonPropertyOrder({ OuterComposite.JSON_PROPERTY_MY_NUMBER, OuterComposite.JSON_PROPERTY_MY_STRING, OuterComposite.JSON_PROPERTY_MY_BOOLEAN }) - public class OuterComposite { public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; private BigDecimal myNumber; @@ -43,82 +35,75 @@ public class OuterComposite { public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; private Boolean myBoolean; - public OuterComposite myNumber(BigDecimal myNumber) { - + this.myNumber = myNumber; return this; } - /** + /** * Get myNumber + * * @return myNumber - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public BigDecimal getMyNumber() { return myNumber; } - public void setMyNumber(BigDecimal myNumber) { this.myNumber = myNumber; } - public OuterComposite myString(String myString) { - + this.myString = myString; return this; } - /** + /** * Get myString + * * @return myString - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMyString() { return myString; } - public void setMyString(String myString) { this.myString = myString; } - public OuterComposite myBoolean(Boolean myBoolean) { - + this.myBoolean = myBoolean; return this; } - /** + /** * Get myBoolean + * * @return myBoolean - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getMyBoolean() { return myBoolean; } - public void setMyBoolean(Boolean myBoolean) { this.myBoolean = myBoolean; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -128,9 +113,9 @@ public boolean equals(java.lang.Object o) { return false; } OuterComposite outerComposite = (OuterComposite) o; - return Objects.equals(this.myNumber, outerComposite.myNumber) && - Objects.equals(this.myString, outerComposite.myString) && - Objects.equals(this.myBoolean, outerComposite.myBoolean); + return Objects.equals(this.myNumber, outerComposite.myNumber) + && Objects.equals(this.myString, outerComposite.myString) + && Objects.equals(this.myBoolean, outerComposite.myBoolean); } @Override @@ -138,7 +123,6 @@ public int hashCode() { return Objects.hash(myNumber, myString, myBoolean); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -151,8 +135,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -160,6 +143,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java index 308646a320c7..6d7255bbe62c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -3,32 +3,25 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** - * Gets or Sets OuterEnum - */ +/** Gets or Sets OuterEnum */ public enum OuterEnum { - PLACED("placed"), - + APPROVED("approved"), - + DELIVERED("delivered"); private String value; @@ -54,7 +47,6 @@ public static OuterEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return null; } } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..109be684331b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Gets or Sets OuterEnumDefaultValue */ +public enum OuterEnumDefaultValue { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..277107e01030 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Gets or Sets OuterEnumInteger */ +public enum OuterEnumInteger { + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..91c11e7b4aa0 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Gets or Sets OuterEnumIntegerDefaultValue */ +public enum OuterEnumIntegerDefaultValue { + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java index be74dd5ca081..7690da073c12 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java @@ -3,33 +3,26 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; 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.Category; -import org.openapitools.client.model.Tag; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; -/** - * Pet - */ +/** Pet */ @JsonPropertyOrder({ Pet.JSON_PROPERTY_ID, Pet.JSON_PROPERTY_CATEGORY, @@ -38,7 +31,6 @@ Pet.JSON_PROPERTY_TAGS, Pet.JSON_PROPERTY_STATUS }) - public class Pet { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -55,14 +47,12 @@ public class Pet { public static final String JSON_PROPERTY_TAGS = "tags"; private List<Tag> tags = null; - /** - * pet status in the store - */ + /** pet status in the store */ public enum StatusEnum { AVAILABLE("available"), - + PENDING("pending"), - + SOLD("sold"); private String value; @@ -95,83 +85,76 @@ public static StatusEnum fromValue(String value) { public static final String JSON_PROPERTY_STATUS = "status"; private StatusEnum status; - public Pet id(Long id) { - + this.id = id; return this; } - /** + /** * Get id + * * @return id - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - public Pet category(Category category) { - + this.category = category; return this; } - /** + /** * Get category + * * @return category - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Category getCategory() { return category; } - public void setCategory(Category category) { this.category = category; } - public Pet name(String name) { - + this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public Pet photoUrls(List<String> photoUrls) { - + this.photoUrls = photoUrls; return this; } @@ -181,26 +164,24 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) { return this; } - /** + /** * Get photoUrls + * * @return photoUrls - **/ + */ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List<String> getPhotoUrls() { return photoUrls; } - public void setPhotoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; } - public Pet tags(List<Tag> tags) { - + this.tags = tags; return this; } @@ -213,50 +194,46 @@ public Pet addTagsItem(Tag tagsItem) { return this; } - /** + /** * Get tags + * * @return tags - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List<Tag> getTags() { return tags; } - public void setTags(List<Tag> tags) { this.tags = tags; } - public Pet status(StatusEnum status) { - + this.status = status; return this; } - /** + /** * pet status in the store + * * @return status - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public StatusEnum getStatus() { return status; } - public void setStatus(StatusEnum status) { this.status = status; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -266,12 +243,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(this.id, pet.id) + && Objects.equals(this.category, pet.category) + && Objects.equals(this.name, pet.name) + && Objects.equals(this.photoUrls, pet.photoUrls) + && Objects.equals(this.tags, pet.tags) + && Objects.equals(this.status, pet.status); } @Override @@ -279,7 +256,6 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -295,8 +271,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -304,6 +279,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index b3e58ef3d2c5..11ad89b4d018 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -3,34 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * ReadOnlyFirst - */ -@JsonPropertyOrder({ - ReadOnlyFirst.JSON_PROPERTY_BAR, - ReadOnlyFirst.JSON_PROPERTY_BAZ -}) - +/** ReadOnlyFirst */ +@JsonPropertyOrder({ReadOnlyFirst.JSON_PROPERTY_BAR, ReadOnlyFirst.JSON_PROPERTY_BAZ}) public class ReadOnlyFirst { public static final String JSON_PROPERTY_BAR = "bar"; private String bar; @@ -38,48 +27,42 @@ public class ReadOnlyFirst { public static final String JSON_PROPERTY_BAZ = "baz"; private String baz; - - /** + /** * Get bar + * * @return bar - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBar() { return bar; } - - - public ReadOnlyFirst baz(String baz) { - + this.baz = baz; return this; } - /** + /** * Get baz + * * @return baz - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAZ) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getBaz() { return baz; } - public void setBaz(String baz) { this.baz = baz; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -89,8 +72,8 @@ public boolean equals(java.lang.Object o) { return false; } ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; - return Objects.equals(this.bar, readOnlyFirst.bar) && - Objects.equals(this.baz, readOnlyFirst.baz); + return Objects.equals(this.bar, readOnlyFirst.bar) + && Objects.equals(this.baz, readOnlyFirst.baz); } @Override @@ -98,7 +81,6 @@ public int hashCode() { return Objects.hash(bar, baz); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -110,8 +92,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -119,6 +100,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java index 35ad3bf46994..2749ec0c7b4f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -3,63 +3,50 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * SpecialModelName - */ -@JsonPropertyOrder({ - SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME -}) - +/** SpecialModelName */ +@JsonPropertyOrder({SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME}) public class SpecialModelName { public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; private Long $specialPropertyName; - public SpecialModelName $specialPropertyName(Long $specialPropertyName) { - + this.$specialPropertyName = $specialPropertyName; return this; } - /** + /** * Get $specialPropertyName + * * @return $specialPropertyName - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long get$SpecialPropertyName() { return $specialPropertyName; } - public void set$SpecialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,8 +55,8 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SpecialModelName $specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); } @Override @@ -77,19 +64,19 @@ public int hashCode() { return Objects.hash($specialPropertyName); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SpecialModelName {\n"); - sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append(" $specialPropertyName: ") + .append(toIndentedString($specialPropertyName)) + .append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -97,6 +84,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java index a3ecb398faa3..f2155a9a7e7f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java @@ -3,34 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * Tag - */ -@JsonPropertyOrder({ - Tag.JSON_PROPERTY_ID, - Tag.JSON_PROPERTY_NAME -}) - +/** Tag */ +@JsonPropertyOrder({Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME}) public class Tag { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -38,57 +27,52 @@ public class Tag { public static final String JSON_PROPERTY_NAME = "name"; private String name; - public Tag id(Long id) { - + this.id = id; return this; } - /** + /** * Get id + * * @return id - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - public Tag name(String name) { - + this.name = name; return this; } - /** + /** * Get name + * * @return name - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { return name; } - public void setName(String name) { this.name = name; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -98,8 +82,7 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(this.id, tag.id) && Objects.equals(this.name, tag.name); } @Override @@ -107,7 +90,6 @@ public int hashCode() { return Objects.hash(id, name); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,8 +101,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -128,6 +109,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java deleted file mode 100644 index 73f393587944..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * TypeHolderDefault - */ -@JsonPropertyOrder({ - TypeHolderDefault.JSON_PROPERTY_STRING_ITEM, - TypeHolderDefault.JSON_PROPERTY_NUMBER_ITEM, - TypeHolderDefault.JSON_PROPERTY_INTEGER_ITEM, - TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, - TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM -}) - -public class TypeHolderDefault { - public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; - private String stringItem = "what"; - - public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; - private BigDecimal numberItem; - - public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; - private Integer integerItem; - - public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; - private Boolean boolItem = true; - - public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List<Integer> arrayItem = new ArrayList<Integer>(); - - - public TypeHolderDefault stringItem(String stringItem) { - - this.stringItem = stringItem; - return this; - } - - /** - * Get stringItem - * @return stringItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_STRING_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public String getStringItem() { - return stringItem; - } - - - public void setStringItem(String stringItem) { - this.stringItem = stringItem; - } - - - public TypeHolderDefault numberItem(BigDecimal numberItem) { - - this.numberItem = numberItem; - return this; - } - - /** - * Get numberItem - * @return numberItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public BigDecimal getNumberItem() { - return numberItem; - } - - - public void setNumberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - } - - - public TypeHolderDefault integerItem(Integer integerItem) { - - this.integerItem = integerItem; - return this; - } - - /** - * Get integerItem - * @return integerItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Integer getIntegerItem() { - return integerItem; - } - - - public void setIntegerItem(Integer integerItem) { - this.integerItem = integerItem; - } - - - public TypeHolderDefault boolItem(Boolean boolItem) { - - this.boolItem = boolItem; - return this; - } - - /** - * Get boolItem - * @return boolItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_BOOL_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Boolean getBoolItem() { - return boolItem; - } - - - public void setBoolItem(Boolean boolItem) { - this.boolItem = boolItem; - } - - - public TypeHolderDefault arrayItem(List<Integer> arrayItem) { - - this.arrayItem = arrayItem; - return this; - } - - public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { - this.arrayItem.add(arrayItemItem); - return this; - } - - /** - * Get arrayItem - * @return arrayItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public List<Integer> getArrayItem() { - return arrayItem; - } - - - public void setArrayItem(List<Integer> arrayItem) { - this.arrayItem = arrayItem; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; - return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && - Objects.equals(this.numberItem, typeHolderDefault.numberItem) && - Objects.equals(this.integerItem, typeHolderDefault.integerItem) && - Objects.equals(this.boolItem, typeHolderDefault.boolItem) && - Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); - } - - @Override - public int hashCode() { - return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeHolderDefault {\n"); - sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); - sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); - sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); - sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); - sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java deleted file mode 100644 index e3daa1a3e1cb..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * TypeHolderExample - */ -@JsonPropertyOrder({ - TypeHolderExample.JSON_PROPERTY_STRING_ITEM, - TypeHolderExample.JSON_PROPERTY_NUMBER_ITEM, - TypeHolderExample.JSON_PROPERTY_FLOAT_ITEM, - TypeHolderExample.JSON_PROPERTY_INTEGER_ITEM, - TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, - TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM -}) - -public class TypeHolderExample { - public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; - private String stringItem; - - public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; - private BigDecimal numberItem; - - public static final String JSON_PROPERTY_FLOAT_ITEM = "float_item"; - private Float floatItem; - - public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; - private Integer integerItem; - - public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; - private Boolean boolItem; - - public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List<Integer> arrayItem = new ArrayList<Integer>(); - - - public TypeHolderExample stringItem(String stringItem) { - - this.stringItem = stringItem; - return this; - } - - /** - * Get stringItem - * @return stringItem - **/ - @ApiModelProperty(example = "what", required = true, value = "") - @JsonProperty(JSON_PROPERTY_STRING_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public String getStringItem() { - return stringItem; - } - - - public void setStringItem(String stringItem) { - this.stringItem = stringItem; - } - - - public TypeHolderExample numberItem(BigDecimal numberItem) { - - this.numberItem = numberItem; - return this; - } - - /** - * Get numberItem - * @return numberItem - **/ - @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public BigDecimal getNumberItem() { - return numberItem; - } - - - public void setNumberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - } - - - public TypeHolderExample floatItem(Float floatItem) { - - this.floatItem = floatItem; - return this; - } - - /** - * Get floatItem - * @return floatItem - **/ - @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Float getFloatItem() { - return floatItem; - } - - - public void setFloatItem(Float floatItem) { - this.floatItem = floatItem; - } - - - public TypeHolderExample integerItem(Integer integerItem) { - - this.integerItem = integerItem; - return this; - } - - /** - * Get integerItem - * @return integerItem - **/ - @ApiModelProperty(example = "-2", required = true, value = "") - @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Integer getIntegerItem() { - return integerItem; - } - - - public void setIntegerItem(Integer integerItem) { - this.integerItem = integerItem; - } - - - public TypeHolderExample boolItem(Boolean boolItem) { - - this.boolItem = boolItem; - return this; - } - - /** - * Get boolItem - * @return boolItem - **/ - @ApiModelProperty(example = "true", required = true, value = "") - @JsonProperty(JSON_PROPERTY_BOOL_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Boolean getBoolItem() { - return boolItem; - } - - - public void setBoolItem(Boolean boolItem) { - this.boolItem = boolItem; - } - - - public TypeHolderExample arrayItem(List<Integer> arrayItem) { - - this.arrayItem = arrayItem; - return this; - } - - public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { - this.arrayItem.add(arrayItemItem); - return this; - } - - /** - * Get arrayItem - * @return arrayItem - **/ - @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public List<Integer> getArrayItem() { - return arrayItem; - } - - - public void setArrayItem(List<Integer> arrayItem) { - this.arrayItem = arrayItem; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TypeHolderExample typeHolderExample = (TypeHolderExample) o; - return Objects.equals(this.stringItem, typeHolderExample.stringItem) && - Objects.equals(this.numberItem, typeHolderExample.numberItem) && - Objects.equals(this.floatItem, typeHolderExample.floatItem) && - Objects.equals(this.integerItem, typeHolderExample.integerItem) && - Objects.equals(this.boolItem, typeHolderExample.boolItem) && - Objects.equals(this.arrayItem, typeHolderExample.arrayItem); - } - - @Override - public int hashCode() { - return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeHolderExample {\n"); - sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); - sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); - sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); - sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); - sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); - sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java index b7e74643dab2..637c9625657f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java @@ -3,29 +3,22 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import java.util.Objects; -import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; -/** - * User - */ +/** User */ @JsonPropertyOrder({ User.JSON_PROPERTY_ID, User.JSON_PROPERTY_USERNAME, @@ -36,7 +29,6 @@ User.JSON_PROPERTY_PHONE, User.JSON_PROPERTY_USER_STATUS }) - public class User { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -62,207 +54,190 @@ public class User { public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; private Integer userStatus; - public User id(Long id) { - + this.id = id; return this; } - /** + /** * Get id + * * @return id - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - public User username(String username) { - + this.username = username; return this; } - /** + /** * Get username + * * @return username - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } - public User firstName(String firstName) { - + this.firstName = firstName; return this; } - /** + /** * Get firstName + * * @return firstName - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { this.firstName = firstName; } - public User lastName(String lastName) { - + this.lastName = lastName; return this; } - /** + /** * Get lastName + * * @return lastName - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLastName() { return lastName; } - public void setLastName(String lastName) { this.lastName = lastName; } - public User email(String email) { - + this.email = email; return this; } - /** + /** * Get email + * * @return email - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getEmail() { return email; } - public void setEmail(String email) { this.email = email; } - public User password(String password) { - + this.password = password; return this; } - /** + /** * Get password + * * @return password - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } - public User phone(String phone) { - + this.phone = phone; return this; } - /** + /** * Get phone + * * @return phone - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPhone() { return phone; } - public void setPhone(String phone) { this.phone = phone; } - public User userStatus(Integer userStatus) { - + this.userStatus = userStatus; return this; } - /** + /** * User Status + * * @return userStatus - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getUserStatus() { return userStatus; } - public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -272,14 +247,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(this.id, user.id) + && Objects.equals(this.username, user.username) + && Objects.equals(this.firstName, user.firstName) + && Objects.equals(this.lastName, user.lastName) + && Objects.equals(this.email, user.email) + && Objects.equals(this.password, user.password) + && Objects.equals(this.phone, user.phone) + && Objects.equals(this.userStatus, user.userStatus); } @Override @@ -287,7 +262,6 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -305,8 +279,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -314,6 +287,4 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java deleted file mode 100644 index f585a625223a..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/XmlItem.java +++ /dev/null @@ -1,1045 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import java.util.Objects; -import java.util.Arrays; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -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 com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * XmlItem - */ -@JsonPropertyOrder({ - XmlItem.JSON_PROPERTY_ATTRIBUTE_STRING, - XmlItem.JSON_PROPERTY_ATTRIBUTE_NUMBER, - XmlItem.JSON_PROPERTY_ATTRIBUTE_INTEGER, - XmlItem.JSON_PROPERTY_ATTRIBUTE_BOOLEAN, - XmlItem.JSON_PROPERTY_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_NAME_STRING, - XmlItem.JSON_PROPERTY_NAME_NUMBER, - XmlItem.JSON_PROPERTY_NAME_INTEGER, - XmlItem.JSON_PROPERTY_NAME_BOOLEAN, - XmlItem.JSON_PROPERTY_NAME_ARRAY, - XmlItem.JSON_PROPERTY_NAME_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_STRING, - XmlItem.JSON_PROPERTY_PREFIX_NUMBER, - XmlItem.JSON_PROPERTY_PREFIX_INTEGER, - XmlItem.JSON_PROPERTY_PREFIX_BOOLEAN, - XmlItem.JSON_PROPERTY_PREFIX_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_NAMESPACE_STRING, - XmlItem.JSON_PROPERTY_NAMESPACE_NUMBER, - XmlItem.JSON_PROPERTY_NAMESPACE_INTEGER, - XmlItem.JSON_PROPERTY_NAMESPACE_BOOLEAN, - XmlItem.JSON_PROPERTY_NAMESPACE_ARRAY, - XmlItem.JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_NS_STRING, - XmlItem.JSON_PROPERTY_PREFIX_NS_NUMBER, - XmlItem.JSON_PROPERTY_PREFIX_NS_INTEGER, - XmlItem.JSON_PROPERTY_PREFIX_NS_BOOLEAN, - XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY -}) - -public class XmlItem { - public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; - private String attributeString; - - public static final String JSON_PROPERTY_ATTRIBUTE_NUMBER = "attribute_number"; - private BigDecimal attributeNumber; - - public static final String JSON_PROPERTY_ATTRIBUTE_INTEGER = "attribute_integer"; - private Integer attributeInteger; - - public static final String JSON_PROPERTY_ATTRIBUTE_BOOLEAN = "attribute_boolean"; - private Boolean attributeBoolean; - - public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array"; - private List<Integer> wrappedArray = null; - - public static final String JSON_PROPERTY_NAME_STRING = "name_string"; - private String nameString; - - public static final String JSON_PROPERTY_NAME_NUMBER = "name_number"; - private BigDecimal nameNumber; - - public static final String JSON_PROPERTY_NAME_INTEGER = "name_integer"; - private Integer nameInteger; - - public static final String JSON_PROPERTY_NAME_BOOLEAN = "name_boolean"; - private Boolean nameBoolean; - - public static final String JSON_PROPERTY_NAME_ARRAY = "name_array"; - private List<Integer> nameArray = null; - - public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array"; - private List<Integer> nameWrappedArray = null; - - public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string"; - private String prefixString; - - public static final String JSON_PROPERTY_PREFIX_NUMBER = "prefix_number"; - private BigDecimal prefixNumber; - - public static final String JSON_PROPERTY_PREFIX_INTEGER = "prefix_integer"; - private Integer prefixInteger; - - public static final String JSON_PROPERTY_PREFIX_BOOLEAN = "prefix_boolean"; - private Boolean prefixBoolean; - - public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array"; - private List<Integer> prefixArray = null; - - public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; - private List<Integer> prefixWrappedArray = null; - - public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string"; - private String namespaceString; - - public static final String JSON_PROPERTY_NAMESPACE_NUMBER = "namespace_number"; - private BigDecimal namespaceNumber; - - public static final String JSON_PROPERTY_NAMESPACE_INTEGER = "namespace_integer"; - private Integer namespaceInteger; - - public static final String JSON_PROPERTY_NAMESPACE_BOOLEAN = "namespace_boolean"; - private Boolean namespaceBoolean; - - public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array"; - private List<Integer> namespaceArray = null; - - public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; - private List<Integer> namespaceWrappedArray = null; - - public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string"; - private String prefixNsString; - - public static final String JSON_PROPERTY_PREFIX_NS_NUMBER = "prefix_ns_number"; - private BigDecimal prefixNsNumber; - - public static final String JSON_PROPERTY_PREFIX_NS_INTEGER = "prefix_ns_integer"; - private Integer prefixNsInteger; - - public static final String JSON_PROPERTY_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; - private Boolean prefixNsBoolean; - - public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array"; - private List<Integer> prefixNsArray = null; - - public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; - private List<Integer> prefixNsWrappedArray = null; - - - public XmlItem attributeString(String attributeString) { - - this.attributeString = attributeString; - return this; - } - - /** - * Get attributeString - * @return attributeString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getAttributeString() { - return attributeString; - } - - - public void setAttributeString(String attributeString) { - this.attributeString = attributeString; - } - - - public XmlItem attributeNumber(BigDecimal attributeNumber) { - - this.attributeNumber = attributeNumber; - return this; - } - - /** - * Get attributeNumber - * @return attributeNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getAttributeNumber() { - return attributeNumber; - } - - - public void setAttributeNumber(BigDecimal attributeNumber) { - this.attributeNumber = attributeNumber; - } - - - public XmlItem attributeInteger(Integer attributeInteger) { - - this.attributeInteger = attributeInteger; - return this; - } - - /** - * Get attributeInteger - * @return attributeInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getAttributeInteger() { - return attributeInteger; - } - - - public void setAttributeInteger(Integer attributeInteger) { - this.attributeInteger = attributeInteger; - } - - - public XmlItem attributeBoolean(Boolean attributeBoolean) { - - this.attributeBoolean = attributeBoolean; - return this; - } - - /** - * Get attributeBoolean - * @return attributeBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getAttributeBoolean() { - return attributeBoolean; - } - - - public void setAttributeBoolean(Boolean attributeBoolean) { - this.attributeBoolean = attributeBoolean; - } - - - public XmlItem wrappedArray(List<Integer> wrappedArray) { - - this.wrappedArray = wrappedArray; - return this; - } - - public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { - if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList<Integer>(); - } - this.wrappedArray.add(wrappedArrayItem); - return this; - } - - /** - * Get wrappedArray - * @return wrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getWrappedArray() { - return wrappedArray; - } - - - public void setWrappedArray(List<Integer> wrappedArray) { - this.wrappedArray = wrappedArray; - } - - - public XmlItem nameString(String nameString) { - - this.nameString = nameString; - return this; - } - - /** - * Get nameString - * @return nameString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_NAME_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getNameString() { - return nameString; - } - - - public void setNameString(String nameString) { - this.nameString = nameString; - } - - - public XmlItem nameNumber(BigDecimal nameNumber) { - - this.nameNumber = nameNumber; - return this; - } - - /** - * Get nameNumber - * @return nameNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_NAME_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getNameNumber() { - return nameNumber; - } - - - public void setNameNumber(BigDecimal nameNumber) { - this.nameNumber = nameNumber; - } - - - public XmlItem nameInteger(Integer nameInteger) { - - this.nameInteger = nameInteger; - return this; - } - - /** - * Get nameInteger - * @return nameInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_NAME_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getNameInteger() { - return nameInteger; - } - - - public void setNameInteger(Integer nameInteger) { - this.nameInteger = nameInteger; - } - - - public XmlItem nameBoolean(Boolean nameBoolean) { - - this.nameBoolean = nameBoolean; - return this; - } - - /** - * Get nameBoolean - * @return nameBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getNameBoolean() { - return nameBoolean; - } - - - public void setNameBoolean(Boolean nameBoolean) { - this.nameBoolean = nameBoolean; - } - - - public XmlItem nameArray(List<Integer> nameArray) { - - this.nameArray = nameArray; - return this; - } - - public XmlItem addNameArrayItem(Integer nameArrayItem) { - if (this.nameArray == null) { - this.nameArray = new ArrayList<Integer>(); - } - this.nameArray.add(nameArrayItem); - return this; - } - - /** - * Get nameArray - * @return nameArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getNameArray() { - return nameArray; - } - - - public void setNameArray(List<Integer> nameArray) { - this.nameArray = nameArray; - } - - - public XmlItem nameWrappedArray(List<Integer> nameWrappedArray) { - - this.nameWrappedArray = nameWrappedArray; - return this; - } - - public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { - if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList<Integer>(); - } - this.nameWrappedArray.add(nameWrappedArrayItem); - return this; - } - - /** - * Get nameWrappedArray - * @return nameWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getNameWrappedArray() { - return nameWrappedArray; - } - - - public void setNameWrappedArray(List<Integer> nameWrappedArray) { - this.nameWrappedArray = nameWrappedArray; - } - - - public XmlItem prefixString(String prefixString) { - - this.prefixString = prefixString; - return this; - } - - /** - * Get prefixString - * @return prefixString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getPrefixString() { - return prefixString; - } - - - public void setPrefixString(String prefixString) { - this.prefixString = prefixString; - } - - - public XmlItem prefixNumber(BigDecimal prefixNumber) { - - this.prefixNumber = prefixNumber; - return this; - } - - /** - * Get prefixNumber - * @return prefixNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getPrefixNumber() { - return prefixNumber; - } - - - public void setPrefixNumber(BigDecimal prefixNumber) { - this.prefixNumber = prefixNumber; - } - - - public XmlItem prefixInteger(Integer prefixInteger) { - - this.prefixInteger = prefixInteger; - return this; - } - - /** - * Get prefixInteger - * @return prefixInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getPrefixInteger() { - return prefixInteger; - } - - - public void setPrefixInteger(Integer prefixInteger) { - this.prefixInteger = prefixInteger; - } - - - public XmlItem prefixBoolean(Boolean prefixBoolean) { - - this.prefixBoolean = prefixBoolean; - return this; - } - - /** - * Get prefixBoolean - * @return prefixBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getPrefixBoolean() { - return prefixBoolean; - } - - - public void setPrefixBoolean(Boolean prefixBoolean) { - this.prefixBoolean = prefixBoolean; - } - - - public XmlItem prefixArray(List<Integer> prefixArray) { - - this.prefixArray = prefixArray; - return this; - } - - public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { - if (this.prefixArray == null) { - this.prefixArray = new ArrayList<Integer>(); - } - this.prefixArray.add(prefixArrayItem); - return this; - } - - /** - * Get prefixArray - * @return prefixArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getPrefixArray() { - return prefixArray; - } - - - public void setPrefixArray(List<Integer> prefixArray) { - this.prefixArray = prefixArray; - } - - - public XmlItem prefixWrappedArray(List<Integer> prefixWrappedArray) { - - this.prefixWrappedArray = prefixWrappedArray; - return this; - } - - public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { - if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList<Integer>(); - } - this.prefixWrappedArray.add(prefixWrappedArrayItem); - return this; - } - - /** - * Get prefixWrappedArray - * @return prefixWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getPrefixWrappedArray() { - return prefixWrappedArray; - } - - - public void setPrefixWrappedArray(List<Integer> prefixWrappedArray) { - this.prefixWrappedArray = prefixWrappedArray; - } - - - public XmlItem namespaceString(String namespaceString) { - - this.namespaceString = namespaceString; - return this; - } - - /** - * Get namespaceString - * @return namespaceString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getNamespaceString() { - return namespaceString; - } - - - public void setNamespaceString(String namespaceString) { - this.namespaceString = namespaceString; - } - - - public XmlItem namespaceNumber(BigDecimal namespaceNumber) { - - this.namespaceNumber = namespaceNumber; - return this; - } - - /** - * Get namespaceNumber - * @return namespaceNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getNamespaceNumber() { - return namespaceNumber; - } - - - public void setNamespaceNumber(BigDecimal namespaceNumber) { - this.namespaceNumber = namespaceNumber; - } - - - public XmlItem namespaceInteger(Integer namespaceInteger) { - - this.namespaceInteger = namespaceInteger; - return this; - } - - /** - * Get namespaceInteger - * @return namespaceInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getNamespaceInteger() { - return namespaceInteger; - } - - - public void setNamespaceInteger(Integer namespaceInteger) { - this.namespaceInteger = namespaceInteger; - } - - - public XmlItem namespaceBoolean(Boolean namespaceBoolean) { - - this.namespaceBoolean = namespaceBoolean; - return this; - } - - /** - * Get namespaceBoolean - * @return namespaceBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getNamespaceBoolean() { - return namespaceBoolean; - } - - - public void setNamespaceBoolean(Boolean namespaceBoolean) { - this.namespaceBoolean = namespaceBoolean; - } - - - public XmlItem namespaceArray(List<Integer> namespaceArray) { - - this.namespaceArray = namespaceArray; - return this; - } - - public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { - if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList<Integer>(); - } - this.namespaceArray.add(namespaceArrayItem); - return this; - } - - /** - * Get namespaceArray - * @return namespaceArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getNamespaceArray() { - return namespaceArray; - } - - - public void setNamespaceArray(List<Integer> namespaceArray) { - this.namespaceArray = namespaceArray; - } - - - public XmlItem namespaceWrappedArray(List<Integer> namespaceWrappedArray) { - - this.namespaceWrappedArray = namespaceWrappedArray; - return this; - } - - public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { - if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList<Integer>(); - } - this.namespaceWrappedArray.add(namespaceWrappedArrayItem); - return this; - } - - /** - * Get namespaceWrappedArray - * @return namespaceWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getNamespaceWrappedArray() { - return namespaceWrappedArray; - } - - - public void setNamespaceWrappedArray(List<Integer> namespaceWrappedArray) { - this.namespaceWrappedArray = namespaceWrappedArray; - } - - - public XmlItem prefixNsString(String prefixNsString) { - - this.prefixNsString = prefixNsString; - return this; - } - - /** - * Get prefixNsString - * @return prefixNsString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getPrefixNsString() { - return prefixNsString; - } - - - public void setPrefixNsString(String prefixNsString) { - this.prefixNsString = prefixNsString; - } - - - public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) { - - this.prefixNsNumber = prefixNsNumber; - return this; - } - - /** - * Get prefixNsNumber - * @return prefixNsNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getPrefixNsNumber() { - return prefixNsNumber; - } - - - public void setPrefixNsNumber(BigDecimal prefixNsNumber) { - this.prefixNsNumber = prefixNsNumber; - } - - - public XmlItem prefixNsInteger(Integer prefixNsInteger) { - - this.prefixNsInteger = prefixNsInteger; - return this; - } - - /** - * Get prefixNsInteger - * @return prefixNsInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getPrefixNsInteger() { - return prefixNsInteger; - } - - - public void setPrefixNsInteger(Integer prefixNsInteger) { - this.prefixNsInteger = prefixNsInteger; - } - - - public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) { - - this.prefixNsBoolean = prefixNsBoolean; - return this; - } - - /** - * Get prefixNsBoolean - * @return prefixNsBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getPrefixNsBoolean() { - return prefixNsBoolean; - } - - - public void setPrefixNsBoolean(Boolean prefixNsBoolean) { - this.prefixNsBoolean = prefixNsBoolean; - } - - - public XmlItem prefixNsArray(List<Integer> prefixNsArray) { - - this.prefixNsArray = prefixNsArray; - return this; - } - - public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { - if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList<Integer>(); - } - this.prefixNsArray.add(prefixNsArrayItem); - return this; - } - - /** - * Get prefixNsArray - * @return prefixNsArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getPrefixNsArray() { - return prefixNsArray; - } - - - public void setPrefixNsArray(List<Integer> prefixNsArray) { - this.prefixNsArray = prefixNsArray; - } - - - public XmlItem prefixNsWrappedArray(List<Integer> prefixNsWrappedArray) { - - this.prefixNsWrappedArray = prefixNsWrappedArray; - return this; - } - - public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { - if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList<Integer>(); - } - this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); - return this; - } - - /** - * Get prefixNsWrappedArray - * @return prefixNsWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List<Integer> getPrefixNsWrappedArray() { - return prefixNsWrappedArray; - } - - - public void setPrefixNsWrappedArray(List<Integer> prefixNsWrappedArray) { - this.prefixNsWrappedArray = prefixNsWrappedArray; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - XmlItem xmlItem = (XmlItem) o; - return Objects.equals(this.attributeString, xmlItem.attributeString) && - Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && - Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && - Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && - Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && - Objects.equals(this.nameString, xmlItem.nameString) && - Objects.equals(this.nameNumber, xmlItem.nameNumber) && - Objects.equals(this.nameInteger, xmlItem.nameInteger) && - Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && - Objects.equals(this.nameArray, xmlItem.nameArray) && - Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && - Objects.equals(this.prefixString, xmlItem.prefixString) && - Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && - Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && - Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && - Objects.equals(this.prefixArray, xmlItem.prefixArray) && - Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && - Objects.equals(this.namespaceString, xmlItem.namespaceString) && - Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && - Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && - Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && - Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && - Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && - Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && - Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && - Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && - Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && - Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && - Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); - } - - @Override - public int hashCode() { - 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(); - sb.append("class XmlItem {\n"); - sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); - sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); - sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); - sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); - sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); - sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); - sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); - sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); - sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); - sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); - sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); - sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); - sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); - sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); - sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); - sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); - sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); - sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); - sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); - sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); - sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); - sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); - sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); - sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); - sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); - sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); - sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); - sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); - sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java index 837b5ea02461..720c6161e9e6 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -3,48 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.api; -import org.openapitools.client.ApiException; -import org.openapitools.client.model.Client; import org.junit.Test; -import org.junit.Ignore; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.ApiException; -/** - * API tests for AnotherFakeApi - */ -@Ignore +/** API tests for AnotherFakeApi */ public class AnotherFakeApiTest { - private final AnotherFakeApi api = new AnotherFakeApi(); + private final AnotherFakeApi api = new AnotherFakeApi(); - - /** - * To test special tags - * - * To test special tags and operation ID starting with number - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void call123testSpecialTagsTest() throws ApiException { - Client body = null; - Client response = api.call123testSpecialTags(body); - // TODO: test validations - } - + /** + * To test special tags + * + * <p>To test special tags and operation ID starting with number + * + * @throws ApiException if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + // Client client = null; + // Client response = api.call123testSpecialTags(client); + // TODO: test validations + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..d3eccc34d99b --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -0,0 +1,29 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.junit.Test; +import org.openapitools.client.ApiException; + +/** API tests for DefaultApi */ +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** @throws ApiException if the Api call fails */ + @Test + public void fooGetTest() throws ApiException { + // InlineResponseDefault response = api.fooGet(); + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java index b2c8f47fb36e..6426c753cad5 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -3,289 +3,280 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.api; -import org.openapitools.client.ApiException; -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.Test; +import java.io.ByteArrayInputStream; +import java.security.PrivateKey; +import java.util.Arrays; import org.junit.Ignore; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.auth.HttpSignatureAuth; +import org.openapitools.client.model.Pet; +import org.tomitribe.auth.signatures.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * API tests for FakeApi - */ -@Ignore +/** API tests for FakeApi */ public class FakeApiTest { - private final FakeApi api = new FakeApi(); + private final FakeApi api = new FakeApi(); + + /** + * Health check endpoint + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeHealthGetTest() throws ApiException { + // HealthCheckResult response = api.fakeHealthGet(); + // TODO: test validations + } + + /** + * test http signature authentication + * + * @throws Exception if the Api call fails + */ + @Ignore + @Test + public void fakeHttpSignatureTestTest() throws Exception { + + final String privateKeyPem = + "-----BEGIN RSA PRIVATE KEY-----\n" + + "MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF\n" + + "NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F\n" + + "UR45uBJeDK1HSFHD8bH KD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB\n" + + "AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA\n" + + "QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK\n" + + "kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg\n" + + "f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u\n" + + "412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc\n" + + "mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7\n" + + "kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA\n" + + "gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW\n" + + "G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI\n" + + "7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA==\n" + + "-----END RSA PRIVATE KEY-----\n"; + + PrivateKey privateKey = PEM.readPrivateKey(new ByteArrayInputStream(privateKeyPem.getBytes())); + ApiClient client = api.getApiClient(); + HttpSignatureAuth auth = (HttpSignatureAuth) client.getAuthentication("http_signature_test"); + auth.setAlgorithm(Algorithm.RSA_SHA512); + auth.setHeaders(Arrays.asList("(request-target)", "host", "date")); + auth.setup(privateKey); + + Pet pet = new Pet(); + pet.setId(10l); + pet.setName("test http signature"); + String query1 = "hello world"; + String header1 = "empty header"; + api.fakeHttpSignatureTest(pet, query1, header1); + } + + /** + * Test serialization of outer boolean types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + // Boolean body = null; + // Boolean response = api.fakeOuterBooleanSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of object with outer number type + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + // OuterComposite outerComposite = null; + // OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + // TODO: test validations + } + + /** + * Test serialization of outer number types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + // BigDecimal body = null; + // BigDecimal response = api.fakeOuterNumberSerialize(body); + // TODO: test validations + } + + /** + * Test serialization of outer string types + * + * @throws ApiException if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + // String body = null; + // String response = api.fakeOuterStringSerialize(body); + // TODO: test validations + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + // FileSchemaTestClass fileSchemaTestClass = null; + // api.testBodyWithFileSchema(fileSchemaTestClass); + // TODO: test validations + } + + /** @throws ApiException if the Api call fails */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + // String query = null; + // User user = null; + // api.testBodyWithQueryParams(query, user); + // TODO: test validations + } + + /** + * To test \"client\" model + * + * <p>To test \"client\" model + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + // Client client = null; + // Client response = api.testClientModel(client); + // TODO: test validations + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * <p>Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + // 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); + // TODO: test validations + } + + /** + * To test enum parameters + * + * <p>To test enum parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + // List<String> enumHeaderStringArray = null; + // String enumHeaderString = null; + // List<String> enumQueryStringArray = null; + // String enumQueryString = null; + // Integer enumQueryInteger = null; + // Double enumQueryDouble = null; + // List<String> enumFormStringArray = null; + // String enumFormString = null; + // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, + // enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + // TODO: test validations + } + + /** + * Fake endpoint to test group parameters (optional) + * + * <p>Fake endpoint to test group parameters (optional) + * + * @throws ApiException if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + // Integer requiredStringGroup = null; + // Boolean requiredBooleanGroup = null; + // Long requiredInt64Group = null; + // Integer stringGroup = null; + // Boolean booleanGroup = null; + // Long int64Group = null; + // api.testGroupParameters() + // .requiredStringGroup(requiredStringGroup) + // .requiredBooleanGroup(requiredBooleanGroup) + // .requiredInt64Group(requiredInt64Group) + // .stringGroup(stringGroup) + // .booleanGroup(booleanGroup) + // .int64Group(int64Group) + // .execute(); + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * @throws ApiException if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + // Map<String, String> requestBody = null; + // api.testInlineAdditionalProperties(requestBody); + // TODO: test validations + } + + /** + * test json serialization of form data + * + * @throws ApiException if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + // String param = null; + // String param2 = null; + // api.testJsonFormData(param, param2); + // TODO: test validations + } - - /** - * creates an XmlItem - * - * this route creates an XmlItem - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createXmlItemTest() throws ApiException { - XmlItem xmlItem = null; - api.createXmlItem(xmlItem); - // TODO: test validations - } - - /** - * - * - * Test serialization of outer boolean types - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void fakeOuterBooleanSerializeTest() throws ApiException { - Boolean body = null; - Boolean response = api.fakeOuterBooleanSerialize(body); - // TODO: test validations - } - - /** - * - * - * Test serialization of object with outer number type - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void fakeOuterCompositeSerializeTest() throws ApiException { - OuterComposite body = null; - OuterComposite response = api.fakeOuterCompositeSerialize(body); - // TODO: test validations - } - - /** - * - * - * Test serialization of outer number types - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void fakeOuterNumberSerializeTest() throws ApiException { - BigDecimal body = null; - BigDecimal response = api.fakeOuterNumberSerialize(body); - // TODO: test validations - } - - /** - * - * - * Test serialization of outer string types - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void fakeOuterStringSerializeTest() throws ApiException { - String body = null; - String response = api.fakeOuterStringSerialize(body); - // TODO: test validations - } - - /** - * - * - * For this test, the body for this request much reference a schema named `File`. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testBodyWithFileSchemaTest() throws ApiException { - FileSchemaTestClass body = null; - api.testBodyWithFileSchema(body); - // TODO: test validations - } - - /** - * - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testBodyWithQueryParamsTest() throws ApiException { - String query = null; - User body = null; - api.testBodyWithQueryParams(query, body); - // TODO: test validations - } - - /** - * To test \"client\" model - * - * To test \"client\" model - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testClientModelTest() throws ApiException { - Client body = null; - Client response = api.testClientModel(body); - // TODO: test validations - } - - /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testEndpointParametersTest() throws ApiException { - 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); - // TODO: test validations - } - - /** - * To test enum parameters - * - * To test enum parameters - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testEnumParametersTest() throws ApiException { - List<String> enumHeaderStringArray = null; - String enumHeaderString = null; - List<String> enumQueryStringArray = null; - String enumQueryString = null; - Integer enumQueryInteger = null; - Double enumQueryDouble = null; - List<String> enumFormStringArray = null; - String enumFormString = null; - api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - // TODO: test validations - } - - /** - * Fake endpoint to test group parameters (optional) - * - * Fake endpoint to test group parameters (optional) - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testGroupParametersTest() throws ApiException { - Integer requiredStringGroup = null; - Boolean requiredBooleanGroup = null; - Long requiredInt64Group = null; - Integer stringGroup = null; - Boolean booleanGroup = null; - Long int64Group = null; - api.testGroupParameters() - .requiredStringGroup(requiredStringGroup) - .requiredBooleanGroup(requiredBooleanGroup) - .requiredInt64Group(requiredInt64Group) - .stringGroup(stringGroup) - .booleanGroup(booleanGroup) - .int64Group(int64Group) - .execute(); - // TODO: test validations - } - - /** - * test inline additionalProperties - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testInlineAdditionalPropertiesTest() throws ApiException { - Map<String, String> param = null; - api.testInlineAdditionalProperties(param); - // TODO: test validations - } - - /** - * test json serialization of form data - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testJsonFormDataTest() throws ApiException { - String param = null; - String param2 = null; - api.testJsonFormData(param, param2); - // TODO: test validations - } - - /** - * - * - * To test the collection format in query parameters - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testQueryParameterCollectionFormatTest() throws ApiException { - List<String> pipe = null; - List<String> ioutil = null; - List<String> http = null; - List<String> url = null; - List<String> context = null; - api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); - // TODO: test validations - } - + /** + * To test the collection format in query parameters + * + * @throws ApiException if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + // List<String> pipe = null; + // List<String> ioutil = null; + // List<String> http = null; + // List<String> url = null; + // List<String> context = null; + // api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + // TODO: test validations + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java index 71999316797a..037e053f8be3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -3,48 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.api; -import org.openapitools.client.ApiException; -import org.openapitools.client.model.Client; import org.junit.Test; -import org.junit.Ignore; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.ApiException; -/** - * API tests for FakeClassnameTags123Api - */ -@Ignore +/** API tests for FakeClassnameTags123Api */ public class FakeClassnameTags123ApiTest { - private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); - - /** - * To test class name in snake case - * - * To test class name in snake case - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void testClassnameTest() throws ApiException { - Client body = null; - Client response = api.testClassname(body); - // TODO: test validations - } - + /** + * To test class name in snake case + * + * <p>To test class name in snake case + * + * @throws ApiException if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + // Client client = null; + // Client response = api.testClassname(client); + // TODO: test validations + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java index fd382967f1d2..3321098abd36 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -3,177 +3,143 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.api; -import org.openapitools.client.ApiException; -import java.io.File; -import org.openapitools.client.model.ModelApiResponse; -import org.openapitools.client.model.Pet; import org.junit.Test; -import org.junit.Ignore; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.ApiException; -/** - * API tests for PetApi - */ -@Ignore +/** API tests for PetApi */ public class PetApiTest { - private final PetApi api = new PetApi(); + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * @throws ApiException if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + // Pet pet = null; + // api.addPet(pet); + // TODO: test validations + } + + /** + * Deletes a pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + // Long petId = null; + // String apiKey = null; + // api.deletePet(petId, apiKey); + // TODO: test validations + } + + /** + * Finds Pets by status + * + * <p>Multiple status values can be provided with comma separated strings + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + // List<String> status = null; + // List<Pet> response = api.findPetsByStatus(status); + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * <p>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for + * testing. + * + * @throws ApiException if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + // List<String> tags = null; + // List<Pet> response = api.findPetsByTags(tags); + // TODO: test validations + } + + /** + * Find pet by ID + * + * <p>Returns a single pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + // Long petId = null; + // Pet response = api.getPetById(petId); + // TODO: test validations + } + + /** + * Update an existing pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + // Pet pet = null; + // api.updatePet(pet); + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * @throws ApiException if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + // Long petId = null; + // String name = null; + // String status = null; + // api.updatePetWithForm(petId, name, status); + // TODO: test validations + } + + /** + * uploads an image + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + // Long petId = null; + // String additionalMetadata = null; + // File file = null; + // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + // TODO: test validations + } - - /** - * Add a new pet to the store - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void addPetTest() throws ApiException { - Pet body = null; - api.addPet(body); - // TODO: test validations - } - - /** - * Deletes a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deletePetTest() throws ApiException { - Long petId = null; - String apiKey = null; - api.deletePet(petId, apiKey); - // TODO: test validations - } - - /** - * Finds Pets by status - * - * Multiple status values can be provided with comma separated strings - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void findPetsByStatusTest() throws ApiException { - List<String> status = null; - List<Pet> response = api.findPetsByStatus(status); - // TODO: test validations - } - - /** - * Finds Pets by tags - * - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void findPetsByTagsTest() throws ApiException { - List<String> tags = null; - List<Pet> response = api.findPetsByTags(tags); - // TODO: test validations - } - - /** - * Find pet by ID - * - * Returns a single pet - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getPetByIdTest() throws ApiException { - Long petId = null; - Pet response = api.getPetById(petId); - // TODO: test validations - } - - /** - * Update an existing pet - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updatePetTest() throws ApiException { - Pet body = null; - api.updatePet(body); - // TODO: test validations - } - - /** - * Updates a pet in the store with form data - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updatePetWithFormTest() throws ApiException { - Long petId = null; - String name = null; - String status = null; - api.updatePetWithForm(petId, name, status); - // TODO: test validations - } - - /** - * uploads an image - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void uploadFileTest() throws ApiException { - Long petId = null; - String additionalMetadata = null; - File file = null; - ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); - // TODO: test validations - } - - /** - * uploads an image (required) - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void uploadFileWithRequiredFileTest() throws ApiException { - Long petId = null; - File requiredFile = null; - String additionalMetadata = null; - ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - // TODO: test validations - } - + /** + * uploads an image (required) + * + * @throws ApiException if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + // Long petId = null; + // File requiredFile = null; + // String additionalMetadata = null; + // ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, + // additionalMetadata); + // TODO: test validations + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java index cd36a70fece3..fb025663bf57 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -3,92 +3,75 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.api; -import org.openapitools.client.ApiException; -import org.openapitools.client.model.Order; import org.junit.Test; -import org.junit.Ignore; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.ApiException; -/** - * API tests for StoreApi - */ -@Ignore +/** API tests for StoreApi */ public class StoreApiTest { - private final StoreApi api = new StoreApi(); + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * <p>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers + * will generate API errors + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + // String orderId = null; + // api.deleteOrder(orderId); + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * <p>Returns a map of status codes to quantities + * + * @throws ApiException if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + // Map<String, Integer> response = api.getInventory(); + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * <p>For valid response try integer IDs with value <= 5 or > 10. Other values will + * generated exceptions + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + // 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 - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deleteOrderTest() throws ApiException { - String orderId = null; - api.deleteOrder(orderId); - // TODO: test validations - } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getInventoryTest() throws ApiException { - Map<String, Integer> response = api.getInventory(); - // TODO: test validations - } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getOrderByIdTest() throws ApiException { - Long orderId = null; - Order response = api.getOrderById(orderId); - // TODO: test validations - } - - /** - * Place an order for a pet - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void placeOrderTest() throws ApiException { - Order body = null; - Order response = api.placeOrder(body); - // TODO: test validations - } - + /** + * Place an order for a pet + * + * @throws ApiException if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + // Order order = null; + // Order response = api.placeOrder(order); + // TODO: test validations + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java index f7ef9050c955..741cb5ab8e7c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -3,154 +3,123 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.api; -import org.openapitools.client.ApiException; -import org.openapitools.client.model.User; import org.junit.Test; -import org.junit.Ignore; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.ApiException; -/** - * API tests for UserApi - */ -@Ignore +/** API tests for UserApi */ public class UserApiTest { - private final UserApi api = new UserApi(); + private final UserApi api = new UserApi(); + + /** + * Create user + * + * <p>This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + // User user = null; + // api.createUser(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + // List<User> user = null; + // api.createUsersWithArrayInput(user); + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * @throws ApiException if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + // List<User> user = null; + // api.createUsersWithListInput(user); + // TODO: test validations + } + + /** + * Delete user + * + * <p>This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + // String username = null; + // api.deleteUser(username); + // TODO: test validations + } + + /** + * Get user by user name + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + // String username = null; + // User response = api.getUserByName(username); + // TODO: test validations + } + + /** + * Logs user into the system + * + * @throws ApiException if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + // String username = null; + // String password = null; + // String response = api.loginUser(username, password); + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * @throws ApiException if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + // api.logoutUser(); + // TODO: test validations + } - - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUserTest() throws ApiException { - User body = null; - api.createUser(body); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUsersWithArrayInputTest() throws ApiException { - List<User> body = null; - api.createUsersWithArrayInput(body); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void createUsersWithListInputTest() throws ApiException { - List<User> body = null; - api.createUsersWithListInput(body); - // TODO: test validations - } - - /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void deleteUserTest() throws ApiException { - String username = null; - api.deleteUser(username); - // TODO: test validations - } - - /** - * Get user by user name - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void getUserByNameTest() throws ApiException { - String username = null; - User response = api.getUserByName(username); - // TODO: test validations - } - - /** - * Logs user into the system - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void loginUserTest() throws ApiException { - String username = null; - String password = null; - String response = api.loginUser(username, password); - // TODO: test validations - } - - /** - * Logs out current logged in user session - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void logoutUserTest() throws ApiException { - api.logoutUser(); - // TODO: test validations - } - - /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updateUserTest() throws ApiException { - String username = null; - User body = null; - api.updateUser(username, body); - // TODO: test validations - } - + /** + * Updated user + * + * <p>This can only be done by the logged in user. + * + * @throws ApiException if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + // String username = null; + // User user = null; + // api.updateUser(username, user); + // TODO: test validations + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java deleted file mode 100644 index ec44af783873..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesAnyType - */ -public class AdditionalPropertiesAnyTypeTest { - private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); - - /** - * Model tests for AdditionalPropertiesAnyType - */ - @Test - public void testAdditionalPropertiesAnyType() { - // TODO: test AdditionalPropertiesAnyType - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java deleted file mode 100644 index ceb024c5620b..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesArray - */ -public class AdditionalPropertiesArrayTest { - private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); - - /** - * Model tests for AdditionalPropertiesArray - */ - @Test - public void testAdditionalPropertiesArray() { - // TODO: test AdditionalPropertiesArray - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java deleted file mode 100644 index 517e5a10ae43..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesBoolean - */ -public class AdditionalPropertiesBooleanTest { - private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); - - /** - * Model tests for AdditionalPropertiesBoolean - */ - @Test - public void testAdditionalPropertiesBoolean() { - // TODO: test AdditionalPropertiesBoolean - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java index 2e3844ba9756..b83e07ecea18 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -3,131 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -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; - -/** - * Model tests for AdditionalPropertiesClass - */ +/** Model tests for AdditionalPropertiesClass */ public class AdditionalPropertiesClassTest { - private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); - - /** - * Model tests for AdditionalPropertiesClass - */ - @Test - public void testAdditionalPropertiesClass() { - // TODO: test AdditionalPropertiesClass - } - - /** - * Test the property 'mapString' - */ - @Test - public void mapStringTest() { - // TODO: test mapString - } - - /** - * Test the property 'mapNumber' - */ - @Test - public void mapNumberTest() { - // TODO: test mapNumber - } - - /** - * Test the property 'mapInteger' - */ - @Test - public void mapIntegerTest() { - // TODO: test mapInteger - } - - /** - * Test the property 'mapBoolean' - */ - @Test - public void mapBooleanTest() { - // TODO: test mapBoolean - } - - /** - * Test the property 'mapArrayInteger' - */ - @Test - public void mapArrayIntegerTest() { - // TODO: test mapArrayInteger - } - - /** - * Test the property 'mapArrayAnytype' - */ - @Test - public void mapArrayAnytypeTest() { - // TODO: test mapArrayAnytype - } - - /** - * Test the property 'mapMapString' - */ - @Test - public void mapMapStringTest() { - // TODO: test mapMapString - } - - /** - * Test the property 'mapMapAnytype' - */ - @Test - public void mapMapAnytypeTest() { - // TODO: test mapMapAnytype - } - - /** - * Test the property 'anytype1' - */ - @Test - public void anytype1Test() { - // TODO: test anytype1 - } - - /** - * Test the property 'anytype2' - */ - @Test - public void anytype2Test() { - // TODO: test anytype2 - } - - /** - * Test the property 'anytype3' - */ - @Test - public void anytype3Test() { - // TODO: test anytype3 - } - + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** Model tests for AdditionalPropertiesClass */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** Test the property 'mapProperty' */ + @Test + public void mapPropertyTest() { + // TODO: test mapProperty + } + + /** Test the property 'mapOfMapProperty' */ + @Test + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java deleted file mode 100644 index 66a7b85623e3..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesInteger - */ -public class AdditionalPropertiesIntegerTest { - private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); - - /** - * Model tests for AdditionalPropertiesInteger - */ - @Test - public void testAdditionalPropertiesInteger() { - // TODO: test AdditionalPropertiesInteger - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java deleted file mode 100644 index 4e03485a4484..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesNumber - */ -public class AdditionalPropertiesNumberTest { - private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); - - /** - * Model tests for AdditionalPropertiesNumber - */ - @Test - public void testAdditionalPropertiesNumber() { - // TODO: test AdditionalPropertiesNumber - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java deleted file mode 100644 index e0c72c586347..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesObject - */ -public class AdditionalPropertiesObjectTest { - private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); - - /** - * Model tests for AdditionalPropertiesObject - */ - @Test - public void testAdditionalPropertiesObject() { - // TODO: test AdditionalPropertiesObject - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java deleted file mode 100644 index c84d987e7640..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for AdditionalPropertiesString - */ -public class AdditionalPropertiesStringTest { - private final AdditionalPropertiesString model = new AdditionalPropertiesString(); - - /** - * Model tests for AdditionalPropertiesString - */ - @Test - public void testAdditionalPropertiesString() { - // TODO: test AdditionalPropertiesString - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java index c0d10ec5a3d8..d0e9913bfa8b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -3,57 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -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; - -/** - * Model tests for Animal - */ +/** Model tests for Animal */ public class AnimalTest { - private final Animal model = new Animal(); - - /** - * Model tests for Animal - */ - @Test - public void testAnimal() { - // TODO: test Animal - } - - /** - * Test the property 'className' - */ - @Test - public void classNameTest() { - // TODO: test className - } - - /** - * Test the property 'color' - */ - @Test - public void colorTest() { - // TODO: test color - } - + private final Animal model = new Animal(); + + /** Model tests for Animal */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** Test the property 'className' */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** Test the property 'color' */ + @Test + public void colorTest() { + // TODO: test color + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java index e25187a3b608..28f62e428d90 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -3,50 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for ArrayOfArrayOfNumberOnly - */ +/** Model tests for ArrayOfArrayOfNumberOnly */ public class ArrayOfArrayOfNumberOnlyTest { - private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); - - /** - * Model tests for ArrayOfArrayOfNumberOnly - */ - @Test - public void testArrayOfArrayOfNumberOnly() { - // TODO: test ArrayOfArrayOfNumberOnly - } - - /** - * Test the property 'arrayArrayNumber' - */ - @Test - public void arrayArrayNumberTest() { - // TODO: test arrayArrayNumber - } - + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** Model tests for ArrayOfArrayOfNumberOnly */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** Test the property 'arrayArrayNumber' */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java index ae1061823991..534bec6678e3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -3,50 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for ArrayOfNumberOnly - */ +/** Model tests for ArrayOfNumberOnly */ public class ArrayOfNumberOnlyTest { - private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); - - /** - * Model tests for ArrayOfNumberOnly - */ - @Test - public void testArrayOfNumberOnly() { - // TODO: test ArrayOfNumberOnly - } - - /** - * Test the property 'arrayNumber' - */ - @Test - public void arrayNumberTest() { - // TODO: test arrayNumber - } - + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** Model tests for ArrayOfNumberOnly */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** Test the property 'arrayNumber' */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java index 36bd9951cf60..76ca006cd488 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -3,66 +3,42 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for ArrayTest - */ +/** Model tests for ArrayTest */ public class ArrayTestTest { - private final ArrayTest model = new ArrayTest(); - - /** - * Model tests for ArrayTest - */ - @Test - public void testArrayTest() { - // TODO: test ArrayTest - } - - /** - * Test the property 'arrayOfString' - */ - @Test - public void arrayOfStringTest() { - // TODO: test arrayOfString - } - - /** - * Test the property 'arrayArrayOfInteger' - */ - @Test - public void arrayArrayOfIntegerTest() { - // TODO: test arrayArrayOfInteger - } - - /** - * Test the property 'arrayArrayOfModel' - */ - @Test - public void arrayArrayOfModelTest() { - // TODO: test arrayArrayOfModel - } - + private final ArrayTest model = new ArrayTest(); + + /** Model tests for ArrayTest */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** Test the property 'arrayOfString' */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** Test the property 'arrayArrayOfInteger' */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** Test the property 'arrayArrayOfModel' */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java deleted file mode 100644 index a9b13011f001..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - - -/** - * Model tests for BigCatAllOf - */ -public class BigCatAllOfTest { - private final BigCatAllOf model = new BigCatAllOf(); - - /** - * Model tests for BigCatAllOf - */ - @Test - public void testBigCatAllOf() { - // TODO: test BigCatAllOf - } - - /** - * Test the property 'kind' - */ - @Test - public void kindTest() { - // TODO: test kind - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java deleted file mode 100644 index 006c80707427..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/BigCatTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for BigCat - */ -public class BigCatTest { - private final BigCat model = new BigCat(); - - /** - * Model tests for BigCat - */ - @Test - public void testBigCat() { - // TODO: test BigCat - } - - /** - * Test the property 'className' - */ - @Test - public void classNameTest() { - // TODO: test className - } - - /** - * Test the property 'color' - */ - @Test - public void colorTest() { - // TODO: test color - } - - /** - * Test the property 'declawed' - */ - @Test - public void declawedTest() { - // TODO: test declawed - } - - /** - * Test the property 'kind' - */ - @Test - public void kindTest() { - // TODO: test kind - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java index a701b341fc59..dfe40524dc16 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -3,87 +3,60 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Capitalization - */ +/** Model tests for Capitalization */ public class CapitalizationTest { - private final Capitalization model = new Capitalization(); - - /** - * Model tests for Capitalization - */ - @Test - public void testCapitalization() { - // TODO: test Capitalization - } - - /** - * Test the property 'smallCamel' - */ - @Test - public void smallCamelTest() { - // TODO: test smallCamel - } - - /** - * Test the property 'capitalCamel' - */ - @Test - public void capitalCamelTest() { - // TODO: test capitalCamel - } - - /** - * Test the property 'smallSnake' - */ - @Test - public void smallSnakeTest() { - // TODO: test smallSnake - } - - /** - * Test the property 'capitalSnake' - */ - @Test - public void capitalSnakeTest() { - // TODO: test capitalSnake - } - - /** - * Test the property 'scAETHFlowPoints' - */ - @Test - public void scAETHFlowPointsTest() { - // TODO: test scAETHFlowPoints - } - - /** - * Test the property 'ATT_NAME' - */ - @Test - public void ATT_NAMETest() { - // TODO: test ATT_NAME - } - + private final Capitalization model = new Capitalization(); + + /** Model tests for Capitalization */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** Test the property 'smallCamel' */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** Test the property 'capitalCamel' */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** Test the property 'smallSnake' */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** Test the property 'capitalSnake' */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** Test the property 'scAETHFlowPoints' */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** Test the property 'ATT_NAME' */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java index 1d85a0447253..ff21459308ce 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatAllOfTest.java @@ -3,47 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for CatAllOf - */ +/** Model tests for CatAllOf */ public class CatAllOfTest { - private final CatAllOf model = new CatAllOf(); - - /** - * Model tests for CatAllOf - */ - @Test - public void testCatAllOf() { - // TODO: test CatAllOf - } - - /** - * Test the property 'declawed' - */ - @Test - public void declawedTest() { - // TODO: test declawed - } - + private final CatAllOf model = new CatAllOf(); + + /** Model tests for CatAllOf */ + @Test + public void testCatAllOf() { + // TODO: test CatAllOf + } + + /** Test the property 'declawed' */ + @Test + public void declawedTest() { + // TODO: test declawed + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java index dbf40678a2d0..5cb2d0c25be2 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CatTest.java @@ -3,65 +3,42 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.openapitools.client.model.Animal; -import org.openapitools.client.model.CatAllOf; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Cat - */ +/** Model tests for Cat */ public class CatTest { - private final Cat model = new Cat(); - - /** - * Model tests for Cat - */ - @Test - public void testCat() { - // TODO: test Cat - } - - /** - * Test the property 'className' - */ - @Test - public void classNameTest() { - // TODO: test className - } - - /** - * Test the property 'color' - */ - @Test - public void colorTest() { - // TODO: test color - } - - /** - * Test the property 'declawed' - */ - @Test - public void declawedTest() { - // TODO: test declawed - } - + private final Cat model = new Cat(); + + /** Model tests for Cat */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** Test the property 'className' */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** Test the property 'color' */ + @Test + public void colorTest() { + // TODO: test color + } + + /** Test the property 'declawed' */ + @Test + public void declawedTest() { + // TODO: test declawed + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java index 6027994a2ac3..3f1a86d0d65c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -3,55 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Category - */ +/** Model tests for Category */ public class CategoryTest { - private final Category model = new Category(); - - /** - * Model tests for Category - */ - @Test - public void testCategory() { - // TODO: test Category - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - + private final Category model = new Category(); + + /** Model tests for Category */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** Test the property 'id' */ + @Test + public void idTest() { + // TODO: test id + } + + /** Test the property 'name' */ + @Test + public void nameTest() { + // TODO: test name + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java index 8914c9cad43d..9c42158b1796 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -3,47 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for ClassModel - */ +/** Model tests for ClassModel */ public class ClassModelTest { - private final ClassModel model = new ClassModel(); - - /** - * Model tests for ClassModel - */ - @Test - public void testClassModel() { - // TODO: test ClassModel - } - - /** - * Test the property 'propertyClass' - */ - @Test - public void propertyClassTest() { - // TODO: test propertyClass - } - + private final ClassModel model = new ClassModel(); + + /** Model tests for ClassModel */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** Test the property 'propertyClass' */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java index c21b346272d7..4fd6c7eed63a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ClientTest.java @@ -3,47 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Client - */ +/** Model tests for Client */ public class ClientTest { - private final Client model = new Client(); - - /** - * Model tests for Client - */ - @Test - public void testClient() { - // TODO: test Client - } - - /** - * Test the property 'client' - */ - @Test - public void clientTest() { - // TODO: test client - } - + private final Client model = new Client(); + + /** Model tests for Client */ + @Test + public void testClient() { + // TODO: test Client + } + + /** Test the property 'client' */ + @Test + public void clientTest() { + // TODO: test client + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java index 6e4b49108098..067f41054652 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogAllOfTest.java @@ -3,47 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for DogAllOf - */ +/** Model tests for DogAllOf */ public class DogAllOfTest { - private final DogAllOf model = new DogAllOf(); - - /** - * Model tests for DogAllOf - */ - @Test - public void testDogAllOf() { - // TODO: test DogAllOf - } - - /** - * Test the property 'breed' - */ - @Test - public void breedTest() { - // TODO: test breed - } - + private final DogAllOf model = new DogAllOf(); + + /** Model tests for DogAllOf */ + @Test + public void testDogAllOf() { + // TODO: test DogAllOf + } + + /** Test the property 'breed' */ + @Test + public void breedTest() { + // TODO: test breed + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java index a46bc508d48c..9218b4cbe74c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/DogTest.java @@ -3,65 +3,42 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for Dog - */ +/** Model tests for Dog */ public class DogTest { - private final Dog model = new Dog(); - - /** - * Model tests for Dog - */ - @Test - public void testDog() { - // TODO: test Dog - } - - /** - * Test the property 'className' - */ - @Test - public void classNameTest() { - // TODO: test className - } - - /** - * Test the property 'color' - */ - @Test - public void colorTest() { - // TODO: test color - } - - /** - * Test the property 'breed' - */ - @Test - public void breedTest() { - // TODO: test breed - } - + private final Dog model = new Dog(); + + /** Model tests for Dog */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** Test the property 'className' */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** Test the property 'color' */ + @Test + public void colorTest() { + // TODO: test color + } + + /** Test the property 'breed' */ + @Test + public void breedTest() { + // TODO: test breed + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java index 45b8fbbd8220..84565e8dc8d3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -3,57 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for EnumArrays - */ +/** Model tests for EnumArrays */ public class EnumArraysTest { - private final EnumArrays model = new EnumArrays(); - - /** - * Model tests for EnumArrays - */ - @Test - public void testEnumArrays() { - // TODO: test EnumArrays - } - - /** - * Test the property 'justSymbol' - */ - @Test - public void justSymbolTest() { - // TODO: test justSymbol - } - - /** - * Test the property 'arrayEnum' - */ - @Test - public void arrayEnumTest() { - // TODO: test arrayEnum - } - + private final EnumArrays model = new EnumArrays(); + + /** Model tests for EnumArrays */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** Test the property 'justSymbol' */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** Test the property 'arrayEnum' */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java index 9e45543facd2..612c74bee784 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -3,31 +3,22 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for EnumClass - */ +/** Model tests for EnumClass */ public class EnumClassTest { - /** - * Model tests for EnumClass - */ - @Test - public void testEnumClass() { - // TODO: test EnumClass - } - + /** Model tests for EnumClass */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java index 04e7afb19784..19a61f3331bf 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -3,80 +3,72 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for EnumTest - */ +/** Model tests for EnumTest */ public class EnumTestTest { - private final EnumTest model = new EnumTest(); + private final EnumTest model = new EnumTest(); + + /** Model tests for EnumTest */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** Test the property 'enumString' */ + @Test + public void enumStringTest() { + // TODO: test enumString + } - /** - * Model tests for EnumTest - */ - @Test - public void testEnumTest() { - // TODO: test EnumTest - } + /** Test the property 'enumStringRequired' */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } - /** - * Test the property 'enumString' - */ - @Test - public void enumStringTest() { - // TODO: test enumString - } + /** Test the property 'enumInteger' */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } - /** - * Test the property 'enumStringRequired' - */ - @Test - public void enumStringRequiredTest() { - // TODO: test enumStringRequired - } + /** Test the property 'enumNumber' */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } - /** - * Test the property 'enumInteger' - */ - @Test - public void enumIntegerTest() { - // TODO: test enumInteger - } + /** Test the property 'outerEnum' */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } - /** - * Test the property 'enumNumber' - */ - @Test - public void enumNumberTest() { - // TODO: test enumNumber - } + /** Test the property 'outerEnumInteger' */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } - /** - * Test the property 'outerEnum' - */ - @Test - public void outerEnumTest() { - // TODO: test outerEnum - } + /** Test the property 'outerEnumDefaultValue' */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + /** Test the property 'outerEnumIntegerDefaultValue' */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java index ef37e666be39..daf85bc331fb 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -3,57 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for FileSchemaTestClass - */ +/** Model tests for FileSchemaTestClass */ public class FileSchemaTestClassTest { - private final FileSchemaTestClass model = new FileSchemaTestClass(); - - /** - * Model tests for FileSchemaTestClass - */ - @Test - public void testFileSchemaTestClass() { - // TODO: test FileSchemaTestClass - } - - /** - * Test the property 'file' - */ - @Test - public void fileTest() { - // TODO: test file - } - - /** - * Test the property 'files' - */ - @Test - public void filesTest() { - // TODO: test files - } - + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** Model tests for FileSchemaTestClass */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** Test the property 'file' */ + @Test + public void fileTest() { + // TODO: test file + } + + /** Test the property 'files' */ + @Test + public void filesTest() { + // TODO: test files + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FooTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FooTest.java new file mode 100644 index 000000000000..041cadbb3925 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FooTest.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for Foo */ +public class FooTest { + private final Foo model = new Foo(); + + /** Model tests for Foo */ + @Test + public void testFoo() { + // TODO: test Foo + } + + /** Test the property 'bar' */ + @Test + public void barTest() { + // TODO: test bar + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java index 710501b51bd4..0352bcb57e0a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -3,156 +3,114 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.File; -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; - -/** - * Model tests for FormatTest - */ +/** Model tests for FormatTest */ public class FormatTestTest { - private final FormatTest model = new FormatTest(); - - /** - * Model tests for FormatTest - */ - @Test - public void testFormatTest() { - // TODO: test FormatTest - } - - /** - * Test the property 'integer' - */ - @Test - public void integerTest() { - // TODO: test integer - } - - /** - * Test the property 'int32' - */ - @Test - public void int32Test() { - // TODO: test int32 - } - - /** - * Test the property 'int64' - */ - @Test - public void int64Test() { - // TODO: test int64 - } - - /** - * Test the property 'number' - */ - @Test - public void numberTest() { - // TODO: test number - } - - /** - * Test the property '_float' - */ - @Test - public void _floatTest() { - // TODO: test _float - } - - /** - * Test the property '_double' - */ - @Test - public void _doubleTest() { - // TODO: test _double - } - - /** - * Test the property 'string' - */ - @Test - public void stringTest() { - // TODO: test string - } - - /** - * Test the property '_byte' - */ - @Test - public void _byteTest() { - // TODO: test _byte - } - - /** - * Test the property 'binary' - */ - @Test - public void binaryTest() { - // TODO: test binary - } - - /** - * Test the property 'date' - */ - @Test - public void dateTest() { - // TODO: test date - } - - /** - * Test the property 'dateTime' - */ - @Test - public void dateTimeTest() { - // TODO: test dateTime - } - - /** - * Test the property 'uuid' - */ - @Test - public void uuidTest() { - // TODO: test uuid - } - - /** - * Test the property 'password' - */ - @Test - public void passwordTest() { - // TODO: test password - } - - /** - * Test the property 'bigDecimal' - */ - @Test - public void bigDecimalTest() { - // TODO: test bigDecimal - } - + private final FormatTest model = new FormatTest(); + + /** Model tests for FormatTest */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** Test the property 'integer' */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** Test the property 'int32' */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** Test the property 'int64' */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** Test the property 'number' */ + @Test + public void numberTest() { + // TODO: test number + } + + /** Test the property '_float' */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** Test the property '_double' */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** Test the property 'string' */ + @Test + public void stringTest() { + // TODO: test string + } + + /** Test the property '_byte' */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** Test the property 'binary' */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** Test the property 'date' */ + @Test + public void dateTest() { + // TODO: test date + } + + /** Test the property 'dateTime' */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** Test the property 'uuid' */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** Test the property 'password' */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** Test the property 'patternWithDigits' */ + @Test + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** Test the property 'patternWithDigitsAndDelimiter' */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java index e902c100383b..8003b98d3feb 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -3,55 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for HasOnlyReadOnly - */ +/** Model tests for HasOnlyReadOnly */ public class HasOnlyReadOnlyTest { - private final HasOnlyReadOnly model = new HasOnlyReadOnly(); - - /** - * Model tests for HasOnlyReadOnly - */ - @Test - public void testHasOnlyReadOnly() { - // TODO: test HasOnlyReadOnly - } - - /** - * Test the property 'bar' - */ - @Test - public void barTest() { - // TODO: test bar - } - - /** - * Test the property 'foo' - */ - @Test - public void fooTest() { - // TODO: test foo - } - + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** Model tests for HasOnlyReadOnly */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** Test the property 'bar' */ + @Test + public void barTest() { + // TODO: test bar + } + + /** Test the property 'foo' */ + @Test + public void fooTest() { + // TODO: test foo + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..d95e717df8de --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for HealthCheckResult */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** Model tests for HealthCheckResult */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** Test the property 'nullableMessage' */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject1Test.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject1Test.java new file mode 100644 index 000000000000..09d84e4bc5cb --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject1Test.java @@ -0,0 +1,38 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineObject1 */ +public class InlineObject1Test { + private final InlineObject1 model = new InlineObject1(); + + /** Model tests for InlineObject1 */ + @Test + public void testInlineObject1() { + // TODO: test InlineObject1 + } + + /** Test the property 'additionalMetadata' */ + @Test + public void additionalMetadataTest() { + // TODO: test additionalMetadata + } + + /** Test the property 'file' */ + @Test + public void fileTest() { + // TODO: test file + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject2Test.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject2Test.java new file mode 100644 index 000000000000..797b297ddd49 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject2Test.java @@ -0,0 +1,38 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineObject2 */ +public class InlineObject2Test { + private final InlineObject2 model = new InlineObject2(); + + /** Model tests for InlineObject2 */ + @Test + public void testInlineObject2() { + // TODO: test InlineObject2 + } + + /** Test the property 'enumFormStringArray' */ + @Test + public void enumFormStringArrayTest() { + // TODO: test enumFormStringArray + } + + /** Test the property 'enumFormString' */ + @Test + public void enumFormStringTest() { + // TODO: test enumFormString + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject3Test.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject3Test.java new file mode 100644 index 000000000000..4e60b5d4e623 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject3Test.java @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineObject3 */ +public class InlineObject3Test { + private final InlineObject3 model = new InlineObject3(); + + /** Model tests for InlineObject3 */ + @Test + public void testInlineObject3() { + // TODO: test InlineObject3 + } + + /** Test the property 'integer' */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** Test the property 'int32' */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** Test the property 'int64' */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** Test the property 'number' */ + @Test + public void numberTest() { + // TODO: test number + } + + /** Test the property '_float' */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** Test the property '_double' */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** Test the property 'string' */ + @Test + public void stringTest() { + // TODO: test string + } + + /** Test the property 'patternWithoutDelimiter' */ + @Test + public void patternWithoutDelimiterTest() { + // TODO: test patternWithoutDelimiter + } + + /** Test the property '_byte' */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** Test the property 'binary' */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** Test the property 'date' */ + @Test + public void dateTest() { + // TODO: test date + } + + /** Test the property 'dateTime' */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** Test the property 'password' */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** Test the property 'callback' */ + @Test + public void callbackTest() { + // TODO: test callback + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject4Test.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject4Test.java new file mode 100644 index 000000000000..c03f7058e132 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject4Test.java @@ -0,0 +1,38 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineObject4 */ +public class InlineObject4Test { + private final InlineObject4 model = new InlineObject4(); + + /** Model tests for InlineObject4 */ + @Test + public void testInlineObject4() { + // TODO: test InlineObject4 + } + + /** Test the property 'param' */ + @Test + public void paramTest() { + // TODO: test param + } + + /** Test the property 'param2' */ + @Test + public void param2Test() { + // TODO: test param2 + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject5Test.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject5Test.java new file mode 100644 index 000000000000..322e6fe99b77 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObject5Test.java @@ -0,0 +1,38 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineObject5 */ +public class InlineObject5Test { + private final InlineObject5 model = new InlineObject5(); + + /** Model tests for InlineObject5 */ + @Test + public void testInlineObject5() { + // TODO: test InlineObject5 + } + + /** Test the property 'additionalMetadata' */ + @Test + public void additionalMetadataTest() { + // TODO: test additionalMetadata + } + + /** Test the property 'requiredFile' */ + @Test + public void requiredFileTest() { + // TODO: test requiredFile + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObjectTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObjectTest.java new file mode 100644 index 000000000000..7a7bff5a4d89 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineObjectTest.java @@ -0,0 +1,38 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineObject */ +public class InlineObjectTest { + private final InlineObject model = new InlineObject(); + + /** Model tests for InlineObject */ + @Test + public void testInlineObject() { + // TODO: test InlineObject + } + + /** Test the property 'name' */ + @Test + public void nameTest() { + // TODO: test name + } + + /** Test the property 'status' */ + @Test + public void statusTest() { + // TODO: test status + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java new file mode 100644 index 000000000000..b3e1afbb488d --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for InlineResponseDefault */ +public class InlineResponseDefaultTest { + private final InlineResponseDefault model = new InlineResponseDefault(); + + /** Model tests for InlineResponseDefault */ + @Test + public void testInlineResponseDefault() { + // TODO: test InlineResponseDefault + } + + /** Test the property 'string' */ + @Test + public void stringTest() { + // TODO: test string + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java index a0c991bb7588..d13b22eb9c56 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -3,74 +3,48 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for MapTest - */ +/** Model tests for MapTest */ public class MapTestTest { - private final MapTest model = new MapTest(); - - /** - * Model tests for MapTest - */ - @Test - public void testMapTest() { - // TODO: test MapTest - } - - /** - * Test the property 'mapMapOfString' - */ - @Test - public void mapMapOfStringTest() { - // TODO: test mapMapOfString - } - - /** - * Test the property 'mapOfEnumString' - */ - @Test - public void mapOfEnumStringTest() { - // TODO: test mapOfEnumString - } - - /** - * Test the property 'directMap' - */ - @Test - public void directMapTest() { - // TODO: test directMap - } - - /** - * Test the property 'indirectMap' - */ - @Test - public void indirectMapTest() { - // TODO: test indirectMap - } - + private final MapTest model = new MapTest(); + + /** Model tests for MapTest */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** Test the property 'mapMapOfString' */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** Test the property 'mapOfEnumString' */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** Test the property 'directMap' */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** Test the property 'indirectMap' */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java index f8a8c734baaf..1c31132b63e4 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -3,69 +3,43 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.List; -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; - -/** - * Model tests for MixedPropertiesAndAdditionalPropertiesClass - */ +/** Model tests for MixedPropertiesAndAdditionalPropertiesClass */ public class MixedPropertiesAndAdditionalPropertiesClassTest { - private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); - - /** - * Model tests for MixedPropertiesAndAdditionalPropertiesClass - */ - @Test - public void testMixedPropertiesAndAdditionalPropertiesClass() { - // TODO: test MixedPropertiesAndAdditionalPropertiesClass - } - - /** - * Test the property 'uuid' - */ - @Test - public void uuidTest() { - // TODO: test uuid - } - - /** - * Test the property 'dateTime' - */ - @Test - public void dateTimeTest() { - // TODO: test dateTime - } - - /** - * Test the property 'map' - */ - @Test - public void mapTest() { - // TODO: test map - } - + private final MixedPropertiesAndAdditionalPropertiesClass model = + new MixedPropertiesAndAdditionalPropertiesClass(); + + /** Model tests for MixedPropertiesAndAdditionalPropertiesClass */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** Test the property 'uuid' */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** Test the property 'dateTime' */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** Test the property 'map' */ + @Test + public void mapTest() { + // TODO: test map + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java index 82c7208079db..5100638e4a4e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -3,55 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Model200Response - */ +/** Model tests for Model200Response */ public class Model200ResponseTest { - private final Model200Response model = new Model200Response(); - - /** - * Model tests for Model200Response - */ - @Test - public void testModel200Response() { - // TODO: test Model200Response - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - - /** - * Test the property 'propertyClass' - */ - @Test - public void propertyClassTest() { - // TODO: test propertyClass - } - + private final Model200Response model = new Model200Response(); + + /** Model tests for Model200Response */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** Test the property 'name' */ + @Test + public void nameTest() { + // TODO: test name + } + + /** Test the property 'propertyClass' */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java index 97a1287aa413..73815c5cd2c9 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -3,63 +3,42 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for ModelApiResponse - */ +/** Model tests for ModelApiResponse */ public class ModelApiResponseTest { - private final ModelApiResponse model = new ModelApiResponse(); - - /** - * Model tests for ModelApiResponse - */ - @Test - public void testModelApiResponse() { - // TODO: test ModelApiResponse - } - - /** - * Test the property 'code' - */ - @Test - public void codeTest() { - // TODO: test code - } - - /** - * Test the property 'type' - */ - @Test - public void typeTest() { - // TODO: test type - } - - /** - * Test the property 'message' - */ - @Test - public void messageTest() { - // TODO: test message - } - + private final ModelApiResponse model = new ModelApiResponse(); + + /** Model tests for ModelApiResponse */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** Test the property 'code' */ + @Test + public void codeTest() { + // TODO: test code + } + + /** Test the property 'type' */ + @Test + public void typeTest() { + // TODO: test type + } + + /** Test the property 'message' */ + @Test + public void messageTest() { + // TODO: test message + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java index f884519ebc86..7a9283f8e305 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -3,47 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for ModelReturn - */ +/** Model tests for ModelReturn */ public class ModelReturnTest { - private final ModelReturn model = new ModelReturn(); - - /** - * Model tests for ModelReturn - */ - @Test - public void testModelReturn() { - // TODO: test ModelReturn - } - - /** - * Test the property '_return' - */ - @Test - public void _returnTest() { - // TODO: test _return - } - + private final ModelReturn model = new ModelReturn(); + + /** Model tests for ModelReturn */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** Test the property '_return' */ + @Test + public void _returnTest() { + // TODO: test _return + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java index cb3a94cf74ab..25e9e4235dfd 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NameTest.java @@ -3,71 +3,48 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Name - */ +/** Model tests for Name */ public class NameTest { - private final Name model = new Name(); - - /** - * Model tests for Name - */ - @Test - public void testName() { - // TODO: test Name - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - - /** - * Test the property 'snakeCase' - */ - @Test - public void snakeCaseTest() { - // TODO: test snakeCase - } - - /** - * Test the property 'property' - */ - @Test - public void propertyTest() { - // TODO: test property - } - - /** - * Test the property '_123number' - */ - @Test - public void _123numberTest() { - // TODO: test _123number - } - + private final Name model = new Name(); + + /** Model tests for Name */ + @Test + public void testName() { + // TODO: test Name + } + + /** Test the property 'name' */ + @Test + public void nameTest() { + // TODO: test name + } + + /** Test the property 'snakeCase' */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** Test the property 'property' */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** Test the property '_123number' */ + @Test + public void _123numberTest() { + // TODO: test _123number + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..75bd91eb2ab5 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NullableClassTest.java @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for NullableClass */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** Model tests for NullableClass */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** Test the property 'integerProp' */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** Test the property 'numberProp' */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** Test the property 'booleanProp' */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** Test the property 'stringProp' */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** Test the property 'dateProp' */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** Test the property 'datetimeProp' */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** Test the property 'arrayNullableProp' */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** Test the property 'arrayAndItemsNullableProp' */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** Test the property 'arrayItemsNullable' */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** Test the property 'objectNullableProp' */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** Test the property 'objectAndItemsNullableProp' */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** Test the property 'objectItemsNullable' */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java index f4fbd5ee8b42..58903742494e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -3,48 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for NumberOnly - */ +/** Model tests for NumberOnly */ public class NumberOnlyTest { - private final NumberOnly model = new NumberOnly(); - - /** - * Model tests for NumberOnly - */ - @Test - public void testNumberOnly() { - // TODO: test NumberOnly - } - - /** - * Test the property 'justNumber' - */ - @Test - public void justNumberTest() { - // TODO: test justNumber - } - + private final NumberOnly model = new NumberOnly(); + + /** Model tests for NumberOnly */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** Test the property 'justNumber' */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java index d24c8479f5d6..4ab5900bc660 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OrderTest.java @@ -3,88 +3,60 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for Order - */ +/** Model tests for Order */ public class OrderTest { - private final Order model = new Order(); - - /** - * Model tests for Order - */ - @Test - public void testOrder() { - // TODO: test Order - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'petId' - */ - @Test - public void petIdTest() { - // TODO: test petId - } - - /** - * Test the property 'quantity' - */ - @Test - public void quantityTest() { - // TODO: test quantity - } - - /** - * Test the property 'shipDate' - */ - @Test - public void shipDateTest() { - // TODO: test shipDate - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - // TODO: test status - } - - /** - * Test the property 'complete' - */ - @Test - public void completeTest() { - // TODO: test complete - } - + private final Order model = new Order(); + + /** Model tests for Order */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** Test the property 'id' */ + @Test + public void idTest() { + // TODO: test id + } + + /** Test the property 'petId' */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** Test the property 'quantity' */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** Test the property 'shipDate' */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** Test the property 'status' */ + @Test + public void statusTest() { + // TODO: test status + } + + /** Test the property 'complete' */ + @Test + public void completeTest() { + // TODO: test complete + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java index ebea3ca304c0..34a36bc70c9c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -3,64 +3,42 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - -/** - * Model tests for OuterComposite - */ +/** Model tests for OuterComposite */ public class OuterCompositeTest { - private final OuterComposite model = new OuterComposite(); - - /** - * Model tests for OuterComposite - */ - @Test - public void testOuterComposite() { - // TODO: test OuterComposite - } - - /** - * Test the property 'myNumber' - */ - @Test - public void myNumberTest() { - // TODO: test myNumber - } - - /** - * Test the property 'myString' - */ - @Test - public void myStringTest() { - // TODO: test myString - } - - /** - * Test the property 'myBoolean' - */ - @Test - public void myBooleanTest() { - // TODO: test myBoolean - } - + private final OuterComposite model = new OuterComposite(); + + /** Model tests for OuterComposite */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** Test the property 'myNumber' */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** Test the property 'myString' */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** Test the property 'myBoolean' */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..532de56f3744 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,24 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for OuterEnumDefaultValue */ +public class OuterEnumDefaultValueTest { + /** Model tests for OuterEnumDefaultValue */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..d84b8439bf89 --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,24 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for OuterEnumIntegerDefaultValue */ +public class OuterEnumIntegerDefaultValueTest { + /** Model tests for OuterEnumIntegerDefaultValue */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..fa41152d9aec --- /dev/null +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,24 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import org.junit.Test; + +/** Model tests for OuterEnumInteger */ +public class OuterEnumIntegerTest { + /** Model tests for OuterEnumInteger */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } +} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java index cf0ebae0faf0..fedf75f02517 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -3,31 +3,22 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for OuterEnum - */ +/** Model tests for OuterEnum */ public class OuterEnumTest { - /** - * Model tests for OuterEnum - */ - @Test - public void testOuterEnum() { - // TODO: test OuterEnum - } - + /** Model tests for OuterEnum */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java index c3c0d4cc35dd..fb50cb4a802b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/PetTest.java @@ -3,91 +3,60 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; -import org.openapitools.client.model.Category; -import org.openapitools.client.model.Tag; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Pet - */ +/** Model tests for Pet */ public class PetTest { - private final Pet model = new Pet(); - - /** - * Model tests for Pet - */ - @Test - public void testPet() { - // TODO: test Pet - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'category' - */ - @Test - public void categoryTest() { - // TODO: test category - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - - /** - * Test the property 'photoUrls' - */ - @Test - public void photoUrlsTest() { - // TODO: test photoUrls - } - - /** - * Test the property 'tags' - */ - @Test - public void tagsTest() { - // TODO: test tags - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - // TODO: test status - } - + private final Pet model = new Pet(); + + /** Model tests for Pet */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** Test the property 'id' */ + @Test + public void idTest() { + // TODO: test id + } + + /** Test the property 'category' */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** Test the property 'name' */ + @Test + public void nameTest() { + // TODO: test name + } + + /** Test the property 'photoUrls' */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** Test the property 'tags' */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** Test the property 'status' */ + @Test + public void statusTest() { + // TODO: test status + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java index b82a7d0ef561..f78797805ba6 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -3,55 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for ReadOnlyFirst - */ +/** Model tests for ReadOnlyFirst */ public class ReadOnlyFirstTest { - private final ReadOnlyFirst model = new ReadOnlyFirst(); - - /** - * Model tests for ReadOnlyFirst - */ - @Test - public void testReadOnlyFirst() { - // TODO: test ReadOnlyFirst - } - - /** - * Test the property 'bar' - */ - @Test - public void barTest() { - // TODO: test bar - } - - /** - * Test the property 'baz' - */ - @Test - public void bazTest() { - // TODO: test baz - } - + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** Model tests for ReadOnlyFirst */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** Test the property 'bar' */ + @Test + public void barTest() { + // TODO: test bar + } + + /** Test the property 'baz' */ + @Test + public void bazTest() { + // TODO: test baz + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java index d5a19c371e68..d5103f58db5e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -3,47 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for SpecialModelName - */ +/** Model tests for SpecialModelName */ public class SpecialModelNameTest { - private final SpecialModelName model = new SpecialModelName(); - - /** - * Model tests for SpecialModelName - */ - @Test - public void testSpecialModelName() { - // TODO: test SpecialModelName - } - - /** - * Test the property '$specialPropertyName' - */ - @Test - public void $specialPropertyNameTest() { - // TODO: test $specialPropertyName - } - + private final SpecialModelName model = new SpecialModelName(); + + /** Model tests for SpecialModelName */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** Test the property '$specialPropertyName' */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java index 5c2cc6f49e05..459a4e165d2b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TagTest.java @@ -3,55 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for Tag - */ +/** Model tests for Tag */ public class TagTest { - private final Tag model = new Tag(); - - /** - * Model tests for Tag - */ - @Test - public void testTag() { - // TODO: test Tag - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - + private final Tag model = new Tag(); + + /** Model tests for Tag */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** Test the property 'id' */ + @Test + public void idTest() { + // TODO: test id + } + + /** Test the property 'name' */ + @Test + public void nameTest() { + // TODO: test name + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java deleted file mode 100644 index e96ac744439d..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for TypeHolderDefault - */ -public class TypeHolderDefaultTest { - private final TypeHolderDefault model = new TypeHolderDefault(); - - /** - * Model tests for TypeHolderDefault - */ - @Test - public void testTypeHolderDefault() { - // TODO: test TypeHolderDefault - } - - /** - * Test the property 'stringItem' - */ - @Test - public void stringItemTest() { - // TODO: test stringItem - } - - /** - * Test the property 'numberItem' - */ - @Test - public void numberItemTest() { - // TODO: test numberItem - } - - /** - * Test the property 'integerItem' - */ - @Test - public void integerItemTest() { - // TODO: test integerItem - } - - /** - * Test the property 'boolItem' - */ - @Test - public void boolItemTest() { - // TODO: test boolItem - } - - /** - * Test the property 'arrayItem' - */ - @Test - public void arrayItemTest() { - // TODO: test arrayItem - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java deleted file mode 100644 index 56641d163a50..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for TypeHolderExample - */ -public class TypeHolderExampleTest { - private final TypeHolderExample model = new TypeHolderExample(); - - /** - * Model tests for TypeHolderExample - */ - @Test - public void testTypeHolderExample() { - // TODO: test TypeHolderExample - } - - /** - * Test the property 'stringItem' - */ - @Test - public void stringItemTest() { - // TODO: test stringItem - } - - /** - * Test the property 'numberItem' - */ - @Test - public void numberItemTest() { - // TODO: test numberItem - } - - /** - * Test the property 'floatItem' - */ - @Test - public void floatItemTest() { - // TODO: test floatItem - } - - /** - * Test the property 'integerItem' - */ - @Test - public void integerItemTest() { - // TODO: test integerItem - } - - /** - * Test the property 'boolItem' - */ - @Test - public void boolItemTest() { - // TODO: test boolItem - } - - /** - * Test the property 'arrayItem' - */ - @Test - public void arrayItemTest() { - // TODO: test arrayItem - } - -} diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java index ce40d3a2a637..44acdc6fdc4e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/UserTest.java @@ -3,103 +3,72 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ - package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - -/** - * Model tests for User - */ +/** Model tests for User */ public class UserTest { - private final User model = new User(); - - /** - * Model tests for User - */ - @Test - public void testUser() { - // TODO: test User - } + private final User model = new User(); - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } + /** Model tests for User */ + @Test + public void testUser() { + // TODO: test User + } - /** - * Test the property 'username' - */ - @Test - public void usernameTest() { - // TODO: test username - } + /** Test the property 'id' */ + @Test + public void idTest() { + // TODO: test id + } - /** - * Test the property 'firstName' - */ - @Test - public void firstNameTest() { - // TODO: test firstName - } + /** Test the property 'username' */ + @Test + public void usernameTest() { + // TODO: test username + } - /** - * Test the property 'lastName' - */ - @Test - public void lastNameTest() { - // TODO: test lastName - } + /** Test the property 'firstName' */ + @Test + public void firstNameTest() { + // TODO: test firstName + } - /** - * Test the property 'email' - */ - @Test - public void emailTest() { - // TODO: test email - } + /** Test the property 'lastName' */ + @Test + public void lastNameTest() { + // TODO: test lastName + } - /** - * Test the property 'password' - */ - @Test - public void passwordTest() { - // TODO: test password - } + /** Test the property 'email' */ + @Test + public void emailTest() { + // TODO: test email + } - /** - * Test the property 'phone' - */ - @Test - public void phoneTest() { - // TODO: test phone - } + /** Test the property 'password' */ + @Test + public void passwordTest() { + // TODO: test password + } - /** - * Test the property 'userStatus' - */ - @Test - public void userStatusTest() { - // TODO: test userStatus - } + /** Test the property 'phone' */ + @Test + public void phoneTest() { + // TODO: test phone + } + /** Test the property 'userStatus' */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java deleted file mode 100644 index 501c414555f4..000000000000 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/model/XmlItemTest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.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; - - -/** - * Model tests for XmlItem - */ -public class XmlItemTest { - private final XmlItem model = new XmlItem(); - - /** - * Model tests for XmlItem - */ - @Test - public void testXmlItem() { - // TODO: test XmlItem - } - - /** - * Test the property 'attributeString' - */ - @Test - public void attributeStringTest() { - // TODO: test attributeString - } - - /** - * Test the property 'attributeNumber' - */ - @Test - public void attributeNumberTest() { - // TODO: test attributeNumber - } - - /** - * Test the property 'attributeInteger' - */ - @Test - public void attributeIntegerTest() { - // TODO: test attributeInteger - } - - /** - * Test the property 'attributeBoolean' - */ - @Test - public void attributeBooleanTest() { - // TODO: test attributeBoolean - } - - /** - * Test the property 'wrappedArray' - */ - @Test - public void wrappedArrayTest() { - // TODO: test wrappedArray - } - - /** - * Test the property 'nameString' - */ - @Test - public void nameStringTest() { - // TODO: test nameString - } - - /** - * Test the property 'nameNumber' - */ - @Test - public void nameNumberTest() { - // TODO: test nameNumber - } - - /** - * Test the property 'nameInteger' - */ - @Test - public void nameIntegerTest() { - // TODO: test nameInteger - } - - /** - * Test the property 'nameBoolean' - */ - @Test - public void nameBooleanTest() { - // TODO: test nameBoolean - } - - /** - * Test the property 'nameArray' - */ - @Test - public void nameArrayTest() { - // TODO: test nameArray - } - - /** - * Test the property 'nameWrappedArray' - */ - @Test - public void nameWrappedArrayTest() { - // TODO: test nameWrappedArray - } - - /** - * Test the property 'prefixString' - */ - @Test - public void prefixStringTest() { - // TODO: test prefixString - } - - /** - * Test the property 'prefixNumber' - */ - @Test - public void prefixNumberTest() { - // TODO: test prefixNumber - } - - /** - * Test the property 'prefixInteger' - */ - @Test - public void prefixIntegerTest() { - // TODO: test prefixInteger - } - - /** - * Test the property 'prefixBoolean' - */ - @Test - public void prefixBooleanTest() { - // TODO: test prefixBoolean - } - - /** - * Test the property 'prefixArray' - */ - @Test - public void prefixArrayTest() { - // TODO: test prefixArray - } - - /** - * Test the property 'prefixWrappedArray' - */ - @Test - public void prefixWrappedArrayTest() { - // TODO: test prefixWrappedArray - } - - /** - * Test the property 'namespaceString' - */ - @Test - public void namespaceStringTest() { - // TODO: test namespaceString - } - - /** - * Test the property 'namespaceNumber' - */ - @Test - public void namespaceNumberTest() { - // TODO: test namespaceNumber - } - - /** - * Test the property 'namespaceInteger' - */ - @Test - public void namespaceIntegerTest() { - // TODO: test namespaceInteger - } - - /** - * Test the property 'namespaceBoolean' - */ - @Test - public void namespaceBooleanTest() { - // TODO: test namespaceBoolean - } - - /** - * Test the property 'namespaceArray' - */ - @Test - public void namespaceArrayTest() { - // TODO: test namespaceArray - } - - /** - * Test the property 'namespaceWrappedArray' - */ - @Test - public void namespaceWrappedArrayTest() { - // TODO: test namespaceWrappedArray - } - - /** - * Test the property 'prefixNsString' - */ - @Test - public void prefixNsStringTest() { - // TODO: test prefixNsString - } - - /** - * Test the property 'prefixNsNumber' - */ - @Test - public void prefixNsNumberTest() { - // TODO: test prefixNsNumber - } - - /** - * Test the property 'prefixNsInteger' - */ - @Test - public void prefixNsIntegerTest() { - // TODO: test prefixNsInteger - } - - /** - * Test the property 'prefixNsBoolean' - */ - @Test - public void prefixNsBooleanTest() { - // TODO: test prefixNsBoolean - } - - /** - * Test the property 'prefixNsArray' - */ - @Test - public void prefixNsArrayTest() { - // TODO: test prefixNsArray - } - - /** - * Test the property 'prefixNsWrappedArray' - */ - @Test - public void prefixNsWrappedArrayTest() { - // TODO: test prefixNsWrappedArray - } - -} diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml index 8ac184e2ef72..af7148414b93 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -1194,7 +1194,8 @@ paths: responses: "200": description: The instance started successfully - security: [] + security: + - http_signature_test: [] summary: test http signature authentication tags: - fake diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md index eab45b0e2c29..e0f01098a5dc 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md @@ -82,7 +82,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index 20d18e8499b2..5046a502e194 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -85,10 +85,13 @@ test http signature authentication require_once(__DIR__ . '/vendor/autoload.php'); + + $apiInstance = new OpenAPI\Client\Api\FakeApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client() + new GuzzleHttp\Client(), + $config ); $pet = new \OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet | Pet object that needs to be added to the store $query_1 = 'query_1_example'; // string | query parameter @@ -117,7 +120,7 @@ void (empty response body) ### Authorization -No authorization required +[http_signature_test](../../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index cf1e1179db5f..50de8cc758fa 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -96,9 +96,73 @@ configuration = petstore_api.Configuration( host = "http://petstore.swagger.io:80/v2" ) +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) # Enter a context with an instance of the API client -with petstore_api.ApiClient() as api_client: +with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = petstore_api.FakeApi(api_client) pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store @@ -126,7 +190,7 @@ void (empty response body) ### Authorization -No authorization required +[http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 71be34c74bff..01f431fb4303 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -243,7 +243,7 @@ def fake_http_signature_test_with_http_info(self, pet, **kwargs): # noqa: E501 ['application/json', 'application/xml']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['http_signature_test'] # noqa: E501 return self.api_client.call_api( '/fake/http-signature-test', 'GET', diff --git a/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md b/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md index a8256c46dd4b..4552514bc792 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/ruby-faraday/docs/FakeApi.md @@ -74,6 +74,9 @@ test http signature authentication ```ruby # load the gem require 'petstore' +# setup authorization +Petstore.configure do |config| +end api_instance = Petstore::FakeApi.new pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store @@ -105,7 +108,7 @@ nil (empty response body) ### Authorization -No authorization required +[http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index 26194b07ed3d..293aeaa698c6 100644 --- a/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -121,7 +121,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) return_type = opts[:return_type] # auth_names - auth_names = opts[:auth_names] || [] + auth_names = opts[:auth_names] || ['http_signature_test'] new_options = opts.merge( :header_params => header_params, diff --git a/samples/openapi3/client/petstore/ruby/docs/FakeApi.md b/samples/openapi3/client/petstore/ruby/docs/FakeApi.md index a8256c46dd4b..4552514bc792 100644 --- a/samples/openapi3/client/petstore/ruby/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/ruby/docs/FakeApi.md @@ -74,6 +74,9 @@ test http signature authentication ```ruby # load the gem require 'petstore' +# setup authorization +Petstore.configure do |config| +end api_instance = Petstore::FakeApi.new pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store @@ -105,7 +108,7 @@ nil (empty response body) ### Authorization -No authorization required +[http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb index 26194b07ed3d..293aeaa698c6 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -121,7 +121,7 @@ def fake_http_signature_test_with_http_info(pet, opts = {}) return_type = opts[:return_type] # auth_names - auth_names = opts[:auth_names] || [] + auth_names = opts[:auth_names] || ['http_signature_test'] new_options = opts.merge( :header_params => header_params, 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 9d984b50904d..76b5c00f7dbf 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 @@ -80,7 +80,9 @@ public Response fakeHealthGet(@Context SecurityContext securityContext) @Path("/http-signature-test") @Consumes({ "application/json", "application/xml" }) - @io.swagger.annotations.ApiOperation(value = "test http signature authentication", notes = "", response = Void.class, tags={ "fake", }) + @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) }) public Response fakeHttpSignatureTest(@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet From eccdf1d6675ca56405234fee32d4c06a5d4c6ba6 Mon Sep 17 00:00:00 2001 From: Alexander Hirner <a.hirner@gmail.com> Date: Mon, 27 Apr 2020 18:10:42 +0200 Subject: [PATCH 23/78] add MoonVision user (#6076) * add MoonVision user * add moonvision to readme list --- README.md | 1 + website/src/dynamic/users.yml | 5 +++++ website/static/img/companies/moonvision.png | Bin 0 -> 10935 bytes 3 files changed, 6 insertions(+) create mode 100644 website/static/img/companies/moonvision.png diff --git a/README.md b/README.md index 1fa10dd45ee7..0e45c2ff4772 100644 --- a/README.md +++ b/README.md @@ -614,6 +614,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [MailSlurp](https://www.mailslurp.com) - [Médiavision](https://www.mediavision.fr/) - [Metaswitch](https://www.metaswitch.com/) +- [MoonVision](https://www.moonvision.io/) - [Myworkout](https://myworkout.com) - [NamSor](https://www.namsor.com/) - [Openet](https://www.openet.com/) diff --git a/website/src/dynamic/users.yml b/website/src/dynamic/users.yml index da74a98af9e6..835ff1d0b535 100644 --- a/website/src/dynamic/users.yml +++ b/website/src/dynamic/users.yml @@ -243,6 +243,11 @@ image: "img/companies/metaswitch.svg" infoLink: "https://www.metaswitch.com/" pinned: true +- + caption: MoonVision + image: "img/companies/moonvision.png" + infoLink: "https://www.moonvision.io/" + pinned: false - caption: Myworkout image: "img/companies/myworkout.png" diff --git a/website/static/img/companies/moonvision.png b/website/static/img/companies/moonvision.png new file mode 100644 index 0000000000000000000000000000000000000000..b04d7116f973945a2fddc35538a86ae8478fa053 GIT binary patch literal 10935 zcmaiacQ~9+)HbooD$!Y@_ZnqIbXM=ZN3V+@Sb`|A`dYpB)k1X9dx#osi6Dp`S-nIe zk>K0k`~Cf1??2D;Tr+3R+;e8;%$euhiH7<bWW<cbI5;?DTAHfHI5-c`*l!dO0Q*ec z&Ai9H9ysY}sN&qmr%n&z;0V0XQiYfXub$Y3yiWPdct3+|L57n6v&+?t*x$MFyUay! z`wP>uTUl$iY3F(v(XfB5G@frXZ4<H9G@fVS_u;b|{5$U8w(+CrHVnLp{QmN;Fl6&b z$yw3&+y3uzg6|zfL8JuHL;w4WGZlqXTLui>)z*Cvn;sStde4~`>(Pb3E6S8xE}f!* zTf&EJKLO<0rnwqDv5ZSzNzH?-#V1=veE}g?b(gT(DOvby;*ZX$Iv%CJt3Mgm)>Uz* z*#){{dyb^hFc2DMwHsmbzTZ-_NfD6i#>#KUDPvNqR+zI2T01|3Qnlsgv4xJ&)?H7} z8?BapIRRJMW2=j>m|>a_`uYh<&)L<8_o`XnCf%_r88YUX?f0dmS$$;FQxJVb*rx0m zKX9J6RW91MFixH0@Hi0>RQyesq}UZBBX{Okc(1Rcm@4Z>D)OHhT*{dho>rp6e>0Ig zgBZ&bjOMhYaG6C}NLpskfsu|Gj+<D0>2pTRB8-&ZW!9tI>=vyUZd)h{$x7NOnL`{w zq+|2R%6T<`m22@9VpN}_<-tJr9rdsZ?t|}sR3a47LsHg$l1os{OIaIMUW0F35@XT7 zOD_+4#povcbV&(zp(?n#!*=-6r{iEK{mW1xxPoN^*MWsmK7G=V1CyTALtp-Ajnlay zrDLu(la&3Jux)&2QIH17s#BfQcR5zxz2UrqZC8A)Ib}yXNi5WRu?K`)62TNxhO+b; zOS)y$k@U2|2Ov`Q2zB=9OyezgXx7oL&M47w8uCnIaU0)76!eF-szsZTNnF5j;ea)M zG{fjFQL-<Alz>yQJVV0zoVlpT!Pz_Bo}2M<s4op$JXnU{`ZN}yt2yCP`t1U#Y7l`h z!h>BB1~mv)t)9R5Gt|M0oLUAa(OntzSwjwctZ3`6om3m(a$p2If2foQKUS7ilcTOe zNU2Ot^p~flf$^27ojDdfYZ^lS!KgP$hI0jA7D7lms+SjK6-<;Q_UMxseg&G=y#kgt zpZnnzK#f(&-OlpA7U#GSKQE(=mQFYnkr+(8xr5^Qvfw840ni2!YnrDY{o&$&-_zHO zg?&~buT@oAj&xO|6=M={$PJXPi)?19kXwj<<D}rRQ$MUT<sf>g(8$Gq!<i-Cr%0B& z<9d8uFZ)}Ppe*Lo@62-?hFi;`+#KwPED#aPuXhA?B^RbKOLxQ1tNUT%-ANG{^#4`b zBkW?!5wB_;2gH5bo~@;hGcAZ$IRNMB$LYjD$S~dcCM^N7oYBa0gBSj@S093ZC-6>s zfKvXpfPRSLGt&f;CvDj}X+$uJ2x0A{!<SM}c?Qs%7Xd2FYk^`;{5ZdV@FpCq04vbl zh4OyXj<5&`(*em!Ka;>pbMhrx{eC2NJfvI6V0<M`GwrVzST9<+vUx$kG9-Z<b0AfI zNjk>2{@N-SXdjYK^R%L2Z@Cx}oL>2(91KGCz0P{BrB=$**afe|RHtw;F(U`tWcJAY z2v<E0@#)l@kt5=Soqb66tK6%#qy(Yo(<E~aqExIZoO@<#dF8As#0#4CiS=!N7zwm! zDI|!?X!o}aybv4lOBpO@>`bS`=L^_gM${Spv6MB=?*&SziHx}u53j@dS)Ozxp`LDZ zR$@vGjTe@!w^u3qeq-mX#jjM!=H0(Z3n*TDYsZ<GsHT6_8<&-izOQ@--*txu_vYBX zs9_x%r+$qvX#dx?>cQtXH2t)kaJK=klvE_}#==87sxa1z{vD1e2&t+@wLznK#PW?f z*Ngv#ZNJRsJe_CvWFp{~6Y*ggnH{A%+Ok&s3m>wbg#<TxNK@BF^;l8I^VG=XiX2K= z-Qtryg2%J_b0SjR`rk&C5CGe+*hPnuWjN_+hRKz<jxSjNO|sm<nUDhLE606dEyg{u zIbNY~^!1Pf7fS&N;4e!C^0bowrdrAkAt)Hr>$0Pq#FkYHPyP8x2<x{vFW5YN3mG?c zOs=%&RR8*O0iW0vF#Xw_o`~cTc-5n~qO$B}gmv7Bv7rz872E?A_2zx~z+eAt2@WMU z@xO+HqVdx2VP?Nf>{e7n+#LT$k{92<!S~At!;EtKRBE+3wvwNOMzVfQOYwV;w^I<a z6#@wh$|NBOKK`rI(*3u@cd={d0EMCJmALSgRPW!w(jETw#0V*ALKhJRcLzSVt&p%p z`(`q+<1xwS!@ZUXlb9IizS1<h{C2oqe>R0V`=P3J0aUFoQVm$X%x7!}fmYR*nu5GV zfpc5n=R=bJ$e%UiHaS05FDq;R@I1s(?pySPt}y8+OfEH$GCzbSa~?>0Sv1Y(hfHhz z;~Ec{;FA%4DDpETE&?4|?9Y9ivJTz|F_llGJXW1i8ti@|HdrCQsG2NBUDyWh!vBF* z(5GD|sd!W(!MA@-`=-34Of5!PqAfDk!r|W2F>IdkLNIZ&dAP9To+B&4Xpy7jAN+H` z?C67IL$|ar(&EZ_e2zOVV*S69)1$$|N^X){`is|T`B$2ez9B|!pl-kHnG*|=&eAgp z(t>geKK>r50tZo_F(EnlxERUx7NZT4an-%wK^2|MY`57|oZHST9hWLMIKaRc%bGBt zAv<vFd|qs(x-Y4#){fc>dvMx5-SiIk1JfL*(`mNst~R=V@}l(ciM>h!iwIB`UClUP zCKi@7MW*P_4!j9okG{8>oL&Z<V(QZ#U;Qjy=fpfoFI<))cd6m3QdFA{^b=H|gN@~v zFzBG|w`*Q91~Ceu8wi{m1x5@yh_umS>$I=Ybm{VI)G$UL|LMhk@*i^kZ(T|+G+O37 zNY}(RAPoWJ^CojrR4~YM_7bTXuh|XGeGXwhNGio_#$g9tvVR(?&Y`Sg`XBkSG+*9A zV#(tfW;h*LjEX!U@eRhJRnN$XbX?{`=*E5aDZCdHQ*iHWI(Y8NE@E#9S4enRlC@;8 z&?*dh*|ILJvG#cVwP};RF~zdir}^479vHC_y4O(92SB#2?<2h~Oi)dIJHyr(z>RU4 z4!Uu%FXRN+QY_2xFwep`FjTKm_dzL{=Ny>7F&u_B(Jqcx<GQ+PD$WSIh=g*IZANzI zlE!{@1wxG5d94UIFKXjKLoahusHVonqm-X)?YqswI1qaF*x7+_2h{6~GDaiVbd_+k zanL%a^j!|(5yXOXO7AMDq_a0+!xNti6JKPpW0$OqE=ARC7b}UItY@N}SN1?*-yvvz z<(0OL`Fdr#s)_KC2W0I0H?%YmlJdPQE!l+by~U!$r)}4gU{vFY`E1B90P}}ObaC03 zQ+2!2u_Bb$)|5llSddH!k&Lv<&z$x^sUfUl%eXx$N(pbykPk)=jDgvc&-Su?0P+jY z%p0GIYQlg$6;(@CpO*xU2lFXmq)k%&<1B!$N?m3K`UbAO1BxCCQkth$4?}g&+}gM_ zJ~0Mdtfj+ojuQKOS*|rsL!_i2<D@Ck5@UQf65N<pt%e!{+n<6Bk>g5D9Bx^1i`QJx z5E<)8_^Fb@T!WIIg>!ff31qo>QQrOD^hn<%0wB-UJpFvAy97Iwy&`T*VNBnIjGk2k z(M)5OWidHH@hVb#V_8STjH$X@27wc7)YViLL^n%ICoU}oIr|WzzdHVP0}$@>zPQdS zF}iMtjXZLP$pEeZZ79Uzaao9+pRxJJ<oH{gL>)c%s$OZZ>kt(`3ULbp?bqvCOiYhT zYoS?*3K*I9N&Y(Rfz-xDpS>E9vi*Hn;PUqGe8Hj`Y#Dh=nALLJlJ-tLnE|p)lVw?c z;f#O!o~=zor%m-0=~%HPf0hIVetYS~8HW4k(qx!-=_rj2yaO6#j)5C>v3j*pT|Lsj z;J|=_EPJs=mUyAUrsAkJ{A%0hV1F_P<)!mInAPrmI|gA6jr|3Rs)CPxH;SI`rG}9= zOg|qt)`bjmii4@HcLPprpCy~i$=6IvQD2D-&v{gTRy-4XqezWVczrF(EI&`dTfwA1 zVugt-Y_ZukZdK~-Ef!{)sDrvYr9?-U2t&rtU2t~Om?628mv-)@x2_lgpo*4?FNccG zuNs|JJZDahF>ve27?VV1y$3gP;rHL?N<a~K%C=54iw#jvImI2V3hDj3oLa9$yF&mc zlz~!s*e|BxjRD=G1$A$6Csw$EK{sS2xf}X8Js$zm%4(Y$s1n*%LyOgSW-++K2UO4P z(c#<UmIw8pY5IZ7Wwm>=??7C|`+p^z>mMJN{p=Ylfj2435y^l9+JObomw2IYyK-df z;*shcRS^aDye6FmR9*BdpMX^!S(hRoub@C5I1Jz^j)`W_41Ne+Qlfjmhp<_>-!*gW z&3q2(z;dCma+!VvdfZ{S(oG5DkCnwJRC>Ac0E=V8<gM0r|66sR%*A(g(ewTL0w>Hz z_~a^qs`Cy&HQ!N9?-*P0P)$3%;_6=<QJS#c(|45O>$?;i&y~@=es3IoxyizE0s-=t zWlW;iBbX{8?|Ie$dYv;{=OWo=3Lm4e`nzvh=%7=?J|H{-N5#>kJRWz5=tjyvrparf znkC|sOX3wbMh$Te3dqkdPs<<p56nst8zz;r^K1D}f&?q~MihT&w4<pt<0<>;W^~WT z-a}a~gWLCD+bl~VB_1cYFIserS5-VY{>JwQsY1>V3~0*rz)$99vR~TOtc<R>dUP9l z9{y7c*jl8%im;&|gcF1iw2?5BXn=^42skn3d(UB_Y4KTD2kjL*y~1tpB^<c$*NhW< zK=AR4<OL5#8SZ0vJ@G8&7Ns=`QA7~P?D)d>7iHI<EdBa{@$D7Y$0EKZ2oHR6sHKM{ z*F3d$eG8dFyAFzcC7d$geQSJnM9BQlWj3ckwmOswMmqTDuh|;K712VQ>z$*3I+sM3 zg<rog<eK~Yu<&bM8c6jH$t0uv-d42D_XLtgTLrpIRHGu&bu1lqMEsZNYto}9D{@X! zO7;jJ)nj~KtAme&O9~YMdnteXI5D75k5HK<Hv8NZltI?-w8p?N+$rt$P=CP@rMF8@ zzj%<6B^m_ADf(Dpm&-Qw2PBy!z!rfFJn{PXijeYUDQy~xFtZxCCjcQ&^9=v0+&`N= z^61R?qi#>xbmeF!DxR3o{)qrd>Vc1(-T=*4)0LAm<2VBgx{~UE<hPGUYQO9_Eqsa! z5~zD4;n%0k^6{AH#txWm_A=s&r?xmp7~3uL5myBDDL+&skVv|F{JgcBO$ve+Knd2Q z7KjFc?i(*dpTSRaU&vy(620DsrcPgmb05i17NYbzYf=F6YvK{7R8e8t*1DO<a=lhl z8@GcQ%JB3!s9uIFrwq@tQZr9Nc?<uENP9{SS@=~Mi>Dg8iu-RI#I9-0Ffni8<|c?L z+}E~AOehCaX3__=7UBE_uuTn{J&0pfy_lVXQ(dX;VPw8>KswVWbmg0jgfjj|P9{!p zM*}_2M853N7-^{K<Ps0zQj2ueoi`xzDE?@P$@;myHh+uomZ$V23@4vW8+ouHbnwk| z2Na1jGiei2(eQ9wtUkz8*d<~_f$eXxzTK@<$O&FaQ<&?d!ax;1WRUkl=MN#-18Rx$ zvWqY^v1FojKDsQFS4L~II6d%Ya4*3vB&8fa@_u~*j@r!4TfYWLG09L}E$0v?8OUYY z-WXrC!1c_(9WLlfaeXP_vnFJRI%JIyuOlSV4QZtCo4GLG_P}ewgD={?-n+wpCuOMK zkPC#QZks25nJ+@Ij^b01-8NZUwQ*yjQsRam#2D+)<2vY|C#e<=N_7Cm>TV&MyV)e- zcu#evQ}zM<L=9EqCekc`Vy=<HMI$?VRdltae;%JAqJ*OR%w)8El;cx~q1S`tTDm*t z1XO0TX~t<aobpdtjHwR%u^M85o`w7MUa3d^F*<_p2Obhd#o+oYnihgb&8@N2`Q+|T z2f#LlYe=VU@Lf_>6gn2=T3saH#b-g(lNs-=l#Iv`&(tSSwG~Ove<>lptBR%tq?-S{ zIMCg`$<Q}>k^p0UT7mJ0yP26?h<N&-tCkMjYGRtXp(wcscKTnjM6Qw?34zOHn@|;W zo6ki7ThqGeyR+@#KrmD0V8IsuyR+Q}BAG<KY$1c#Gkx^?ua$Kb52q4TB;nMsM{nJK z1HJ>gPXXZ;Os@Mt!Td6yjMl=`_O%=zWSM$e$P@PD?#AU5R**qx&5DT7)FI6e9$Dya zcw0eT<~bJ}ylt&hUZCz~LL8=NBX*9C^d`EIytLv4P+n>8iG-{x@j0(B?Nt$mrVpM` z3Bm~wI`Te$3Ar&QlP1o>Gbsks>Oan;C?seYJ}W{pnRqbQyL@2zdKVts3}aNDsT)BI z4+cYd7%=nGxt{K>QiUWEhlGfb;U&VyH$8%{KsylrOYIU24>F6es`jLQIK$nqxUGcF zD%==z2pyf%JUgr*2y8OhAO&af@}EiSzzICHIc9<c^`HF$=w&+eT&7&aM7vycQNXBO z2a4#6GWL2XVZ?9ah`7P74OkE|DU1*Qn~z(-*FwgZR+i;DZfhjQTsOWM<;!0DGQvB% z=fyj#xH)%tt_@-O-awgbzJK{oI?Z_(ew!~PqMpjQ&WMicio1FQfgOM1NLQL!8eHAQ zJb~a9b6s5(OQ<i!qFz})A|8Yx6a(vO{FBDgk2$Zv_1h;J=<#tYw<W6y-JTtlc_V+u zoGBzVM1!Pzu)bTNR@AUcr+b|Zf<%@F=GShd{#KsY9kjOGZ`Mv>5>zD7Mk@s-w$5?j zj5~nSzn3@cb5{d<*gQD;*z-`ItTD$2{0B@-4bjPtzynpN0b0B?4V0skvh)~Gj3{-? zJRJb~{rrOUye{QjN^Rju=?{Sqj){8Aid^@#Nb<ETPWP%c-44tWr==*bG^cDv=LFlT zjpXRMJIF(5_2vbi3=ohYTceAqyDw=^ik`QSl3NHStL{b#J#1ukq(V3r1ktNgU$yLk zZvfO+9WM9n+231{=JG3`)3)ZxI-pE`JuBZ+s$L3-ew}cg(Ds_+8#L71CTWZ=C(pLR zqrivrU&=5gY*T7#nwd_#f(QDC_hjh>Kz>6!ZTCsy1!CA=<p-1A{Gr78Q}xE2N8+BA z--BmQLvBo7z;nLURD7fkW7Hya)kpJY&UK0Ap_Y07&Yi+S@I&+_9h^Z1JWYP=P?W?# zy364a9THWSQO&q&Xh|x|^dq5{N+J!;piY~1HztvlLJc8LY@J57r{%+vANNUkpi{Tm z81!~j(NC?U5jb^1!`9{VCMQ)E#x&t?{h4-=nVjkY@nO%qqc`XX;g8?wa+Q4Edl47K zlF5USaY;>%2HtoOu;TPAdVAV@7J9`5WRx<YD(;GwD($9}n2=xon(<Ouf+8mY48c=+ zlnAcTZ25rXG{$bVL#!RJA#(*Mbjvhx*q@hj;!G9Y`HYc$17WlIMVYw?;XuvblkLw` z!D;a_%g$=_Ca>#>_~&gPV@;h94!1$jp$=MaM;A@M=LjbVRWV<$abbfGB$zT9#tnBC zs}$c7G4drdWL()f8Q<@w`ojr&G-sLYf&cA^r`BUfeNJVcki>qzu5);;MpvB$-1$)5 zyUz{Gx2?Q?)~V>>Z|bI9eMKlkgY9WG)*Rsayf`v*N~4sI4OXSZt6OCuc=ze`qu})R z7ym`{o$7MJOI&t;d!$v-40HCC!tFU?Yh-xTS83Qmf=Kek*rBUbR4Sx%>Mmo6D2-=~ zz|s~pWY8o3-`xUd@5jxyr9)|LC&QDgjfL6CAd$K4**HM4&}3G+RSM$L<>Cp|uhiD` zb6q@6$K)<X;NTAq42{RnQLktUiCagyBNBb?dddk1d{$~e(WyD}?%6XZnV59ZqUm)< zcCZ_u7@o@&5YVp((Z~!Otm#%LaQDpGS*_vMwcoEM@ENl~f@{#1p_RTNZr|L7?KI<$ z3nrfUaX?WIwoP+A+)(X@`vBWKxzMjnx@ZyJ@#5Qxg_6EEw#{O4j_J9pNL19j3}Ou7 zyJCfPV2>O_Lb`mC7Opb69M?FI5l6r&qnz%WBli{qF0jWNyAA!Yw%~-Kkfv^{f2d%k z6T&^AAB@B-XwwUJ7%tg0hKLeR&G=NyLr1?93?zl7tQMi7I*bdu>nqdsP#;rA+I6BE zhWaa|g?k7qBG!I8IHTYX?~b(4O3YfLIf^fwaNuu#P`T%(>CX}jqXA?%Ribt+*%OAE zIYjE{Cp$u5FJYIlEL4<C#`MwJJ1HU=N|=TYYrGhpKzdRvSEkwnJ%6x@MgUINm_K<) z##RuEB0Q%m-JUmDq?H}>R5L^CVH*J}Na`Ow&(FL$d`5`YyX!)1;3A}*{?<*CL<v2k zsp7a~N;F4&U+OI;Qie6a!i)AcIu}wg-G}OE*lRPse11o6@IFAeY31?@WxgK=rluLA z>m)Bk)L$!#vWt2X(i0p07cy1hM6J^hMpIl*)I*`b{f>KzT6>k^DxAPg&LWGwzvDac zvNv1f>Nlff0YQxE8`}pI63i1UDx@TM6cQ7M7`%5i1FAE={Wd&M9KPgN+}&x;D~Zkz zC?%NRvueA^Jex$4L8iQZ$sMYoo%VWV7<BN4Of0^6Uu3(obu%D{ty@?Sb(^g)iK8;) z9*G|My~psjW;VrQ9O`e{P6mq$8AkpMCRsGMuTdjSY??Fh`Wu`ACSa~@*Xf8$6e>0E z`$oW9sD(rYiwZ{~S3p*skP{QX!v_v%a2ZQMnN&&RYIIS<a2<I~*Dezb$DOKQ;Zy_i z_5@>y<hrT#-%*62z)C62SMnF!m>TE#LT&CCGKd9xtZOgNZYRTrsIF^h{z#-`3_QBF zw`I&J@<+{>+^<Zo9}XtI@W)zlBSqYw>+MTK0c57B0Dop5K{zGszH3q!$RT6G4GzK< zvz;i29jkz)a{Cagti7I%_P*Ot3z3KFwHff&HCHC?R<$oi7+=tj7Nc4Vk~=DDFSUC! zEMW2{b^XgI$uDQ$_cY+Y-ZY%a6Ud;pa~uF<5^T4^PAkZdB>-W84RNv$$uWcXt_S!` z_HY8mG(<{2qP3G5Vv$lfjcm(ecm_A0oc3!3+!l=DKB8bgVKK22=IQXEwY;ytt3-C( zDG5E*|Dak?fd|PQei`3*{I+``1;wi=H03J4?7;BlOzP6w+U&f;eY?Raqavu`H9$Ck z8@cU0O#eOwb)-oa8xS+7=py~}f(L39etZ)}WF4gNYTU#PLG_dQv$(SX`khiCXoFjb zTpe(m<~p!vq)d}?sQK89=C_uIKDw;<Jn(DfB3z^OEO}mG`#K>)K$wt-5emOea7_6n zBMVp1;t&ex2NeG@{VH;ymYZ%9*(8RZe^%F^E0rqK$9yR{eMxU<Cz@Nv=SQUYbepJ0 zS{m<bG-Vrdk03bt=Al<U_Ka#dZtG*9ys}Kf{WR4iU~Hd<{@8bDGqCScezpHiyZDoj zj$;#D_uZ=_u^#Mi39&IoX#6Yd0(TcN{ZpP?aVq&Wjsr$?JMZ0y)~qvB2zw)ZRD>eQ z#LrWvxWXw<y(TKYbzf?wj)Xr}nSJj%MAXy8CFK?$KV9^l4eSFb7H|=|<iPxhElz8! z(Z9ks%U!NCy-UsP-Jrt2#qy#OK}tEIiVTWM^{U327sms`?8dpUs@CevVp&MxP!4J? zmjEOAA~XUa;rmWb>ON?ac@x$52_&F3{qj*Zt>QWnV-1HG;t!RC?f1X3(J@xoKP>9% zKb648N*CPF5Zu_JY=)<B0s#g$fCL9-Cnsc26>r?_TdM9@?+Cgi1<=5h^yN$aC1JB% z`KMZyJ7^#gCV)!BT$)GY6jV44Ecl3UD>zeC#T|N3CddfDq1B2^LQ<@WFFDun39r1> zH$1||Pn;F&J|F5MCt(%SQ&j;8sJh*kVV=;G%H$DSJSrIe!X^jjqpE)Vss{{;HMtBH zaDrLzNAr+uEBE;!gGCz=H%knv?+&)`uA4_^Y%#?pYe8W>RCBO6W*h!a*`Uh|pMJP; zwL9U>M-LxiQf4Y7YA&6C{<#Iu>neRI9d7xPh2JH}Oaz8;%9^1%qfCTBt2qN3Ta<t0 zCWS0ZXr`Pw3BO>+WW+1HD$R6X=JR12x8`MoOc{S3qxfL0qc+aJaC{__@5c+Bw_T1# zeJApG94Ldm9~xNvxzV0H-Lj^^M_Z+@h%zhL*0bGrYMHoiKRkj~mZ#6X$BkzEn5d7w ztmy(h+%l(;4D(kJAD%icGD_o%Ecla;@s@&fk*1y2{eu3xz9lMnh``Q>=AMj~R~{$! zh@?-o`BT?%s2}oAU2dB-maCfr21(3>#?@ZhkBNV>&oJIpbqgc1rmOs>gjNCk(1Xk{ zgM}p07%bTscAE0I-a4myNJ;YnA2(F6uPJi8oNnb=ZhzRMu|o+H!<Qdx#{Js%M>=IZ z8j*?-B={pgoBlhVB}G(z{JrS!xN^eq&+dxw$I8JiH`K6~dZneZlL_(=gVf;1!U;6@ zGXu+Z+*T?8Zs^wYs%fF86RBS{Cqg}V!4UvkOF?iPARG~Becf6QOJmslu#7A=&|Otf z!)+k7IofK3MdCQ=$zi8BZO>hHec(NxDaV<viiTX-;?Ui5OJ!J|KY;K;Jk(VOlodEG zsamTw2h|~!bHRpAHE(q3_SDh%6Ed6m-oYspSA&zc=MN+(`x-Ll88&6Q^m-`Uj`xZK zz0l7Dz|j%|G(6(F8tBmc?vHI1HFgGPslCR*Lolsi#Lj1jt3LZ@#XVWgk#^pq<VKHf z@Ue#Z3*dsH>P)GNyWw7<Bo*__-t+k3eox$-vX>THY+vbSMc&n@eAm_;H-u?;!NzfH zQsZ09>)wWITxP^!Z;#pj596g9zGuBBP<{pXdGq_9&!|aWg3dhd*B9I@Tzxg-oUo*k zD3sY@_cYO1z4#~A<!#4$AQyN5K-OmZ5h(^Spobd}Tb@yGE-G;AdAhvw>ZPG2a=mfS ze4k(qr>Zg>V25srSA@<4oru&i#!qGtNep(3p{YkoQJ-But`qejcJL!sjMR^bLXFeR zK($QivJl?g7Mm=FNVqw}gfLN0)eA4LhD%%1?Q6-r)3qlOeu|#utOqUW9*p(gY~`=; z@3q3eOcutdP+U?%@NUU;q6#`1mIfBz21}jS{mN;nup@%&5AVDOkd40i*2lz-Q6_dS z@_6<ZC?CL!S<lX=02He(y=dXWn6j_x*h9LWZd-Zns790xC;m-UArbD(S1i9+pZHDM zx7!@4Px;`*<0*IS&~sFOcDMbM`r`OcE05*{?|qjVFo6O<Mw1!3*h2+-rWJWq<T_$b zXscmJxZ2K2%cB+vpVi9;LeNTL;`g1jkfiLMJ9JMaH{}<=beui$OPz;7vgG)(BH6zm z!9)-5J$GgwtoF(fg`N`YH;t=d(>qE}%CefCJ=;oeYs(&!a9g^QY#xs1g>JcMf!+y1 zc(=VabC)wwQ9Y|Y(U%=o>CgE{A>T`;W7whH)0XuuH6}~+Z=Y++`KN9F@N{C=S`b7> zBb!%a9Id|(k}h(RKI0h~kTCoOAK`(r;qO*%jJSDo%DlQmTv}qfc|-A^2$wP-P*D#n zr?y4Ee*tM2YvnU>LAO-JH=Zs^e=J1>Xt*h3j~Lv^AUc4pQi7Si*H#>d=U$ND$0vyd z8HF@K+x5!mc?ZI<;FphkaOIs}Z2AoY?1~Kj3v72F8sS&0U9(bcYRNaVul|UTB1bN` zp!3$-8t89Cg;Qav`GF)qAHO~lqIDn?TRUf>g`)yg+=j9JRh;o3xW!M;&~i*lgMam8 z3zb+eJNP$=o+e**-05Txn8=3@GMp~|;DNY@W%zV1%10zoLTX!F%5hnEy&iq!-wteh zIZe!zfyzuou6&T&-!>}i9Fx{Z;}{ZjQu<1KHMdlij^n@-<>aRUieq?hiEdQ4w>qY` z8V6kB%nETlY;mUM)LD`kOwJQ_Eo!^iay}K&b2L%F#t0jj_q7-D+~*jin91ZmRZSVv z;a!whLc^EdSHAR1p0AeV#onnN|5o@-0c$h7$h8YN$@OWY=y6Q+7rB*nduIL=sD+m1 z2eSjQQk8$+wSoHtTs%eRzsTw7&eYL)oEjL#g|bR$zJTSGxKms!`f?pQUFLo&%4H|x zC2p`0l@Y`yYJXTrn~rnmA$VIDH=Q5-aun%sq*fT=SckKi^Kw|wDA|&Z_Xp!1os)EM z#tk;pZf@yK54A%*{-v8Y=)gAq-3T!qG^APh3Zn&de$=h!!-<szUB7CC+r;Jvli6<( zKL21ImTZ=nY6RU%o9XWpEx8l|{}K;qQ8MBAlBTo$2oAFElp=j;I8tZpt2=j{p0AK1 zc7wkrl&L6&<(E9<v|53)N-TgsvxDXPoYOno8A7J-rru|A;k|X)uj!ZC#Q4nbeS*hE zVYA_kHxx!sdAed?um50=Qg>$Uou%hmx-WOxi=g%C<)0)UO7!$1QS7gh@c)x$F-}-q zvPGUUiM*9{-xYg?^HYq%S&T+lxIFw&lj+tM+-ENVXmf=8m+?-xi=p?goiBc=(>Bri zfbYmva~P^MyAnbmjlkWq8M^<YLiYg68_Cn;ejx87(F3-snfC7rcda4m80B9;(EK1f zkftpKUU#^&|ECS{IHqMrNJcc#kly7DpY&r4Uy^gJ1f5S*3nw~oxL@S|(+b9tR1cU< zQu_;OyQ8Zg<px?*fX4U*XxBZuUJ-Z_v3I<xulUJ;&F^a%MWc^4Jj1T55YK0O#i-qb zlN*S6GPwoG#~+eOp7N{J5L16JwF|@I!*s>+iMy5*^+$2+2E@f*DaEh!lw(rdv+!Ly zKrZByF__zbNh)N%|533VX-2Ofgopd4vvzaXq0MP+62+hnX&HPB?Jw|ipdU-d&TGvy z{Yf}nU0CgcvAXHe2)5=<VW;uT7v19H>Tecyz2y>GFz_EQ1O%86MolSkm;^yFYQY%M zV~|yJa9_(l15T|g31SkO6f)01s%|$_yx}Tjz%!kE0i81Xa2a+EH0r1(6_Lhb5#&oq z#jET%W=s4*@_C@sT(@$IzbqFII!Q8%CD%}SQfVV@m!g<rMW<_g5aEAmEu^_ZinOjI zlIaVv)R`xw9CcM+#_{P!*u?qYzFK=tNhe(m7E8n&sm$37{Kv!+41QhT|Mh)YwM*MD zht@u6VF&pXdh8=tUZU3|LO44l|37@HxP7{AZ@msz?5#+L0<3eT^Sw6wN#9L~dn?aH zRy-CF#{#Y6OKf-9`i0LD{-zA?jbk>u(b=d*7s-jy!fv8gSGG{i=V<yoEF@Q^)EPkc z$q@I3eD#jd)kt7obnXSaqytHZ<D-a?PRr!)qV$>bB<`R$vSy`t7~NM-FL$sspT3lU zmdy3Y4N$fAT-h8>o8qr&Ik8aeY@tz<Ml$kopppw?xjjHFNj4pLRV5`(9b2U-Rm59{ z`6(qFrSX+4GOeQI!__p_Xw<Xmd!s9k>3d*aBc@g^xAAyviXY48`p~`dxU7#?Zhdnn zI&OuJ;izAC4!g({cVPS{-jJpk23JSjF$MoDLQw>L`hTRQEM9?hCZ8!od0h1svO=!i zwOIYW*Z;MsVA~gfYcB+RZrU~N<6>SDVR|y*Aeus8Q^BY3^HHOEx((=)UzfdDZFbG@ z)EKtrp+t^n1=yG(`Qv=?6+>QXKLVgboj$DdUmeTD*OiC4t=3ysAJ(o+T1W}AwQdW~ zoy0)M3Ud10m)u&cBVHIPwnBpBT2TDlleal6D*Sdl1krx59ZR{!8I4ZnR8*Y_Je=X< zwtv0xX`yq%wpZIXd?zgF?P<X-IJ&JYa@XVP8a5&br^`c{5r+rtf8s%jijZO1d^GQ~ zGwSKHa>oPmUXvKEc3msi#QNkRv&U$ya&`cAG*}}`A>ZYxzv0gA^!^Q)V`HvBQ=g!T zXI?y<9rA#_mc+!Cfl}`s7zWIx=8U|%1N!Oz+hF5-QGR2x2f=OM^nX%eH}WnY#1A>z zB&|R5_nbz9SR6ze$HEVd9VK|vCwfA-o>D7!fL*JODb8Xn_M_PaFL#aFwie8=McZ+$ zFXT5`B(4tD=JJyD`96NaQqDjFd`SwHHPf4pOF>(Ky6?aAdAVW9N@%`#$-LL@7txXr zMP-E}U;ll<ufOZbht)zENi(bkO`H-1wzh!goTN8Cc-DW=2xb;>6x(+sP%kH$)$j7R l#tLE?lm8dl^ZR+EtijHx&pUT&EE5$+OHE(3QP~0h{{X35F^B*F literal 0 HcmV?d00001 From 3d5b140c3d9b279c83355d7c8c5f6bdc6a5b1330 Mon Sep 17 00:00:00 2001 From: jerbob92 <jerbob92@users.noreply.github.com> Date: Mon, 27 Apr 2020 18:28:21 +0200 Subject: [PATCH 24/78] Fix URLSessionImplementations file upload (#6043) * Fix URLSessionImplementations file upload * Generated petstore --- .../URLSessionImplementations.mustache | 43 ++-- .../petstore/swift5/default/Package.swift | 4 +- .../Classes/OpenAPIs/APIHelper.swift | 17 +- .../Classes/OpenAPIs/APIs.swift | 14 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 4 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 56 ++--- .../APIs/FakeClassnameTags123API.swift | 4 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 48 +++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 26 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 36 ++-- .../Classes/OpenAPIs/CodableHelper.swift | 2 +- .../Classes/OpenAPIs/Configuration.swift | 6 +- .../Classes/OpenAPIs/Extensions.swift | 20 +- .../Classes/OpenAPIs/JSONDataEncoding.swift | 2 +- .../Classes/OpenAPIs/JSONEncodingHelper.swift | 8 +- .../Classes/OpenAPIs/Models.swift | 7 +- .../Models/AdditionalPropertiesClass.swift | 12 +- .../Classes/OpenAPIs/Models/Animal.swift | 4 +- .../Classes/OpenAPIs/Models/AnimalFarm.swift | 1 + .../Classes/OpenAPIs/Models/ApiResponse.swift | 4 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 6 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 6 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 6 +- .../OpenAPIs/Models/Capitalization.swift | 6 +- .../Classes/OpenAPIs/Models/Cat.swift | 4 +- .../Classes/OpenAPIs/Models/CatAllOf.swift | 4 +- .../Classes/OpenAPIs/Models/Category.swift | 4 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 3 +- .../Classes/OpenAPIs/Models/Client.swift | 4 +- .../Classes/OpenAPIs/Models/Dog.swift | 4 +- .../Classes/OpenAPIs/Models/DogAllOf.swift | 4 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 6 +- .../Classes/OpenAPIs/Models/EnumClass.swift | 1 + .../Classes/OpenAPIs/Models/EnumTest.swift | 6 +- .../Classes/OpenAPIs/Models/File.swift | 3 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 4 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 4 +- .../Classes/OpenAPIs/Models/List.swift | 6 +- .../Classes/OpenAPIs/Models/MapTest.swift | 14 +- ...opertiesAndAdditionalPropertiesClass.swift | 8 +- .../OpenAPIs/Models/Model200Response.swift | 5 +- .../Classes/OpenAPIs/Models/Name.swift | 5 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 6 +- .../Classes/OpenAPIs/Models/Order.swift | 4 +- .../OpenAPIs/Models/OuterComposite.swift | 6 +- .../Classes/OpenAPIs/Models/OuterEnum.swift | 1 + .../Classes/OpenAPIs/Models/Pet.swift | 4 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 4 +- .../Classes/OpenAPIs/Models/Return.swift | 5 +- .../OpenAPIs/Models/SpecialModelName.swift | 6 +- .../OpenAPIs/Models/StringBooleanMap.swift | 8 +- .../Classes/OpenAPIs/Models/Tag.swift | 4 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 6 +- .../OpenAPIs/Models/TypeHolderExample.swift | 6 +- .../Classes/OpenAPIs/Models/User.swift | 4 +- .../OpenAPIs/URLSessionImplementations.swift | 203 ++++++++++-------- 57 files changed, 415 insertions(+), 287 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 de8b6254db21..6717283868f0 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 @@ -488,8 +488,8 @@ fileprivate class FileUploadEncoding: ParameterEncoding { } var body = urlRequest.httpBody.orEmpty - - body.append("--\(boundary)--") + + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -507,15 +507,24 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) let fileName = fileURL.lastPathComponent - + + // If we already added something then we need an additional newline. + if (body.count > 0) { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -527,14 +536,24 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + + // If we already added something then we need an additional newline. + if (body.count > 0) { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") + + // Separate headers and body. + body.append("\r\n") + + // The value data. body.append(data) - - body.append("\r\n\r\n") - + urlRequest.httpBody = body return urlRequest diff --git a/samples/client/petstore/swift5/default/Package.swift b/samples/client/petstore/swift5/default/Package.swift index 96dfff54edf4..79f6f8188738 100644 --- a/samples/client/petstore/swift5/default/Package.swift +++ b/samples/client/petstore/swift5/default/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]) + targets: ["PetstoreClient"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ) + ), ] ) diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 200070096800..d94614b34fc7 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { + public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { + public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? [Any?] { - result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") + if let collection = item.value as? Array<Any?> { + result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? [Any?] { + if let collection = source as? Array<Any?> { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? [Any?] { + if let collection = item.value as? Array<Any?> { let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") result.append(URLQueryItem(name: item.key, value: value)) } else if let value = item.value { @@ -68,3 +68,4 @@ public struct APIHelper { return destination } } + diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift index a5c2d605dff6..c5d1b9b42df3 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String: String] = [:] + public static var customHeaders: [String:String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String: String] - public let parameters: [String: Any]? + var headers: [String:String] + public let parameters: [String:Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> Void)? + public var onProgressReady: ((Progress) -> ())? - required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders: [String: String]) { + open func addHeaders(_ aHeaders:[String:String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 5bbf323f820c..bb3ae7178254 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,6 +7,8 @@ import Foundation + + open class AnotherFakeAPI { /** To test special tags @@ -15,7 +17,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 134d6aea416a..d1d81faa335c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,6 +7,8 @@ import Foundation + + open class FakeAPI { /** @@ -14,7 +16,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -49,7 +51,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -84,7 +86,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,7 +121,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -154,7 +156,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -190,7 +192,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -229,7 +231,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -279,7 +281,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -316,7 +318,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String: Any?] = [ + let formParams: [String:Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -335,7 +337,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -424,7 +426,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -452,19 +454,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String: Any?] = [ + let formParams: [String:Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -490,7 +492,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -516,13 +518,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -543,7 +545,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -560,7 +562,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -580,7 +582,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -601,14 +603,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String: Any?] = [ + let formParams: [String:Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 48cfe7187b9a..d21c4a49d43d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,6 +7,8 @@ import Foundation + + open class FakeClassnameTags123API { /** To test class name in snake case @@ -15,7 +17,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 0552d4a6c16e..496da91171ac 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,6 +7,8 @@ import Foundation + + open class PetAPI { /** Add a new pet to the store @@ -15,7 +17,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -55,7 +57,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -82,8 +84,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -111,7 +113,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -135,8 +137,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -154,7 +156,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -178,8 +180,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -197,7 +199,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -224,8 +226,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -240,7 +242,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -281,7 +283,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -309,14 +311,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String: Any?] = [ + let formParams: [String:Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -333,7 +335,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -361,14 +363,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String: Any?] = [ + let formParams: [String:Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -385,7 +387,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -413,14 +415,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String: Any?] = [ + let formParams: [String:Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index a8a83eda39a4..3848eda85ad6 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,6 +7,8 @@ import Foundation + + open class StoreAPI { /** Delete purchase order by ID @@ -15,7 +17,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -39,8 +41,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -54,7 +56,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -74,14 +76,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -93,7 +95,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -117,8 +119,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -133,7 +135,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 505ed1b0c5c9..546166841d9e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,6 +7,8 @@ import Foundation + + open class UserAPI { /** Create user @@ -15,7 +17,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -52,7 +54,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -88,7 +90,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -124,7 +126,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -148,8 +150,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -164,7 +166,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -187,8 +189,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -204,7 +206,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -226,11 +228,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -245,7 +247,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -264,8 +266,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String: Any]? = nil - + let parameters: [String:Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -281,7 +283,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index ef971ebadc60..01b28a4bd42d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} +} \ No newline at end of file diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift index 627d9adb757e..f171525e4394 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} + +} \ No newline at end of file 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 93ed6b90b376..6e279679c67a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { - var tmpArray: [T]? + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { + var tmpArray: [T]? = nil if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { - var map: [Self.Key: T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { + var map: [Self.Key : T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,3 +177,5 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } + + diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index b79e9f5e64d5..08f1ef334dff 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? + var returnedParams: [String: Any]? = nil if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 02f78ffb4705..314f1eff1f9b 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? + open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? = nil // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? + var params: [String: Any]? = nil if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift index b0bfb1159760..290c7f35e478 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse: Error { +public enum ErrorResponse : Error { case error(Int, Data?, Error) } -public enum DownloadException: Error { +public enum DownloadException : Error { case responseDataMissing case responseFailed case requestMissing @@ -30,6 +30,7 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } + open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -43,7 +44,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String: String]() + var header = [String:String]() for (key, value) in rawHeader { if let key = key as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 1af031535967..28ca8377b889 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,17 +7,19 @@ import Foundation -public struct AdditionalPropertiesClass: Codable { - public var mapString: [String: String]? - public var mapMapString: [String: [String: String]]? +public struct AdditionalPropertiesClass: Codable { - public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { + + public var mapString: [String:String]? + public var mapMapString: [String:[String:String]]? + + public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 5ed9f31e2a36..1050d79dbe9d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,7 +7,9 @@ import Foundation -public struct Animal: Codable { + +public struct Animal: Codable { + public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e09b0e9efdc8..e7bea63f8ed2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,4 +7,5 @@ import Foundation + public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index ec270da89074..4d0393b9ba45 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,7 +7,9 @@ import Foundation -public struct ApiResponse: Codable { + +public struct ApiResponse: Codable { + public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 6c252ed475b2..1363c96394ba 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,9 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Codable { + +public struct ArrayOfArrayOfNumberOnly: Codable { + public var arrayArrayNumber: [[Double]]? @@ -15,7 +17,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index e84eb5d65025..6b8873730c43 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,9 @@ import Foundation -public struct ArrayOfNumberOnly: Codable { + +public struct ArrayOfNumberOnly: Codable { + public var arrayNumber: [Double]? @@ -15,7 +17,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index d2140933d181..64f7c6d9db99 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,7 +7,9 @@ import Foundation -public struct ArrayTest: Codable { + +public struct ArrayTest: Codable { + public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -19,7 +21,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index d1b3b27616ed..ddb669a59045 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,7 +7,9 @@ import Foundation -public struct Capitalization: Codable { + +public struct Capitalization: Codable { + public var smallCamel: String? public var capitalCamel: String? @@ -26,7 +28,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index 7ab887f3113f..c4f6e0d488ca 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,7 +7,9 @@ import Foundation -public struct Cat: Codable { + +public struct Cat: Codable { + public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index a51ad0dffab1..7b1d7e32be80 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,7 +7,9 @@ import Foundation -public struct CatAllOf: Codable { + +public struct CatAllOf: Codable { + public var declawed: Bool? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index eb8f7e5e1974..3ec00f5ab10d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,7 +7,9 @@ import Foundation -public struct Category: Codable { + +public struct Category: Codable { + public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index e2a7d4427a06..af030c3dd626 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,7 +8,8 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { +public struct ClassModel: Codable { + public var _class: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 00245ca37280..0aae748c76b4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,7 +7,9 @@ import Foundation -public struct Client: Codable { + +public struct Client: Codable { + public var client: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 492c1228008e..198e28b94dd6 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,7 +7,9 @@ import Foundation -public struct Dog: Codable { + +public struct Dog: Codable { + public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 7786f8acc5ae..8ff49b2af23f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,7 +7,9 @@ import Foundation -public struct DogAllOf: Codable { + +public struct DogAllOf: Codable { + public var breed: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 9844e7c40e35..e2d3fa04f94b 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,7 +7,9 @@ import Foundation -public struct EnumArrays: Codable { + +public struct EnumArrays: Codable { + public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -25,7 +27,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index d4029d73f8af..c2c639ba3246 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,6 +7,7 @@ import Foundation + public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index 789f583e1d77..a56e1f36389b 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,7 +7,9 @@ import Foundation -public struct EnumTest: Codable { + +public struct EnumTest: Codable { + public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -41,7 +43,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift index abf3ccffc485..773b53b2cb76 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,7 +8,8 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { +public struct File: Codable { + /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 532f1457939a..83dc1148cfa3 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,7 +7,9 @@ import Foundation -public struct FileSchemaTestClass: Codable { + +public struct FileSchemaTestClass: Codable { + public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 20bd6d103b3d..bccd3f9fb178 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,7 +7,9 @@ import Foundation -public struct FormatTest: Codable { + +public struct FormatTest: Codable { + public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 906ddb06fb17..566d71a35ef0 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,7 +7,9 @@ import Foundation -public struct HasOnlyReadOnly: Codable { + +public struct HasOnlyReadOnly: Codable { + public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift index fe13d302ccbf..80cecab242f2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,7 +7,9 @@ import Foundation -public struct List: Codable { + +public struct List: Codable { + public var _123list: String? @@ -15,7 +17,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 4b6037f378ee..f0c02de95f7a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,25 +7,27 @@ import Foundation -public struct MapTest: Codable { + +public struct MapTest: Codable { + public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String: [String: String]]? - public var mapOfEnumString: [String: String]? - public var directMap: [String: Bool]? + public var mapMapOfString: [String:[String:String]]? + public var mapOfEnumString: [String:String]? + public var directMap: [String:Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index c3deb2f28932..710e62a9b587 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,13 +7,15 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { + +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { + public var uuid: UUID? public var dateTime: Date? - public var map: [String: Animal]? + public var map: [String:Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index b61db7d6e716..450a53b918ca 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,7 +8,8 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { +public struct Model200Response: Codable { + public var name: Int? public var _class: String? @@ -18,7 +19,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 8ab4db44b73a..6deb69fcd731 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,7 +8,8 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { +public struct Name: Codable { + public var name: Int public var snakeCase: Int? @@ -22,7 +23,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 4d1dafcc2c1f..0c9ee2b7b9f4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,7 +7,9 @@ import Foundation -public struct NumberOnly: Codable { + +public struct NumberOnly: Codable { + public var justNumber: Double? @@ -15,7 +17,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 40c30cc8609c..ab0eac0b304e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,7 +7,9 @@ import Foundation -public struct Order: Codable { + +public struct Order: Codable { + public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 18c3a024f122..4a7d22710441 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,7 +7,9 @@ import Foundation -public struct OuterComposite: Codable { + +public struct OuterComposite: Codable { + public var myNumber: Double? public var myString: String? @@ -19,7 +21,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index c3b778cbbed4..9e6b8d74e874 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,6 +7,7 @@ import Foundation + public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index b9ce0e933256..a973071d6c96 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,7 +7,9 @@ import Foundation -public struct Pet: Codable { + +public struct Pet: Codable { + public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 0acd21fd1000..b2a6b7e2b8a6 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,7 +7,9 @@ import Foundation -public struct ReadOnlyFirst: Codable { + +public struct ReadOnlyFirst: Codable { + public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index c223f993a69e..7e089dcee2b4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,7 +8,8 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { +public struct Return: Codable { + public var _return: Int? @@ -16,7 +17,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index 6e8650f76d8e..e890ef952520 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,7 +7,9 @@ import Foundation -public struct SpecialModelName: Codable { + +public struct SpecialModelName: Codable { + public var specialPropertyName: Int64? @@ -15,7 +17,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 3f1237fee477..f65ae0623d6e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,9 +7,12 @@ import Foundation -public struct StringBooleanMap: Codable { - public var additionalProperties: [String: Bool] = [:] +public struct StringBooleanMap: Codable { + + + + public var additionalProperties: [String:Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -42,4 +45,5 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } + } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 4dd8a9a9f5a0..a91b6061bcf7 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,7 +7,9 @@ import Foundation -public struct Tag: Codable { + +public struct Tag: Codable { + public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index a9e088808ed3..2d377c3edb02 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,7 +7,9 @@ import Foundation -public struct TypeHolderDefault: Codable { + +public struct TypeHolderDefault: Codable { + public var stringItem: String = "what" public var numberItem: Double @@ -23,7 +25,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index dff4083ae432..e5eb92da696e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,7 +7,9 @@ import Foundation -public struct TypeHolderExample: Codable { + +public struct TypeHolderExample: Codable { + public var stringItem: String public var numberItem: Double @@ -23,7 +25,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift index 79f271ed7356..f70328ca9e59 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,7 +7,9 @@ import Foundation -public struct User: Codable { + +public struct User: Codable { + public var id: Int64? public var username: String? 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 a31860adfdeb..b31b84b50079 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,18 +23,18 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + let progress = Progress() - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -47,11 +47,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -79,40 +79,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId: String = UUID().uuidString + let urlSessionId:String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -121,29 +121,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + 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 } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -159,18 +159,18 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in self.progress.totalUnitCount = newProgress.totalUnitCount self.progress.completedUnitCount = newProgress.completedUnitCount } - + onProgressReady?(progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -179,7 +179,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -199,52 +199,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -258,7 +258,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -277,7 +277,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with: "") + .replacingCharacters(in: range, with:"") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -286,7 +286,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url: URL) throws -> String { + fileprivate func getPath(from url : URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -300,7 +300,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -311,7 +311,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -331,28 +331,28 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -363,10 +363,10 @@ open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBui } } -private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -409,13 +409,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -private class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { - +fileprivate class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -424,12 +424,12 @@ private class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -private class FileUploadEncoding: ParameterEncoding { +fileprivate class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -440,13 +440,13 @@ private class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -486,10 +486,10 @@ private class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -501,39 +501,58 @@ private class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) let fileName = fileURL.lastPathComponent - body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") + // If we already added something then we need an additional newline. + if (body.count > 0) { + body.append("\r\n") + } - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value boundary. + body.append("--\(boundary)\r\n") - body.append(fileData) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + // The value data. + body.append(fileData) + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if (body.count > 0) { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body From 354f195ec09293cfd731b72e67c3cc977b8c0894 Mon Sep 17 00:00:00 2001 From: Harald Fernengel <harald.fernengel@here.com> Date: Tue, 28 Apr 2020 10:37:31 +0200 Subject: [PATCH 25/78] [typescript-fetch] Support deepObject query params (#6075) deepObject query parameters need to be specially marshalled. Unfortunately, they're quite tricky to distinguish in mustache because there's no boolean property for deepObject, so add a vendorExtension property to ease the mustache template. --- .../languages/TypeScriptFetchClientCodegen.java | 14 ++++++++++++++ .../main/resources/typescript-fetch/apis.mustache | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 38b3f71ac6cc..85ac755a42c6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -236,9 +236,23 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o this.addOperationObjectResponseInformation(operations); this.addOperationPrefixParameterInterfacesInformation(operations); this.escapeOperationIds(operations); + this.addDeepObjectVendorExtension(operations); return operations; } + private void addDeepObjectVendorExtension(Map<String, Object> operations) { + Map<String, Object> _operations = (Map<String, Object>) operations.get("operations"); + List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation"); + + for (CodegenOperation op : operationList) { + for (CodegenParameter param : op.queryParams) { + if (param.style != null && param.style.equals("deepObject")) { + param.vendorExtensions.put("x-codegen-isDeepObject", true); + } + } + } + } + private void escapeOperationIds(Map<String, Object> operations) { Map<String, Object> _operations = (Map<String, Object>) operations.get("operations"); List<CodegenOperation> operationList = (List<CodegenOperation>) _operations.get("operation"); diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index ace07d5b9626..39ed958da288 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -122,7 +122,12 @@ export class {{classname}} extends runtime.BaseAPI { queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString().substr(0,10); {{/isDate}} {{^isDate}} + {{#vendorExtensions.x-codegen-isDeepObject}} + queryParameters['{{baseName}}'] = runtime.querystring(requestParameters.{{paramName}} as unknown as runtime.HTTPQuery, '{{baseName}}'); + {{/vendorExtensions.x-codegen-isDeepObject}} + {{^vendorExtensions.x-codegen-isDeepObject}} queryParameters['{{baseName}}'] = requestParameters.{{paramName}}; + {{/vendorExtensions.x-codegen-isDeepObject}} {{/isDate}} {{/isDateTime}} } From 6f9d8259b03eb8cead511c5d75af2144a58446f8 Mon Sep 17 00:00:00 2001 From: Harald Fernengel <harald.fernengel@here.com> Date: Tue, 28 Apr 2020 15:21:53 +0200 Subject: [PATCH 26/78] [typescript-fetch] Make FormData optional (#6077) Check "typeof FormData" first. This allows the code to also work in nodejs with isomorphic-fetch. --- .../src/main/resources/typescript-fetch/runtime.mustache | 2 +- .../client/petstore/typescript-fetch/builds/default/runtime.ts | 2 +- .../petstore/typescript-fetch/builds/es6-target/src/runtime.ts | 2 +- .../typescript-fetch/builds/multiple-parameters/runtime.ts | 2 +- .../builds/prefix-parameter-interfaces/src/runtime.ts | 2 +- .../builds/typescript-three-plus/src/runtime.ts | 2 +- .../petstore/typescript-fetch/builds/with-interfaces/runtime.ts | 2 +- .../typescript-fetch/builds/with-npm-version/src/runtime.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index ee1ee65cc393..767a34880808 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -50,7 +50,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index 649e17504246..747ca17e206d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index 649e17504246..747ca17e206d 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index 649e17504246..747ca17e206d 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index 649e17504246..747ca17e206d 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts index b6e6a7744d78..8fae3715d1b6 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index 649e17504246..747ca17e206d 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index 649e17504246..747ca17e206d 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -61,7 +61,7 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = (context.body instanceof FormData || context.body instanceof URLSearchParams || isBlob(context.body)) + const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) ? context.body : JSON.stringify(context.body); From f12fb86a1a8273996c842b007a1cbee9dc2c2eed Mon Sep 17 00:00:00 2001 From: Jim Schubert <james.schubert@gmail.com> Date: Tue, 28 Apr 2020 10:20:15 -0400 Subject: [PATCH 27/78] [feat] Allow configuration of yaml minimize quotes (#5933) There are cases where minimizing quotes results in invalid YAML. For example, an input YAML with string "1234_1234" will be converted to YAML value 1234_1234 which is an int in YAML 1.1 (https://yaml.org/type/int.html) THe only option in these cases is to either: * Revert the option completely to always quote values * Provide a user-customization to disable quotes minimization This applies the latter with the assumption that this is an edge case and users who are unaffected will default to the "prettier" version. An alternative would be to write a custom serializer for strings, and if they are in the format of of any of the valid formats defined in YAML: [-+]?0b[0-1_]+ # (base 2) |[-+]?0[0-7_]+ # (base 8) |[-+]?(0|[1-9][0-9_]*) # (base 10) |[-+]?0x[0-9a-fA-F_]+ # (base 16) |[-+]?[1-9][0-9_]*(:[0-5]?[0-9])+ # (base 60) Then wrap the result in quotes. That approach was not taken because of the potential for significant performance impact on very large specs, which our users are often tasked with transforming. --- .../PythonAbstractConnexionServerCodegen.java | 1 + .../codegen/serializer/SerializerUtils.java | 25 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java index 38ed47d4e66f..267d14bc83b3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java @@ -594,6 +594,7 @@ public Map<String, Object> postProcessSupportingFileData(Map<String, Object> obj } } + generateJSONSpecFile(objs); generateYAMLSpecFile(objs); for (Map<String, Object> operations : getOperations(objs)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java index 16a8af68a7e1..833ad2e24180 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/serializer/SerializerUtils.java @@ -2,25 +2,38 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; -import io.swagger.v3.core.util.Yaml; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import io.swagger.v3.core.util.Json; +import io.swagger.v3.core.util.Yaml; import io.swagger.v3.oas.models.OpenAPI; +import org.openapitools.codegen.config.GlobalSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SerializerUtils { private static final Logger LOGGER = LoggerFactory.getLogger(SerializerUtils.class); + private static final String YAML_MINIMIZE_QUOTES_PROPERTY = "org.openapitools.codegen.utils.yaml.minimize.quotes"; + private static final boolean minimizeYamlQuotes = Boolean.parseBoolean(GlobalSettings.getProperty(YAML_MINIMIZE_QUOTES_PROPERTY, "true")); public static String toYamlString(OpenAPI openAPI) { - if(openAPI == null) { + if (openAPI == null) { return null; } SimpleModule module = createModule(); try { - return Yaml.mapper() - .copy() - .registerModule(module) + ObjectMapper yamlMapper = Yaml.mapper().copy(); + // there is an unfortunate YAML condition where user inputs should be treated as strings (e.g. "1234_1234"), but in yaml this is a valid number and + // removing quotes forcibly by default means we are potentially doing a data conversion resulting in an unexpected change to the user's YAML outputs. + // We may allow for property-based enable/disable, retaining the default of enabled for backward compatibility. + if (minimizeYamlQuotes) { + ((YAMLFactory) yamlMapper.getFactory()).enable(YAMLGenerator.Feature.MINIMIZE_QUOTES); + } else { + ((YAMLFactory) yamlMapper.getFactory()).disable(YAMLGenerator.Feature.MINIMIZE_QUOTES); + } + return yamlMapper.registerModule(module) .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) .writeValueAsString(openAPI) .replace("\r\n", "\n"); @@ -34,7 +47,7 @@ public static String toJsonString(OpenAPI openAPI) { if (openAPI == null) { return null; } - + SimpleModule module = createModule(); try { return Json.mapper() From 500fb472b00fa30b8da0cf3f077e68eb5d7c3503 Mon Sep 17 00:00:00 2001 From: Harald Fernengel <harald.fernengel@here.com> Date: Tue, 28 Apr 2020 16:20:26 +0200 Subject: [PATCH 28/78] [typescript-fetch] Allow multiline documentation (#6088) Add a lambda that formats the documentation correctly even if it contains newlines. The generated docs with typedoc looks a lot better and also renders Markdown correctly. Also remove the "no description" fallback for APIs because we don't have it anywhere else, other generators don't generate a default fallback and I'd rather have no documentation than a "no description" string. --- .../languages/TypeScriptFetchClientCodegen.java | 11 +++++++++++ .../src/main/resources/typescript-fetch/apis.mustache | 6 +++--- .../resources/typescript-fetch/modelEnum.mustache | 2 +- .../resources/typescript-fetch/modelGeneric.mustache | 4 ++-- .../resources/typescript-fetch/modelOneOf.mustache | 4 ++-- .../typescript-fetch/builds/default/apis/PetApi.ts | 2 +- .../typescript-fetch/builds/default/apis/StoreApi.ts | 2 +- .../typescript-fetch/builds/default/apis/UserApi.ts | 2 +- .../builds/es6-target/src/apis/PetApi.ts | 2 +- .../builds/es6-target/src/apis/StoreApi.ts | 2 +- .../builds/es6-target/src/apis/UserApi.ts | 2 +- .../builds/multiple-parameters/apis/PetApi.ts | 2 +- .../builds/multiple-parameters/apis/StoreApi.ts | 2 +- .../builds/multiple-parameters/apis/UserApi.ts | 2 +- .../prefix-parameter-interfaces/src/apis/PetApi.ts | 2 +- .../prefix-parameter-interfaces/src/apis/StoreApi.ts | 2 +- .../prefix-parameter-interfaces/src/apis/UserApi.ts | 2 +- .../builds/typescript-three-plus/src/apis/PetApi.ts | 2 +- .../builds/typescript-three-plus/src/apis/StoreApi.ts | 2 +- .../builds/typescript-three-plus/src/apis/UserApi.ts | 2 +- .../builds/with-interfaces/apis/PetApi.ts | 3 ++- .../builds/with-interfaces/apis/StoreApi.ts | 3 ++- .../builds/with-interfaces/apis/UserApi.ts | 3 ++- .../builds/with-npm-version/src/apis/PetApi.ts | 2 +- .../builds/with-npm-version/src/apis/StoreApi.ts | 2 +- .../builds/with-npm-version/src/apis/UserApi.ts | 2 +- 26 files changed, 43 insertions(+), 29 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 85ac755a42c6..208d42834eb7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -17,11 +17,14 @@ package org.openapitools.codegen.languages; +import com.google.common.collect.ImmutableMap; +import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.templating.mustache.IndentedLambda; import org.openapitools.codegen.utils.ModelUtils; import java.io.File; @@ -134,6 +137,14 @@ public void processOpts() { } } + @Override + protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() { + ImmutableMap.Builder<String, Mustache.Lambda> lambdas = super.addMustacheLambdas(); + lambdas.put("indented_star_1", new IndentedLambda(1, " ", "* ")); + lambdas.put("indented_star_4", new IndentedLambda(5, " ", "* ")); + return lambdas; + } + @Override public String getTypeDeclaration(Schema p) { if (ModelUtils.isFileSchema(p)) { diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 39ed958da288..32f0a1c54bb5 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -28,8 +28,8 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn {{#withInterfaces}} {{#operations}} /** - * {{classname}} - interface{{#description}} - * {{&description}}{{/description}} + * {{classname}} - interface + * {{#lambda.indented_1}}{{{unescapedDescription}}}{{/lambda.indented_1}} * @export * @interface {{classname}}Interface */ @@ -71,7 +71,7 @@ export interface {{classname}}Interface { {{/withInterfaces}} {{#operations}} /** - * {{#description}}{{{description}}}{{/description}}{{^description}}no description{{/description}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} */ {{#withInterfaces}} export class {{classname}} extends runtime.BaseAPI implements {{classname}}Interface { diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache index b08c8f24dc1a..7534f9b391a1 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache @@ -1,5 +1,5 @@ /** - * {{{description}}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} * @export * @enum {string} */ diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache index ca1837946ea7..bd593da18308 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelGeneric.mustache @@ -19,7 +19,7 @@ import { {{/discriminator}} /** - * {{{description}}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} * @export * @interface {{classname}} */ @@ -29,7 +29,7 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{/additionalPropertiesType}} {{#vars}} /** - * {{{description}}} + * {{#lambda.indented_star_4}}{{{unescapedDescription}}}{{/lambda.indented_star_4}} * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> * @memberof {{classname}} */ diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache index 2c957dbd2040..506d8207bc97 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelOneOf.mustache @@ -11,8 +11,8 @@ import { {{/hasImports}} /** - * @type {{classname}}{{#description}} - * {{{description}}}{{/description}} + * @type {{classname}} + * {{#lambda.indented_star_1}}{{{unescapedDescription}}}{{/lambda.indented_star_1}} * @export */ export type {{classname}} = {{#discriminator}}{{#mappedModels}}{ {{discriminator.propertyName}}: '{{mappingName}}' } & {{modelName}}{{^-last}} | {{/-last}}{{/mappedModels}}{{/discriminator}}{{^discriminator}}{{#oneOf}}{{{.}}}{{^-last}} | {{/-last}}{{/oneOf}}{{/discriminator}}; diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts index 7be9cd13bfd8..6975933a9658 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts index 9d094207bb78..c8f7ac7c5368 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts index 36150d523bc5..e64925bda21a 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts index 17731c8760e2..e8d463f39e26 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface PetApiUploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts index 7f38fd436aea..805aa3365009 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface StoreApiPlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts index 1d97220cb00f..3fd0e8e13704 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UserApiUpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts index 3aaa0da493a2..95a3c8d2ee57 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts @@ -62,6 +62,7 @@ export interface UploadFileRequest { /** * PetApi - interface + * * @export * @interface PetApiInterface */ @@ -197,7 +198,7 @@ export interface PetApiInterface { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI implements PetApiInterface { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts index 5c379a79098c..cd2e4e760330 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts @@ -34,6 +34,7 @@ export interface PlaceOrderRequest { /** * StoreApi - interface + * * @export * @interface StoreApiInterface */ @@ -103,7 +104,7 @@ export interface StoreApiInterface { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI implements StoreApiInterface { diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts index 43bb1ebc0324..257dde3bfe08 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts @@ -52,6 +52,7 @@ export interface UpdateUserRequest { /** * UserApi - interface + * * @export * @interface UserApiInterface */ @@ -183,7 +184,7 @@ export interface UserApiInterface { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI implements UserApiInterface { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts index 9f3378899328..9d891d9ea72f 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/PetApi.ts @@ -61,7 +61,7 @@ export interface UploadFileRequest { } /** - * no description + * */ export class PetApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts index 4d281723815a..c26e3c52185f 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/StoreApi.ts @@ -33,7 +33,7 @@ export interface PlaceOrderRequest { } /** - * no description + * */ export class StoreApi extends runtime.BaseAPI { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts index e5441f0aaf17..036aacf74854 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/apis/UserApi.ts @@ -51,7 +51,7 @@ export interface UpdateUserRequest { } /** - * no description + * */ export class UserApi extends runtime.BaseAPI { From 6bb4bd8ebe8cb194f40ea7dc21f6155840ba17d7 Mon Sep 17 00:00:00 2001 From: n0idea <4489782+n0idea@users.noreply.github.com> Date: Tue, 28 Apr 2020 16:22:21 +0200 Subject: [PATCH 29/78] fixed typescript-axios pattern data integrity by removing escapeText() call (#5974) --- .../codegen/languages/TypeScriptAxiosClientCodegen.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 023db0270149..1b6e80926395 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 @@ -217,6 +217,15 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) { return objs; } + /** + * Overriding toRegularExpression() to avoid escapeText() being called, + * as it would return a broken regular expression if any escaped character / metacharacter were present. + */ + @Override + public String toRegularExpression(String pattern) { + return addRegularExpressionDelimiter(pattern); + } + @Override public String toModelFilename(String name) { return super.toModelFilename(name).replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT); From a2b613c1b34b07f6fed1fef631b50feeb76d518e Mon Sep 17 00:00:00 2001 From: Justin Black <spacether@users.noreply.github.com> Date: Tue, 28 Apr 2020 07:30:56 -0700 Subject: [PATCH 30/78] Fixes md docs (#6079) * Fixes md docs * Separates out boolean enum options into legacyDiscriminatorBehaviorOpts * Updates docs, adds true and false descriptions --- docs/generators/ada-server.md | 11 +---------- docs/generators/ada.md | 11 +---------- docs/generators/android.md | 11 +---------- docs/generators/apache2.md | 11 +---------- docs/generators/apex.md | 11 +---------- docs/generators/asciidoc.md | 11 +---------- docs/generators/avro-schema.md | 11 +---------- docs/generators/bash.md | 11 +---------- docs/generators/c.md | 11 +---------- docs/generators/clojure.md | 11 +---------- docs/generators/cpp-qt5-client.md | 11 +---------- docs/generators/cpp-qt5-qhttpengine-server.md | 11 +---------- docs/generators/cpp-tizen.md | 11 +---------- docs/generators/cwiki.md | 11 +---------- docs/generators/dart-dio.md | 11 +---------- docs/generators/dart-jaguar.md | 11 +---------- docs/generators/dart.md | 11 +---------- docs/generators/dynamic-html.md | 11 +---------- docs/generators/elixir.md | 11 +---------- docs/generators/fsharp-functions.md | 11 +---------- docs/generators/groovy.md | 11 +---------- docs/generators/haskell-http-client.md | 11 +---------- docs/generators/haskell.md | 11 +---------- docs/generators/html.md | 11 +---------- docs/generators/html2.md | 11 +---------- docs/generators/java-inflector.md | 11 +---------- docs/generators/java-msf4j.md | 11 +---------- docs/generators/java-pkmst.md | 11 +---------- docs/generators/java-play-framework.md | 11 +---------- docs/generators/java-undertow-server.md | 11 +---------- docs/generators/java-vertx-web.md | 11 +---------- docs/generators/java-vertx.md | 11 +---------- docs/generators/java.md | 11 +---------- docs/generators/javascript-apollo.md | 11 +---------- docs/generators/javascript-closure-angular.md | 11 +---------- docs/generators/javascript-flowtyped.md | 11 +---------- docs/generators/javascript.md | 11 +---------- docs/generators/jaxrs-cxf-cdi.md | 11 +---------- docs/generators/jaxrs-cxf-client.md | 11 +---------- docs/generators/jaxrs-cxf-extended.md | 11 +---------- docs/generators/jaxrs-cxf.md | 11 +---------- docs/generators/jaxrs-jersey.md | 11 +---------- docs/generators/jaxrs-resteasy-eap.md | 11 +---------- docs/generators/jaxrs-resteasy.md | 11 +---------- docs/generators/jaxrs-spec.md | 11 +---------- docs/generators/jmeter.md | 11 +---------- docs/generators/k6.md | 11 +---------- docs/generators/markdown.md | 11 +---------- docs/generators/nim.md | 11 +---------- docs/generators/nodejs-express-server.md | 11 +---------- docs/generators/nodejs-server-deprecated.md | 11 +---------- docs/generators/ocaml.md | 11 +---------- docs/generators/openapi-yaml.md | 11 +---------- docs/generators/openapi.md | 11 +---------- docs/generators/php-laravel.md | 11 +---------- docs/generators/php-lumen.md | 11 +---------- docs/generators/php-silex.md | 11 +---------- docs/generators/php-slim-deprecated.md | 11 +---------- docs/generators/php-slim4.md | 11 +---------- docs/generators/php-symfony.md | 11 +---------- docs/generators/php-ze-ph.md | 11 +---------- docs/generators/php.md | 11 +---------- docs/generators/python-aiohttp.md | 11 +---------- docs/generators/python-blueplanet.md | 11 +---------- docs/generators/python-flask.md | 11 +---------- docs/generators/ruby.md | 11 +---------- docs/generators/scala-akka-http-server.md | 11 +---------- docs/generators/scala-akka.md | 11 +---------- docs/generators/scala-gatling.md | 11 +---------- docs/generators/scala-httpclient-deprecated.md | 11 +---------- docs/generators/scala-lagom-server.md | 11 +---------- docs/generators/scala-play-server.md | 11 +---------- docs/generators/scala-sttp.md | 11 +---------- docs/generators/scalatra.md | 11 +---------- docs/generators/scalaz.md | 11 +---------- docs/generators/spring.md | 11 +---------- docs/generators/swift2-deprecated.md | 11 +---------- docs/generators/swift3-deprecated.md | 11 +---------- docs/generators/swift4.md | 11 +---------- docs/generators/swift5.md | 11 +---------- docs/generators/typescript-angular.md | 11 +---------- docs/generators/typescript-angularjs.md | 11 +---------- docs/generators/typescript-aurelia.md | 11 +---------- docs/generators/typescript-axios.md | 11 +---------- docs/generators/typescript-fetch.md | 11 +---------- docs/generators/typescript-inversify.md | 11 +---------- docs/generators/typescript-jquery.md | 11 +---------- docs/generators/typescript-node.md | 11 +---------- docs/generators/typescript-redux-query.md | 11 +---------- docs/generators/typescript-rxjs.md | 11 +---------- .../org/openapitools/codegen/CodegenConstants.java | 12 ++---------- .../org/openapitools/codegen/DefaultCodegen.java | 9 +++++++-- 92 files changed, 99 insertions(+), 912 deletions(-) diff --git a/docs/generators/ada-server.md b/docs/generators/ada-server.md index 7f804ddf0dff..85bfb5b5d02c 100644 --- a/docs/generators/ada-server.md +++ b/docs/generators/ada-server.md @@ -7,16 +7,7 @@ sidebar_label: ada-server | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|GNAT project name| |defaultProject| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/ada.md b/docs/generators/ada.md index c5d73461dc2a..66114165a03e 100644 --- a/docs/generators/ada.md +++ b/docs/generators/ada.md @@ -7,16 +7,7 @@ sidebar_label: ada | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|GNAT project name| |defaultProject| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/android.md b/docs/generators/android.md index 430500d9e6a4..48cef4ce53c9 100644 --- a/docs/generators/android.md +++ b/docs/generators/android.md @@ -15,16 +15,7 @@ sidebar_label: android |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |groupId|groupId for use in the generated build.gradle and pom.xml| |null| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template) to use|<dl><dt>**volley**</dt><dd>HTTP client: Volley 1.0.19 (default)</dd><dt>**httpclient**</dt><dd>HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1. IMPORTANT: Android client using HttpClient is not actively maintained and will be depecreated in the next major release.</dd></dl>|null| |modelPackage|package for generated models| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/apache2.md b/docs/generators/apache2.md index 8b92e02dd19f..d097e39d84a9 100644 --- a/docs/generators/apache2.md +++ b/docs/generators/apache2.md @@ -7,16 +7,7 @@ sidebar_label: apache2 | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/apex.md b/docs/generators/apex.md index 80ac5bd24fba..9ead87c94e96 100644 --- a/docs/generators/apex.md +++ b/docs/generators/apex.md @@ -10,16 +10,7 @@ sidebar_label: apex |buildMethod|The build method for this package.| |null| |classPrefix|Prefix for generated classes. Set this to avoid overwriting existing classes in your org.| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |namedCredential|The named credential name for the HTTP callouts| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/asciidoc.md b/docs/generators/asciidoc.md index 777a62080c7b..01683b0a323e 100644 --- a/docs/generators/asciidoc.md +++ b/docs/generators/asciidoc.md @@ -16,16 +16,7 @@ sidebar_label: asciidoc |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/avro-schema.md b/docs/generators/avro-schema.md index 6f0621b74774..da33df520012 100644 --- a/docs/generators/avro-schema.md +++ b/docs/generators/avro-schema.md @@ -7,16 +7,7 @@ sidebar_label: avro-schema | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |packageName|package for generated classes (where supported)| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/bash.md b/docs/generators/bash.md index 3d626eff7209..724e3d9a4704 100644 --- a/docs/generators/bash.md +++ b/docs/generators/bash.md @@ -13,16 +13,7 @@ sidebar_label: bash |generateBashCompletion|Whether to generate the Bash completion script| |false| |generateZshCompletion|Whether to generate the Zsh completion script| |false| |hostEnvironmentVariable|Name of environment variable where host can be defined (e.g. PETSTORE_HOST='http://api.openapitools.org:8080')| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |processMarkdown|Convert all Markdown Markup into terminal formatting| |false| |scriptName|The name of the script that will be generated (e.g. petstore-cli)| |null| diff --git a/docs/generators/c.md b/docs/generators/c.md index 8ebc3221faee..80e50635f4c5 100644 --- a/docs/generators/c.md +++ b/docs/generators/c.md @@ -8,16 +8,7 @@ sidebar_label: c |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/clojure.md b/docs/generators/clojure.md index e42936d9f86c..f2a755332bfb 100644 --- a/docs/generators/clojure.md +++ b/docs/generators/clojure.md @@ -8,16 +8,7 @@ sidebar_label: clojure |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |baseNamespace|the base/top namespace (Default: generated from projectName)| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectDescription|description of the project (Default: using info.description or "Client library of <projectName>")| |null| |projectLicenseName|name of the license the project uses (Default: using info.license.name or not included in project.clj)| |null| diff --git a/docs/generators/cpp-qt5-client.md b/docs/generators/cpp-qt5-client.md index 9a043e53237e..8e2bf7ab98b7 100644 --- a/docs/generators/cpp-qt5-client.md +++ b/docs/generators/cpp-qt5-client.md @@ -9,16 +9,7 @@ sidebar_label: cpp-qt5-client |contentCompression|Enable Compressed Content Encoding for requests and responses| |false| |cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelNamePrefix|Prefix that will be prepended to all model names.| |OAI| |optionalProjectFile|Generate client.pri.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/cpp-qt5-qhttpengine-server.md b/docs/generators/cpp-qt5-qhttpengine-server.md index 574a019f13be..9e2f0e75e5c6 100644 --- a/docs/generators/cpp-qt5-qhttpengine-server.md +++ b/docs/generators/cpp-qt5-qhttpengine-server.md @@ -9,16 +9,7 @@ sidebar_label: cpp-qt5-qhttpengine-server |contentCompression|Enable Compressed Content Encoding for requests and responses| |false| |cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelNamePrefix|Prefix that will be prepended to all model names.| |OAI| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| diff --git a/docs/generators/cpp-tizen.md b/docs/generators/cpp-tizen.md index 16022f8f5370..dd887f704784 100644 --- a/docs/generators/cpp-tizen.md +++ b/docs/generators/cpp-tizen.md @@ -7,16 +7,7 @@ sidebar_label: cpp-tizen | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/cwiki.md b/docs/generators/cwiki.md index bf7949015bd0..2804a1bb2b8f 100644 --- a/docs/generators/cwiki.md +++ b/docs/generators/cwiki.md @@ -15,16 +15,7 @@ sidebar_label: cwiki |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index fd16331b9a15..5bab2b35a21d 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -9,16 +9,7 @@ sidebar_label: dart-dio |browserClient|Is the client browser based (for Dart 1.x only)| |null| |dateLibrary|Option. Date library to use|<dl><dt>**core**</dt><dd>Dart core library (DateTime)</dd><dt>**timemachine**</dt><dd>Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.</dd></dl>|core| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |nullableFields|Is the null fields should be in the JSON payload| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |pubAuthor|Author name in generated pubspec| |null| diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md index 995676b9a134..a23282c5095c 100644 --- a/docs/generators/dart-jaguar.md +++ b/docs/generators/dart-jaguar.md @@ -8,16 +8,7 @@ sidebar_label: dart-jaguar |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |browserClient|Is the client browser based (for Dart 1.x only)| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |nullableFields|Is the null fields should be in the JSON payload| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |pubAuthor|Author name in generated pubspec| |null| diff --git a/docs/generators/dart.md b/docs/generators/dart.md index 7cad220b66ea..b6ff9ba8eef8 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -8,16 +8,7 @@ sidebar_label: dart |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |browserClient|Is the client browser based (for Dart 1.x only)| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |pubAuthor|Author name in generated pubspec| |null| |pubAuthorEmail|Email address of the author in generated pubspec| |null| diff --git a/docs/generators/dynamic-html.md b/docs/generators/dynamic-html.md index 6d120dd987bd..9766b76b426f 100644 --- a/docs/generators/dynamic-html.md +++ b/docs/generators/dynamic-html.md @@ -11,16 +11,7 @@ sidebar_label: dynamic-html |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |groupId|groupId in generated pom.xml| |null| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/elixir.md b/docs/generators/elixir.md index 9dc1c27d1893..c13f447d0c89 100644 --- a/docs/generators/elixir.md +++ b/docs/generators/elixir.md @@ -8,16 +8,7 @@ sidebar_label: elixir |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay.Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseHeader|The license header to prepend to the top of all source files.| |null| |packageName|Elixir package name (convention: lowercase).| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/fsharp-functions.md b/docs/generators/fsharp-functions.md index 456a7daaa424..07b7aa3ded2b 100644 --- a/docs/generators/fsharp-functions.md +++ b/docs/generators/fsharp-functions.md @@ -7,16 +7,7 @@ sidebar_label: fsharp-functions | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |NoLicense| |licenseUrl|The URL of the license| |http://localhost| |packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI| diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md index dbdec2603134..399aa7f5fcbb 100644 --- a/docs/generators/groovy.md +++ b/docs/generators/groovy.md @@ -25,16 +25,7 @@ sidebar_label: groovy |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/haskell-http-client.md b/docs/generators/haskell-http-client.md index 9b9a848ae683..a1ecfc5a4b04 100644 --- a/docs/generators/haskell-http-client.md +++ b/docs/generators/haskell-http-client.md @@ -24,16 +24,7 @@ sidebar_label: haskell-http-client |generateModelConstructors|Generate smart constructors (only supply required fields) for models| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |inlineMimeTypes|Inline (hardcode) the content-type and accept parameters on operations, when there is only 1 option| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelDeriving|Additional classes to include in the deriving() clause of Models| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |requestType|Set the name of the type used to generate requests| |null| diff --git a/docs/generators/haskell.md b/docs/generators/haskell.md index 6bb19ea0f864..1fef8d922d29 100644 --- a/docs/generators/haskell.md +++ b/docs/generators/haskell.md @@ -8,16 +8,7 @@ sidebar_label: haskell |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |serveStatic|serve will serve files from the directory 'static'.| |true| diff --git a/docs/generators/html.md b/docs/generators/html.md index dd8c9fa9d651..b5603e1888aa 100644 --- a/docs/generators/html.md +++ b/docs/generators/html.md @@ -15,16 +15,7 @@ sidebar_label: html |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/html2.md b/docs/generators/html2.md index 7201bdc24963..6641bcfa3e49 100644 --- a/docs/generators/html2.md +++ b/docs/generators/html2.md @@ -15,16 +15,7 @@ sidebar_label: html2 |infoEmail|an email address to contact for inquiries about the application| |null| |infoUrl|a URL where users can get more information about the application| |null| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseInfo|a short description of the license| |null| |licenseUrl|a URL pointing to the full license| |null| |packageName|C# package name| |null| diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md index 4d9c6bfe7e4a..47c60b6f501a 100644 --- a/docs/generators/java-inflector.md +++ b/docs/generators/java-inflector.md @@ -27,16 +27,7 @@ sidebar_label: java-inflector |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.controllers| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md index bedc76b14d88..7b37f5dd9a6e 100644 --- a/docs/generators/java-msf4j.md +++ b/docs/generators/java-msf4j.md @@ -28,16 +28,7 @@ sidebar_label: java-msf4j |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template)|<dl><dt>**jersey1**</dt><dd>Jersey core 1.x</dd><dt>**jersey2**</dt><dd>Jersey core 2.x</dd></dl>|jersey2| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md index 95b92bbb1116..a78d000aa76d 100644 --- a/docs/generators/java-pkmst.md +++ b/docs/generators/java-pkmst.md @@ -29,16 +29,7 @@ sidebar_label: java-pkmst |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |com.prokarma.pkmst.controller| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |com.prokarma.pkmst.model| diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md index 6801838e4a48..47dc598c83c2 100644 --- a/docs/generators/java-play-framework.md +++ b/docs/generators/java-play-framework.md @@ -31,16 +31,7 @@ sidebar_label: java-play-framework |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |apimodels| diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md index 94bf4e39cc1a..641ed21d2c5e 100644 --- a/docs/generators/java-undertow-server.md +++ b/docs/generators/java-undertow-server.md @@ -27,16 +27,7 @@ sidebar_label: java-undertow-server |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.handler| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |null| diff --git a/docs/generators/java-vertx-web.md b/docs/generators/java-vertx-web.md index a3fff5103861..1fe08d3b107c 100644 --- a/docs/generators/java-vertx-web.md +++ b/docs/generators/java-vertx-web.md @@ -27,16 +27,7 @@ sidebar_label: java-vertx-web |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.vertxweb.server| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.vertxweb.server.model| diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md index 13e7bb94c420..e2d68f9c5e31 100644 --- a/docs/generators/java-vertx.md +++ b/docs/generators/java-vertx.md @@ -27,16 +27,7 @@ sidebar_label: java-vertx |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.server.api.model| diff --git a/docs/generators/java.md b/docs/generators/java.md index 289ad4405093..c1e25a2055e4 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -29,16 +29,7 @@ sidebar_label: java |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.client| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>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.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**jersey2-experimental**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x (deprecated) or 10.x (default). JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[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'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client X.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/javascript-apollo.md b/docs/generators/javascript-apollo.md index 51a0421dcd72..ca26bb0c0616 100644 --- a/docs/generators/javascript-apollo.md +++ b/docs/generators/javascript-apollo.md @@ -11,16 +11,7 @@ sidebar_label: javascript-apollo |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|name of the license the project uses (Default: using info.license.name)| |null| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/javascript-closure-angular.md b/docs/generators/javascript-closure-angular.md index 4cf42f33a9c5..e870e567eaca 100644 --- a/docs/generators/javascript-closure-angular.md +++ b/docs/generators/javascript-closure-angular.md @@ -8,16 +8,7 @@ sidebar_label: javascript-closure-angular |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md index 8efe8bba9bed..d0a0a709985a 100644 --- a/docs/generators/javascript-flowtyped.md +++ b/docs/generators/javascript-flowtyped.md @@ -9,16 +9,7 @@ sidebar_label: javascript-flowtyped |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |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| diff --git a/docs/generators/javascript.md b/docs/generators/javascript.md index 139499823d60..49dabe82ea2e 100644 --- a/docs/generators/javascript.md +++ b/docs/generators/javascript.md @@ -12,16 +12,7 @@ sidebar_label: javascript |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|root package for generated code| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|name of the license the project uses (Default: using info.license.name)| |null| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md index 13378c214443..dbb740fd3741 100644 --- a/docs/generators/jaxrs-cxf-cdi.md +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -31,16 +31,7 @@ sidebar_label: jaxrs-cxf-cdi |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md index 052caa1f2927..41b28b8bc0b8 100644 --- a/docs/generators/jaxrs-cxf-client.md +++ b/docs/generators/jaxrs-cxf-client.md @@ -27,16 +27,7 @@ sidebar_label: jaxrs-cxf-client |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-cxf-extended.md b/docs/generators/jaxrs-cxf-extended.md index 28756d164f85..68373c8e73bc 100644 --- a/docs/generators/jaxrs-cxf-extended.md +++ b/docs/generators/jaxrs-cxf-extended.md @@ -34,16 +34,7 @@ sidebar_label: jaxrs-cxf-extended |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |loadTestDataFromFile|Load test data from a generated JSON file| |false| diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md index 343374b3c249..4e524009c7c1 100644 --- a/docs/generators/jaxrs-cxf.md +++ b/docs/generators/jaxrs-cxf.md @@ -33,16 +33,7 @@ sidebar_label: jaxrs-cxf |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index ef5a852acf60..80948607ec94 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -28,16 +28,7 @@ sidebar_label: jaxrs-jersey |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template)|<dl><dt>**jersey1**</dt><dd>Jersey core 1.x</dd><dt>**jersey2**</dt><dd>Jersey core 2.x</dd></dl>|jersey2| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md index 1d5f312382e0..50c05785dc61 100644 --- a/docs/generators/jaxrs-resteasy-eap.md +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -29,16 +29,7 @@ sidebar_label: jaxrs-resteasy-eap |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md index 60e52043dc4a..66e7882c4409 100644 --- a/docs/generators/jaxrs-resteasy.md +++ b/docs/generators/jaxrs-resteasy.md @@ -29,16 +29,7 @@ sidebar_label: jaxrs-resteasy |implFolder|folder for generated implementation code| |src/main/java| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md index 98cbb0c96c3b..1d4e97cbf8b6 100644 --- a/docs/generators/jaxrs-spec.md +++ b/docs/generators/jaxrs-spec.md @@ -31,16 +31,7 @@ sidebar_label: jaxrs-spec |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template)|<dl><dt>**<default>**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|<default>| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/jmeter.md b/docs/generators/jmeter.md index e8cbb38e5fd5..16825e5dee41 100644 --- a/docs/generators/jmeter.md +++ b/docs/generators/jmeter.md @@ -7,16 +7,7 @@ sidebar_label: jmeter | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/k6.md b/docs/generators/k6.md index 2f6d321b14f4..7d2b09f46ebe 100644 --- a/docs/generators/k6.md +++ b/docs/generators/k6.md @@ -7,16 +7,7 @@ sidebar_label: k6 | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/markdown.md b/docs/generators/markdown.md index 465504f69446..fef2cddc340d 100644 --- a/docs/generators/markdown.md +++ b/docs/generators/markdown.md @@ -7,16 +7,7 @@ sidebar_label: markdown | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/nim.md b/docs/generators/nim.md index 0340561b620a..5b72fb3575a9 100644 --- a/docs/generators/nim.md +++ b/docs/generators/nim.md @@ -7,16 +7,7 @@ sidebar_label: nim | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/nodejs-express-server.md b/docs/generators/nodejs-express-server.md index 8cc7b8af1fcf..5ded08347aa2 100644 --- a/docs/generators/nodejs-express-server.md +++ b/docs/generators/nodejs-express-server.md @@ -7,16 +7,7 @@ sidebar_label: nodejs-express-server | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |serverPort|TCP port to listen on.| |null| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/nodejs-server-deprecated.md b/docs/generators/nodejs-server-deprecated.md index b2b09ce303c0..981b7b9fffec 100644 --- a/docs/generators/nodejs-server-deprecated.md +++ b/docs/generators/nodejs-server-deprecated.md @@ -9,16 +9,7 @@ sidebar_label: nodejs-server-deprecated |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null| |googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |serverPort|TCP port to listen on.| |null| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/ocaml.md b/docs/generators/ocaml.md index ab9a3bd7fd19..403a8eff9e76 100644 --- a/docs/generators/ocaml.md +++ b/docs/generators/ocaml.md @@ -7,16 +7,7 @@ sidebar_label: ocaml | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/openapi-yaml.md b/docs/generators/openapi-yaml.md index 3d7b5af16037..3fde0dfd3bb6 100644 --- a/docs/generators/openapi-yaml.md +++ b/docs/generators/openapi-yaml.md @@ -7,16 +7,7 @@ sidebar_label: openapi-yaml | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |outputFile|Output filename| |openapi/openapi.yaml| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| diff --git a/docs/generators/openapi.md b/docs/generators/openapi.md index 7625d70cb8b9..fe7fe0cfa509 100644 --- a/docs/generators/openapi.md +++ b/docs/generators/openapi.md @@ -7,16 +7,7 @@ sidebar_label: openapi | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md index e2bbcaaab030..f6447b33d5c4 100644 --- a/docs/generators/php-laravel.md +++ b/docs/generators/php-laravel.md @@ -10,16 +10,7 @@ sidebar_label: php-laravel |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md index 1e69867a13a4..33efe2cc794f 100644 --- a/docs/generators/php-lumen.md +++ b/docs/generators/php-lumen.md @@ -10,16 +10,7 @@ sidebar_label: php-lumen |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-silex.md b/docs/generators/php-silex.md index 2557c8f15166..c9fc756ed198 100644 --- a/docs/generators/php-silex.md +++ b/docs/generators/php-silex.md @@ -7,16 +7,7 @@ sidebar_label: php-silex | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |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| diff --git a/docs/generators/php-slim-deprecated.md b/docs/generators/php-slim-deprecated.md index 16b5a34e7614..d97ebb8060d9 100644 --- a/docs/generators/php-slim-deprecated.md +++ b/docs/generators/php-slim-deprecated.md @@ -10,16 +10,7 @@ sidebar_label: php-slim-deprecated |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-slim4.md b/docs/generators/php-slim4.md index 86f9a6efbc52..ff5ee683ab1d 100644 --- a/docs/generators/php-slim4.md +++ b/docs/generators/php-slim4.md @@ -10,16 +10,7 @@ sidebar_label: php-slim4 |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md index e645d1c0a2dd..1c781a04c97b 100644 --- a/docs/generators/php-symfony.md +++ b/docs/generators/php-symfony.md @@ -15,16 +15,7 @@ sidebar_label: php-symfony |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |phpLegacySupport|Should the generated code be compatible with PHP 5.x?| |true| diff --git a/docs/generators/php-ze-ph.md b/docs/generators/php-ze-ph.md index 6afc5d2a291c..b6852f1087d6 100644 --- a/docs/generators/php-ze-ph.md +++ b/docs/generators/php-ze-ph.md @@ -10,16 +10,7 @@ sidebar_label: php-ze-ph |artifactVersion|The version to use in the composer package version field. e.g. 1.2.3| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php.md b/docs/generators/php.md index ba90aa92d7c9..329969e42fdc 100644 --- a/docs/generators/php.md +++ b/docs/generators/php.md @@ -11,16 +11,7 @@ sidebar_label: php |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |true| |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md index 0904e15e29c3..522e75b3866e 100644 --- a/docs/generators/python-aiohttp.md +++ b/docs/generators/python-aiohttp.md @@ -9,16 +9,7 @@ sidebar_label: python-aiohttp |controllerPackage|controller package| |controllers| |defaultController|default controller| |default_controller| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |packageName|python package name (convention: snake_case).| |openapi_server| |packageVersion|python package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md index ba1613ebe21c..2192715c9850 100644 --- a/docs/generators/python-blueplanet.md +++ b/docs/generators/python-blueplanet.md @@ -9,16 +9,7 @@ sidebar_label: python-blueplanet |controllerPackage|controller package| |controllers| |defaultController|default controller| |default_controller| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |packageName|python package name (convention: snake_case).| |openapi_server| |packageVersion|python package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md index a09e1dd88945..8a230e5fbad1 100644 --- a/docs/generators/python-flask.md +++ b/docs/generators/python-flask.md @@ -9,16 +9,7 @@ sidebar_label: python-flask |controllerPackage|controller package| |controllers| |defaultController|default controller| |default_controller| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |packageName|python package name (convention: snake_case).| |openapi_server| |packageVersion|python package version.| |1.0.0| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/ruby.md b/docs/generators/ruby.md index 9bc917daa983..72dc31253a7e 100644 --- a/docs/generators/ruby.md +++ b/docs/generators/ruby.md @@ -17,16 +17,7 @@ sidebar_label: ruby |gemSummary|gem summary. | |A ruby wrapper for the REST APIs| |gemVersion|gem version.| |1.0.0| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|HTTP library template (sub-template) to use|<dl><dt>**faraday**</dt><dd>Faraday (https://github.com/lostisland/faraday) (Beta support)</dd><dt>**typhoeus**</dt><dd>Typhoeus >= 1.0.1 (https://github.com/typhoeus/typhoeus)</dd></dl>|typhoeus| |moduleName|top module name (convention: CamelCase, usually corresponding to gem name).| |OpenAPIClient| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-akka-http-server.md b/docs/generators/scala-akka-http-server.md index 5b293ffbc327..ce885201ee98 100644 --- a/docs/generators/scala-akka-http-server.md +++ b/docs/generators/scala-akka-http-server.md @@ -14,16 +14,7 @@ sidebar_label: scala-akka-http-server |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |groupId|groupId in generated pom.xml| |org.openapitools| |invokerPackage|root package for generated code| |org.openapitools.server| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-akka.md b/docs/generators/scala-akka.md index d023156775e9..0faa17e202b7 100644 --- a/docs/generators/scala-akka.md +++ b/docs/generators/scala-akka.md @@ -9,16 +9,7 @@ sidebar_label: scala-akka |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |mainPackage|Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage'| |org.openapitools.client| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/scala-gatling.md b/docs/generators/scala-gatling.md index 1b711480df22..3a957c1cb097 100644 --- a/docs/generators/scala-gatling.md +++ b/docs/generators/scala-gatling.md @@ -9,16 +9,7 @@ sidebar_label: scala-gatling |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-httpclient-deprecated.md b/docs/generators/scala-httpclient-deprecated.md index a6ee24cc4479..0a4015fbac0a 100644 --- a/docs/generators/scala-httpclient-deprecated.md +++ b/docs/generators/scala-httpclient-deprecated.md @@ -9,16 +9,7 @@ sidebar_label: scala-httpclient-deprecated |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-lagom-server.md b/docs/generators/scala-lagom-server.md index da97ad1ee7df..cef8bf855c0d 100644 --- a/docs/generators/scala-lagom-server.md +++ b/docs/generators/scala-lagom-server.md @@ -9,16 +9,7 @@ sidebar_label: scala-lagom-server |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-play-server.md b/docs/generators/scala-play-server.md index ef8b2db4e746..dea0eb49248a 100644 --- a/docs/generators/scala-play-server.md +++ b/docs/generators/scala-play-server.md @@ -10,16 +10,7 @@ sidebar_label: scala-play-server |basePackage|Base package in which supporting classes are generated.| |org.openapitools| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |generateCustomExceptions|If set, generates custom exception types.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scala-sttp.md b/docs/generators/scala-sttp.md index 2d1584633b9c..27a8b862b10d 100644 --- a/docs/generators/scala-sttp.md +++ b/docs/generators/scala-sttp.md @@ -9,16 +9,7 @@ sidebar_label: scala-sttp |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |mainPackage|Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage'| |org.openapitools.client| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| diff --git a/docs/generators/scalatra.md b/docs/generators/scalatra.md index bb05a8f35e89..39eb4dc8ca6c 100644 --- a/docs/generators/scalatra.md +++ b/docs/generators/scalatra.md @@ -9,16 +9,7 @@ sidebar_label: scalatra |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/scalaz.md b/docs/generators/scalaz.md index 48ecb1bdfa70..f8279d1df61a 100644 --- a/docs/generators/scalaz.md +++ b/docs/generators/scalaz.md @@ -9,16 +9,7 @@ sidebar_label: scalaz |apiPackage|package for generated api classes| |null| |dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPackage|package for generated models| |null| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index c2a43de8ceaf..93159837dd49 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -35,16 +35,7 @@ sidebar_label: spring |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |invokerPackage|root package for generated code| |org.openapitools.api| |java8|Option. Use Java8 classes instead of third party equivalents|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application using the SpringFox integration.</dd><dt>**spring-mvc**</dt><dd>Spring-MVC Server application using the SpringFox integration.</dd><dt>**spring-cloud**</dt><dd>Spring-Cloud-Feign client with Spring-Boot auto-configured settings.</dd></dl>|spring-boot| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| diff --git a/docs/generators/swift2-deprecated.md b/docs/generators/swift2-deprecated.md index 34894b89301e..76adbe1b0ec3 100644 --- a/docs/generators/swift2-deprecated.md +++ b/docs/generators/swift2-deprecated.md @@ -8,16 +8,7 @@ sidebar_label: swift2-deprecated |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |podAuthors|Authors used for Podspec| |null| |podDescription|Description used for Podspec| |null| |podDocsetURL|Docset URL used for Podspec| |null| diff --git a/docs/generators/swift3-deprecated.md b/docs/generators/swift3-deprecated.md index ed484208b2ce..4d775405c98d 100644 --- a/docs/generators/swift3-deprecated.md +++ b/docs/generators/swift3-deprecated.md @@ -8,16 +8,7 @@ sidebar_label: swift3-deprecated |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false| |objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null| |podAuthors|Authors used for Podspec| |null| diff --git a/docs/generators/swift4.md b/docs/generators/swift4.md index 4030c9a11f31..df9bc30f7ac6 100644 --- a/docs/generators/swift4.md +++ b/docs/generators/swift4.md @@ -8,16 +8,7 @@ sidebar_label: swift4 |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false| |nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null| |objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null| diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md index c7beb3e39abf..acd97596e6ac 100644 --- a/docs/generators/swift5.md +++ b/docs/generators/swift5.md @@ -9,16 +9,7 @@ sidebar_label: swift5 |apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |lenientTypeCast|Accept and cast values for simple types (string->bool, string->int, int->string)| |false| |library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd></dl>|urlsession| |nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null| diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md index 4d9191a91f0c..c4048c19a5b1 100644 --- a/docs/generators/typescript-angular.md +++ b/docs/generators/typescript-angular.md @@ -11,16 +11,7 @@ sidebar_label: typescript-angular |enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |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|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|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| diff --git a/docs/generators/typescript-angularjs.md b/docs/generators/typescript-angularjs.md index 0c5f755640ba..546fff28cc31 100644 --- a/docs/generators/typescript-angularjs.md +++ b/docs/generators/typescript-angularjs.md @@ -9,16 +9,7 @@ sidebar_label: typescript-angularjs |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |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| diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md index f5f0e764b665..02c2e8786abf 100644 --- a/docs/generators/typescript-aurelia.md +++ b/docs/generators/typescript-aurelia.md @@ -9,16 +9,7 @@ sidebar_label: typescript-aurelia |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null| |npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0| diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 575d2e17bbca..b990ed95bd45 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -9,16 +9,7 @@ sidebar_label: typescript-axios |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |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 of your private npmRepo in the package.json| |null| diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index 2662e2adefa5..f1a2226ece47 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -9,16 +9,7 @@ sidebar_label: typescript-fetch |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |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| diff --git a/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md index 6829b64eee83..4b321619e837 100644 --- a/docs/generators/typescript-inversify.md +++ b/docs/generators/typescript-inversify.md @@ -9,16 +9,7 @@ sidebar_label: typescript-inversify |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |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| diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md index 262578ce207a..b28d6b47cb93 100644 --- a/docs/generators/typescript-jquery.md +++ b/docs/generators/typescript-jquery.md @@ -10,16 +10,7 @@ sidebar_label: typescript-jquery |enumNameSuffix|Suffix that will be appended to all enum names. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| |jqueryAlreadyImported|When using this in legacy app using mix of typescript and javascript, this will only declare jquery and not import it| |false| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |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| diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md index 06a4853986a9..ff7916f91309 100644 --- a/docs/generators/typescript-node.md +++ b/docs/generators/typescript-node.md @@ -9,16 +9,7 @@ sidebar_label: typescript-node |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |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| diff --git a/docs/generators/typescript-redux-query.md b/docs/generators/typescript-redux-query.md index 14fbe4c85434..0b1eef9f73a4 100644 --- a/docs/generators/typescript-redux-query.md +++ b/docs/generators/typescript-redux-query.md @@ -9,16 +9,7 @@ sidebar_label: typescript-redux-query |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase| |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| diff --git a/docs/generators/typescript-rxjs.md b/docs/generators/typescript-rxjs.md index e9638e2fbdd3..422b1fda35ff 100644 --- a/docs/generators/typescript-rxjs.md +++ b/docs/generators/typescript-rxjs.md @@ -9,16 +9,7 @@ sidebar_label: typescript-rxjs |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. A special 'v4-compat' value enables the backward-compatible behavior (as pre v4.2.3)| |v4-compat| |enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase| -|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. - -When this flag is set to 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. -- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing. -When this flag is set to true: - -- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document. -Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.| |true| +|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>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.</dd></dl>|true| |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| |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| 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 5b2cc91645b5..63ba78364309 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 @@ -353,15 +353,7 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, public static final String REMOVE_ENUM_VALUE_PREFIX_DESC = "Remove the common prefix of enum values"; public static final String LEGACY_DISCRIMINATOR_BEHAVIOR = "legacyDiscriminatorBehavior"; - public static final String LEGACY_DISCRIMINATOR_BEHAVIOR_DESC = "This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName.\n" + - "\n" + - "When this flag is set to false:\n" + - "\n" + - "- 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.\n" + - "- Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.\n" + - "When this flag is set to true:\n" + - "\n" + - "- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.\n" + - "Note to developers supporting a language generator in OpenAPITools: to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}."; + public static final String LEGACY_DISCRIMINATOR_BEHAVIOR_DESC = "This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. " + + "Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}."; } 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 82cebbf02245..d4cc25414375 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 @@ -1440,9 +1440,14 @@ public DefaultCodegen() { // option to change the order of form/body parameter cliOptions.add(CliOption.newBoolean(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC).defaultValue(Boolean.FALSE.toString())); - cliOptions.add(CliOption.newBoolean(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, - CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC).defaultValue(Boolean.TRUE.toString())); + // option to change how we process + set the data in the discriminator mapping + CliOption legacyDiscriminatorBehaviorOpt = CliOption.newBoolean(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR_DESC).defaultValue(Boolean.TRUE.toString()); + Map<String, String> legacyDiscriminatorBehaviorOpts = new HashMap<>(); + legacyDiscriminatorBehaviorOpts.put("true", "The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document."); + legacyDiscriminatorBehaviorOpts.put("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."); + legacyDiscriminatorBehaviorOpt.setEnum(legacyDiscriminatorBehaviorOpts); + cliOptions.add(legacyDiscriminatorBehaviorOpt); // initialize special character mapping initalizeSpecialCharacterMapping(); From 7424582210e9f0a6627f9db9d6664c08a524c18c Mon Sep 17 00:00:00 2001 From: Dennis Ameling <dennis@dennisameling.com> Date: Tue, 28 Apr 2020 17:13:41 +0200 Subject: [PATCH 31/78] [TypeScript-Angular] Add AuthService example to README.md (#6087) * Add AuthService example to TypeScript Angular README.md * Update generated Angular libs --- .../typescript-angular/README.mustache | 25 +++++++++++++++++++ .../typescript-angular-v2/default/README.md | 25 +++++++++++++++++++ .../typescript-angular-v2/npm/README.md | 25 +++++++++++++++++++ .../with-interfaces/README.md | 25 +++++++++++++++++++ .../typescript-angular-v4.3/npm/README.md | 25 +++++++++++++++++++ .../typescript-angular-v4/npm/README.md | 25 +++++++++++++++++++ .../builds/default/README.md | 25 +++++++++++++++++++ .../builds/with-npm/README.md | 25 +++++++++++++++++++ .../builds/default/README.md | 25 +++++++++++++++++++ .../builds/with-npm/README.md | 25 +++++++++++++++++++ .../builds/default/README.md | 25 +++++++++++++++++++ .../builds/with-npm/README.md | 25 +++++++++++++++++++ .../builds/default/README.md | 25 +++++++++++++++++++ .../builds/with-npm/README.md | 25 +++++++++++++++++++ .../builds/single-request-parameter/README.md | 25 +++++++++++++++++++ .../builds/with-npm/README.md | 25 +++++++++++++++++++ .../with-prefixed-module-name/README.md | 25 +++++++++++++++++++ 17 files changed, 425 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/README.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/README.mustache index 9778346d6d40..446cfcb1b609 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/README.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/README.mustache @@ -107,6 +107,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '{{npmName}}'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '{{npmName}}'; diff --git a/samples/client/petstore/typescript-angular-v2/default/README.md b/samples/client/petstore/typescript-angular-v2/default/README.md index c84c27deabaa..b9bb2dbb6807 100644 --- a/samples/client/petstore/typescript-angular-v2/default/README.md +++ b/samples/client/petstore/typescript-angular-v2/default/README.md @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from ''; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from ''; diff --git a/samples/client/petstore/typescript-angular-v2/npm/README.md b/samples/client/petstore/typescript-angular-v2/npm/README.md index f31a1c6df2e7..45fe3db5a38e 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/README.md +++ b/samples/client/petstore/typescript-angular-v2/npm/README.md @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/angular2-typescript-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/angular2-typescript-petstore'; diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md b/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md index c84c27deabaa..b9bb2dbb6807 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/README.md @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from ''; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from ''; diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/README.md b/samples/client/petstore/typescript-angular-v4.3/npm/README.md index 4d2a22b72c22..336f66615651 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/README.md +++ b/samples/client/petstore/typescript-angular-v4.3/npm/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/angular2-typescript-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/angular2-typescript-petstore'; diff --git a/samples/client/petstore/typescript-angular-v4/npm/README.md b/samples/client/petstore/typescript-angular-v4/npm/README.md index 33b355c7020f..790d0e9f2820 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/README.md +++ b/samples/client/petstore/typescript-angular-v4/npm/README.md @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/angular2-typescript-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/angular2-typescript-petstore'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/README.md b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/README.md index 6fdf5e362fed..e0c9192e33e2 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/README.md +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from ''; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from ''; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/README.md b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/README.md +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/README.md b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/README.md index 6fdf5e362fed..e0c9192e33e2 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/README.md +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from ''; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from ''; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/README.md b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/README.md +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/README.md b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/README.md index 6fdf5e362fed..e0c9192e33e2 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/README.md +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from ''; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from ''; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/README.md b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/README.md +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/README.md b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/README.md index 6fdf5e362fed..e0c9192e33e2 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/README.md +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from ''; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from ''; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/README.md b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/README.md +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/README.md b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/README.md +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/README.md b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/README.md +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md index ab47bc7e4064..ef1f6c5b6ec7 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/README.md @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => { export class AppModule {} ``` +``` +// configuring providers with an authentication service that manages your access tokens +import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore'; + +@NgModule({ + imports: [ ApiModule ], + declarations: [ AppComponent ], + providers: [ + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration( + { + basePath: environment.apiUrl, + accessToken: authService.getAccessToken.bind(authService) + } + ), + deps: [AuthService], + multi: false + } + ], + bootstrap: [ AppComponent ] +}) +export class AppModule {} +``` + ``` import { DefaultApi } from '@openapitools/typescript-angular-petstore'; From e01c1a9b72a395c8cd4223424bfefab68fc5e996 Mon Sep 17 00:00:00 2001 From: iliaskarim <ilias.karim@clover.com> Date: Tue, 28 Apr 2020 23:17:00 -0400 Subject: [PATCH 32/78] Readonly properties for Swift 5 (#6048) * Generate readonly properties in Swift5 with additional readonlyProperties parameter * add sample --- bin/swift5-petstore-all.sh | 2 +- bin/swift5-petstore-readOnlyProperties.json | 7 + bin/swift5-petstore-readOnlyProperties.sh | 42 ++ bin/windows/swift5-petstore-all.bat | 1 + .../swift5-petstore-readonlyProperties.bat | 10 + docs/generators/swift5.md | 1 + .../languages/Swift5ClientCodegen.java | 15 + .../resources/swift5/modelObject.mustache | 6 +- .../options/Swift5OptionsProvider.java | 2 + .../codegen/swift5/Swift5OptionsTest.java | 2 + .../swift5/readonlyProperties/.gitignore | 63 ++ .../.openapi-generator-ignore | 23 + .../.openapi-generator/VERSION | 1 + .../swift5/readonlyProperties/Cartfile | 1 + .../swift5/readonlyProperties/Info.plist | 22 + .../swift5/readonlyProperties/Package.swift | 31 + .../readonlyProperties/PetstoreClient.podspec | 14 + .../PetstoreClient.xcodeproj/project.pbxproj | 536 ++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcschemes/PetstoreClient.xcscheme | 99 +++ .../Classes/OpenAPIs/APIHelper.swift | 70 ++ .../Classes/OpenAPIs/APIs.swift | 64 ++ .../OpenAPIs/APIs/AnotherFakeAPI.swift | 48 ++ .../Classes/OpenAPIs/APIs/FakeAPI.swift | 619 ++++++++++++++++ .../APIs/FakeClassnameTags123API.swift | 51 ++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 431 ++++++++++++ .../Classes/OpenAPIs/APIs/StoreAPI.swift | 165 +++++ .../Classes/OpenAPIs/APIs/UserAPI.swift | 318 +++++++++ .../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 ++ .../Classes/OpenAPIs/Models.swift | 54 ++ .../Models/AdditionalPropertiesClass.swift | 25 + .../Classes/OpenAPIs/Models/Animal.swift | 20 + .../Classes/OpenAPIs/Models/AnimalFarm.swift | 10 + .../Classes/OpenAPIs/Models/ApiResponse.swift | 22 + .../Models/ArrayOfArrayOfNumberOnly.swift | 22 + .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 22 + .../Classes/OpenAPIs/Models/ArrayTest.swift | 28 + .../OpenAPIs/Models/Capitalization.swift | 38 + .../Classes/OpenAPIs/Models/Cat.swift | 22 + .../Classes/OpenAPIs/Models/CatAllOf.swift | 18 + .../Classes/OpenAPIs/Models/Category.swift | 20 + .../Classes/OpenAPIs/Models/ClassModel.swift | 19 + .../Classes/OpenAPIs/Models/Client.swift | 18 + .../Classes/OpenAPIs/Models/Dog.swift | 22 + .../Classes/OpenAPIs/Models/DogAllOf.swift | 18 + .../Classes/OpenAPIs/Models/EnumArrays.swift | 33 + .../Classes/OpenAPIs/Models/EnumClass.swift | 14 + .../Classes/OpenAPIs/Models/EnumTest.swift | 52 ++ .../Classes/OpenAPIs/Models/File.swift | 20 + .../OpenAPIs/Models/FileSchemaTestClass.swift | 20 + .../Classes/OpenAPIs/Models/FormatTest.swift | 42 ++ .../OpenAPIs/Models/HasOnlyReadOnly.swift | 20 + .../Classes/OpenAPIs/Models/List.swift | 22 + .../Classes/OpenAPIs/Models/MapTest.swift | 35 + ...opertiesAndAdditionalPropertiesClass.swift | 22 + .../OpenAPIs/Models/Model200Response.swift | 26 + .../Classes/OpenAPIs/Models/Name.swift | 32 + .../Classes/OpenAPIs/Models/NumberOnly.swift | 22 + .../Classes/OpenAPIs/Models/Order.swift | 34 + .../OpenAPIs/Models/OuterComposite.swift | 28 + .../Classes/OpenAPIs/Models/OuterEnum.swift | 14 + .../Classes/OpenAPIs/Models/Pet.swift | 34 + .../OpenAPIs/Models/ReadOnlyFirst.swift | 20 + .../Classes/OpenAPIs/Models/Return.swift | 23 + .../OpenAPIs/Models/SpecialModelName.swift | 22 + .../OpenAPIs/Models/StringBooleanMap.swift | 45 ++ .../Classes/OpenAPIs/Models/Tag.swift | 20 + .../OpenAPIs/Models/TypeHolderDefault.swift | 34 + .../OpenAPIs/Models/TypeHolderExample.swift | 34 + .../Classes/OpenAPIs/Models/User.swift | 33 + .../OpenAPIs/OpenISO8601DateFormatter.swift | 44 ++ .../OpenAPIs/SynchronizedDictionary.swift | 36 + .../OpenAPIs/URLSessionImplementations.swift | 577 +++++++++++++++ .../swift5/readonlyProperties/README.md | 141 ++++ .../docs/AdditionalPropertiesClass.md | 11 + .../swift5/readonlyProperties/docs/Animal.md | 11 + .../readonlyProperties/docs/AnimalFarm.md | 9 + .../readonlyProperties/docs/AnotherFakeAPI.md | 59 ++ .../readonlyProperties/docs/ApiResponse.md | 12 + .../docs/ArrayOfArrayOfNumberOnly.md | 10 + .../docs/ArrayOfNumberOnly.md | 10 + .../readonlyProperties/docs/ArrayTest.md | 12 + .../readonlyProperties/docs/Capitalization.md | 15 + .../swift5/readonlyProperties/docs/Cat.md | 10 + .../readonlyProperties/docs/CatAllOf.md | 10 + .../readonlyProperties/docs/Category.md | 11 + .../readonlyProperties/docs/ClassModel.md | 10 + .../swift5/readonlyProperties/docs/Client.md | 10 + .../swift5/readonlyProperties/docs/Dog.md | 10 + .../readonlyProperties/docs/DogAllOf.md | 10 + .../readonlyProperties/docs/EnumArrays.md | 11 + .../readonlyProperties/docs/EnumClass.md | 9 + .../readonlyProperties/docs/EnumTest.md | 14 + .../swift5/readonlyProperties/docs/FakeAPI.md | 662 ++++++++++++++++++ .../docs/FakeClassnameTags123API.md | 59 ++ .../swift5/readonlyProperties/docs/File.md | 10 + .../docs/FileSchemaTestClass.md | 11 + .../readonlyProperties/docs/FormatTest.md | 22 + .../docs/HasOnlyReadOnly.md | 11 + .../swift5/readonlyProperties/docs/List.md | 10 + .../swift5/readonlyProperties/docs/MapTest.md | 13 + ...dPropertiesAndAdditionalPropertiesClass.md | 12 + .../docs/Model200Response.md | 11 + .../swift5/readonlyProperties/docs/Name.md | 13 + .../readonlyProperties/docs/NumberOnly.md | 10 + .../swift5/readonlyProperties/docs/Order.md | 15 + .../readonlyProperties/docs/OuterComposite.md | 12 + .../readonlyProperties/docs/OuterEnum.md | 9 + .../swift5/readonlyProperties/docs/Pet.md | 15 + .../swift5/readonlyProperties/docs/PetAPI.md | 469 +++++++++++++ .../readonlyProperties/docs/ReadOnlyFirst.md | 11 + .../swift5/readonlyProperties/docs/Return.md | 10 + .../docs/SpecialModelName.md | 10 + .../readonlyProperties/docs/StoreAPI.md | 206 ++++++ .../docs/StringBooleanMap.md | 9 + .../swift5/readonlyProperties/docs/Tag.md | 11 + .../docs/TypeHolderDefault.md | 14 + .../docs/TypeHolderExample.md | 14 + .../swift5/readonlyProperties/docs/User.md | 17 + .../swift5/readonlyProperties/docs/UserAPI.md | 406 +++++++++++ .../swift5/readonlyProperties/git_push.sh | 58 ++ .../swift5/readonlyProperties/project.yml | 14 + 126 files changed, 7263 insertions(+), 4 deletions(-) create mode 100644 bin/swift5-petstore-readOnlyProperties.json create mode 100755 bin/swift5-petstore-readOnlyProperties.sh create mode 100644 bin/windows/swift5-petstore-readonlyProperties.bat create mode 100644 samples/client/petstore/swift5/readonlyProperties/.gitignore create mode 100644 samples/client/petstore/swift5/readonlyProperties/.openapi-generator-ignore create mode 100644 samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION create mode 100644 samples/client/petstore/swift5/readonlyProperties/Cartfile create mode 100644 samples/client/petstore/swift5/readonlyProperties/Info.plist create mode 100644 samples/client/petstore/swift5/readonlyProperties/Package.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient.podspec create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.pbxproj create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift create mode 100644 samples/client/petstore/swift5/readonlyProperties/README.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Animal.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/AnimalFarm.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/AnotherFakeAPI.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/ApiResponse.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/ArrayTest.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Capitalization.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Cat.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/CatAllOf.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Category.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/ClassModel.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Client.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Dog.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/DogAllOf.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/EnumArrays.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/EnumClass.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/EnumTest.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/FakeClassnameTags123API.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/File.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/List.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/MapTest.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Model200Response.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Name.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/NumberOnly.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Order.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/OuterComposite.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/OuterEnum.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Pet.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Return.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/SpecialModelName.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/StoreAPI.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/StringBooleanMap.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/Tag.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/TypeHolderDefault.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/TypeHolderExample.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/User.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/docs/UserAPI.md create mode 100644 samples/client/petstore/swift5/readonlyProperties/git_push.sh create mode 100644 samples/client/petstore/swift5/readonlyProperties/project.yml diff --git a/bin/swift5-petstore-all.sh b/bin/swift5-petstore-all.sh index bce216fcb420..a4b54f49deff 100755 --- a/bin/swift5-petstore-all.sh +++ b/bin/swift5-petstore-all.sh @@ -9,4 +9,4 @@ ./bin/swift5-petstore-urlsession.sh ./bin/swift5-petstore-alamofire.sh ./bin/swift5-petstore-combine.sh - \ No newline at end of file +./bin/swift5-petstore-readonlyProperties.sh diff --git a/bin/swift5-petstore-readOnlyProperties.json b/bin/swift5-petstore-readOnlyProperties.json new file mode 100644 index 000000000000..3993a3c26aab --- /dev/null +++ b/bin/swift5-petstore-readOnlyProperties.json @@ -0,0 +1,7 @@ +{ + "podSummary": "PetstoreClient", + "podHomepage": "https://github.com/openapitools/openapi-generator", + "podAuthors": "", + "projectName": "PetstoreClient", + "readonlyProperties": true +} diff --git a/bin/swift5-petstore-readOnlyProperties.sh b/bin/swift5-petstore-readOnlyProperties.sh new file mode 100755 index 000000000000..fe838af1d3c6 --- /dev/null +++ b/bin/swift5-petstore-readOnlyProperties.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/swift5 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c ./bin/swift5-petstore-readonlyProperties.json -o samples/client/petstore/swift5/readonlyProperties --generate-alias-as-model $@" + +java $JAVA_OPTS -jar $executable $ags + +if type "xcodegen" > /dev/null 2>&1; then + cd samples/client/petstore/swift5/readonlyProperties + xcodegen generate +fi + +if type "swiftlint" > /dev/null 2>&1; then + cd samples/client/petstore/swift5/readonlyProperties + swiftlint autocorrect +fi \ No newline at end of file diff --git a/bin/windows/swift5-petstore-all.bat b/bin/windows/swift5-petstore-all.bat index 1daaa1fee769..9d656b1437be 100755 --- a/bin/windows/swift5-petstore-all.bat +++ b/bin/windows/swift5-petstore-all.bat @@ -7,3 +7,4 @@ call .\bin\windows\swift5-petstore-nonPublicApi.bat call .\bin\windows\swift5-petstore-urlsession.bat call .\bin\windows\swift5-petstore-alamofire.bat call .\bin\windows\swift5-petstore-combine.bat +call .\bin\windows\swift5-petstore-readonlyProperties.bat diff --git a/bin/windows/swift5-petstore-readonlyProperties.bat b/bin/windows/swift5-petstore-readonlyProperties.bat new file mode 100644 index 000000000000..cc297bd1a4f2 --- /dev/null +++ b/bin/windows/swift5-petstore-readonlyProperties.bat @@ -0,0 +1,10 @@ +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 ags=generate -i modules\openapi-generator\src\test\resources\2_0\swift\petstore-with-fake-endpoints-models-for-testing.yaml -g swift5 -c bin\swift5-petstore-readonlyProperties.json -o samples\client\petstore\swift5\readonlyProperties + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md index acd97596e6ac..9b172cdf785a 100644 --- a/docs/generators/swift5.md +++ b/docs/generators/swift5.md @@ -26,6 +26,7 @@ sidebar_label: swift5 |podVersion|Version used for Podspec| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| |projectName|Project name in Xcode| |null| +|readonlyProperties|Make properties readonly (default: false)| |null| |responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine are available.| |null| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java index b660a83dcb2f..445069455d49 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java @@ -53,6 +53,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig public static final String POD_DESCRIPTION = "podDescription"; public static final String POD_SCREENSHOTS = "podScreenshots"; public static final String POD_DOCUMENTATION_URL = "podDocumentationURL"; + public static final String READONLY_PROPERTIES = "readonlyProperties"; public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace"; public static final String DEFAULT_POD_AUTHORS = "OpenAPI Generator"; public static final String LENIENT_TYPE_CAST = "lenientTypeCast"; @@ -67,6 +68,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig protected boolean nonPublicApi = false; protected boolean objcCompatible = false; protected boolean lenientTypeCast = false; + protected boolean readonlyProperties = false; protected boolean swiftUseApiNamespace; protected String[] responseAs = new String[0]; protected String sourceFolder = "Classes" + File.separator + "OpenAPIs"; @@ -237,6 +239,8 @@ public Swift5ClientCodegen() { cliOptions.add(new CliOption(POD_SCREENSHOTS, "Screenshots used for Podspec")); cliOptions.add(new CliOption(POD_DOCUMENTATION_URL, "Documentation URL used for Podspec")); + cliOptions.add(new CliOption(READONLY_PROPERTIES, "Make properties " + + "readonly (default: false)")); cliOptions.add(new CliOption(SWIFT_USE_API_NAMESPACE, "Flag to make all the API classes inner-class " + "of {{projectName}}API")); @@ -392,6 +396,13 @@ public void processOpts() { additionalProperties.put("useCombine", true); } + // Setup readonlyProperties option, which declares properties so they can only + // be set at initialization + if (additionalProperties.containsKey(READONLY_PROPERTIES)) { + setReadonlyProperties(convertPropertyToBooleanAndWriteBack(READONLY_PROPERTIES)); + } + additionalProperties.put(READONLY_PROPERTIES, readonlyProperties); + // Setup swiftUseApiNamespace option, which makes all the API // classes inner-class of {{projectName}}API if (additionalProperties.containsKey(SWIFT_USE_API_NAMESPACE)) { @@ -777,6 +788,10 @@ public void setLenientTypeCast(boolean lenientTypeCast) { this.lenientTypeCast = lenientTypeCast; } + public void setReadonlyProperties(boolean readonlyProperties) { + this.readonlyProperties = readonlyProperties; + } + public void setResponseAs(String[] responseAs) { this.responseAs = responseAs; } diff --git a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache index 25d7881c05a4..ca3492aba474 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache @@ -9,11 +9,11 @@ {{#allVars}} {{#isEnum}} {{#description}}/** {{description}} */ - {{/description}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var {{name}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} + {{/description}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var {{name}}: {{{datatypeWithEnum}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{/isEnum}} {{^isEnum}} {{#description}}/** {{description}} */ - {{/description}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var {{name}}: {{{datatype}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} + {{/description}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var {{name}}: {{{datatype}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}} {{#objcCompatible}} {{#vendorExtensions.x-swift-optional-scalar}} {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var {{name}}Num: NSNumber? { @@ -34,7 +34,7 @@ } {{/hasVars}} {{#additionalPropertiesType}} - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var additionalProperties: [String:{{{additionalPropertiesType}}}] = [:] + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#readonlyProperties}}private(set) {{/readonlyProperties}}var additionalProperties: [String:{{{additionalPropertiesType}}}] = [:] {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} subscript(key: String) -> {{{additionalPropertiesType}}}? { get { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java index d5cd8cbe38e8..58b3ae01fd3a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift5OptionsProvider.java @@ -43,6 +43,7 @@ public class Swift5OptionsProvider implements OptionsProvider { public static final String POD_DESCRIPTION_VALUE = "podDescription"; public static final String POD_SCREENSHOTS_VALUE = "podScreenshots"; public static final String POD_DOCUMENTATION_URL_VALUE = "podDocumentationURL"; + public static final String READONLY_PROPERTIES_VALUE = "false"; public static final String SWIFT_USE_API_NAMESPACE_VALUE = "swiftUseApiNamespace"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; @@ -74,6 +75,7 @@ public Map<String, String> createOptions() { .put(Swift5ClientCodegen.POD_DESCRIPTION, POD_DESCRIPTION_VALUE) .put(Swift5ClientCodegen.POD_SCREENSHOTS, POD_SCREENSHOTS_VALUE) .put(Swift5ClientCodegen.POD_DOCUMENTATION_URL, POD_DOCUMENTATION_URL_VALUE) + .put(Swift5ClientCodegen.READONLY_PROPERTIES, READONLY_PROPERTIES_VALUE) .put(Swift5ClientCodegen.SWIFT_USE_API_NAMESPACE, SWIFT_USE_API_NAMESPACE_VALUE) .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true") .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java index 3902711776af..04ec85ecfbe6 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift5/Swift5OptionsTest.java @@ -20,6 +20,7 @@ import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.languages.Swift5ClientCodegen; +import org.openapitools.codegen.options.Swift4OptionsProvider; import org.openapitools.codegen.options.Swift5OptionsProvider; import static org.mockito.Mockito.mock; @@ -47,5 +48,6 @@ protected void verifyOptions() { verify(clientCodegen).setObjcCompatible(Boolean.parseBoolean(Swift5OptionsProvider.OBJC_COMPATIBLE_VALUE)); verify(clientCodegen).setLenientTypeCast(Boolean.parseBoolean(Swift5OptionsProvider.LENIENT_TYPE_CAST_VALUE)); verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(Swift5OptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); + verify(clientCodegen).setReadonlyProperties(Boolean.valueOf(Swift5OptionsProvider.READONLY_PROPERTIES_VALUE)); } } diff --git a/samples/client/petstore/swift5/readonlyProperties/.gitignore b/samples/client/petstore/swift5/readonlyProperties/.gitignore new file mode 100644 index 000000000000..5e5d5cebcf47 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/.gitignore @@ -0,0 +1,63 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata + +## Other +*.xccheckout +*.moved-aside +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots diff --git a/samples/client/petstore/swift5/readonlyProperties/.openapi-generator-ignore b/samples/client/petstore/swift5/readonlyProperties/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/.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/swift5/readonlyProperties/.openapi-generator/VERSION b/samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION new file mode 100644 index 000000000000..b5d898602c2c --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift5/readonlyProperties/Cartfile b/samples/client/petstore/swift5/readonlyProperties/Cartfile new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/Cartfile @@ -0,0 +1 @@ + diff --git a/samples/client/petstore/swift5/readonlyProperties/Info.plist b/samples/client/petstore/swift5/readonlyProperties/Info.plist new file mode 100644 index 000000000000..323e5ecfc420 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> +</dict> +</plist> diff --git a/samples/client/petstore/swift5/readonlyProperties/Package.swift b/samples/client/petstore/swift5/readonlyProperties/Package.swift new file mode 100644 index 000000000000..96dfff54edf4 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/Package.swift @@ -0,0 +1,31 @@ +// swift-tools-version:5.0 + +import PackageDescription + +let package = Package( + name: "PetstoreClient", + platforms: [ + .iOS(.v9), + .macOS(.v10_11), + .tvOS(.v9), + .watchOS(.v3) + ], + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "PetstoreClient", + targets: ["PetstoreClient"]) + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "PetstoreClient", + dependencies: [], + path: "PetstoreClient/Classes" + ) + ] +) diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.podspec b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.podspec new file mode 100644 index 000000000000..b61285f6b25e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |s| + s.name = 'PetstoreClient' + s.ios.deployment_target = '9.0' + s.osx.deployment_target = '10.11' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '3.0' + s.version = '1.0.0' + s.source = { :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' } + s.authors = '' + s.license = 'Proprietary' + s.homepage = 'https://github.com/openapitools/openapi-generator' + s.summary = 'PetstoreClient' + s.source_files = 'PetstoreClient/Classes/**/*.swift' +end diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..6f8918eb338e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.pbxproj @@ -0,0 +1,536 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */; }; + 081C0B80A989B1AAF2665121 /* MapTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7986861626C2B1CB49AD7000 /* MapTest.swift */; }; + 0C1E4C682F2D0AF7D9E431EE /* Dog.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6C3E1129526A353B963EFD7 /* Dog.swift */; }; + 0E6932F1C55BA6880693C478 /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B2E9EF856E89FEAA359A3A /* Order.swift */; }; + 1E6C7C7F271A802DF8099330 /* APIHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897716962D472FE162B723CB /* APIHelper.swift */; }; + 248F2F0F29E8FDAE9CAD64C5 /* AdditionalPropertiesClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */; }; + 269E3103C458C78EA5726EE2 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C298FC8929DCB369053F11 /* Extensions.swift */; }; + 294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 386FD590658E90509C121118 /* SpecialModelName.swift */; }; + 2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95568E7C35F119EB4A12B498 /* Animal.swift */; }; + 2C29D5B60E00DDA3878F1BDE /* Pet.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */; }; + 31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5565A447062C7B8F695F451 /* User.swift */; }; + 34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */ = {isa = PBXBuildFile; fileRef = B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */; }; + 3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */; }; + 37DEADD6CD0496690725B8A7 /* Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AD994DFAA0DA93C188A4DBA /* Name.swift */; }; + 40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DF825B8F3BADA2B2537D17 /* APIs.swift */; }; + 41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */; }; + 45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D22BE01748F51106DE02332 /* AnimalFarm.swift */; }; + 4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */; }; + 4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */; }; + 555DEA47352B42E49082922B /* NumberOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E0B16084741FCB82389F58 /* NumberOnly.swift */; }; + 5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */; }; + 61322FC4325F1A4FF24ACA48 /* EnumArrays.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10503995D9EFD031A2EFB576 /* EnumArrays.swift */; }; + 64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C8D5F382979854D47F18DB1 /* UserAPI.swift */; }; + 6B638A04B34C82B2091D6EDD /* FormatTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3156CE41C001C80379B84BDB /* FormatTest.swift */; }; + 6FBD978F4D1ED92E7071FFBB /* CodableHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */; }; + 72547ECFB451A509409311EE /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A444949BBC254798C3B3DD /* Configuration.swift */; }; + 72CE544C52BB33778D1B89B8 /* DogAllOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21A69C8402A60E01116ABBD /* DogAllOf.swift */; }; + 7441BBA84C31E06400338F89 /* ClassModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */; }; + 7588B7E2960253174ADCCF16 /* JSONEncodingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */; }; + 86DE714469BE8BA28AFF710F /* HasOnlyReadOnly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */; }; + 914F4D1FCB17773C067C4E68 /* ReadOnlyFirst.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */; }; + 922BDADAB291907A7FD14314 /* OuterComposite.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */; }; + 97F7B85BF07A325EEBF92C93 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3933D3B2A3AC4577094D0C23 /* File.swift */; }; + 9CA19AA4483F6EB50270A81E /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A6070F581E611FF44AFD40A /* List.swift */; }; + 9CF06ACDA32CB0C3E74E435C /* Model200Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */; }; + 9D22720B1B12BE43D3B45ADE /* JSONDataEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10A7A27EE12A4DFEA1C0EE35 /* JSONDataEncoding.swift */; }; + 9DA1C6F8B4D6C8595F28C098 /* EnumTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD60AEA646791E0EDE885DE1 /* EnumTest.swift */; }; + A3E16915AA7FD644C4FE162E /* URLSessionImplementations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11F49B24B6239C324722572C /* URLSessionImplementations.swift */; }; + A6E50CC6845FE58D8C236253 /* Return.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81447828475F76C5CF4F08A /* Return.swift */; }; + A6E5A5629495DB0ED672B06F /* PetAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A019F500E546A3292CE716A /* PetAPI.swift */; }; + A85E190556818FFA79896E92 /* ArrayTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1A0379CDFC55705AE76C998 /* ArrayTest.swift */; }; + ACF3037926301D4D6E848745 /* EnumClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */; }; + AD3A3107C12F2634CD22163B /* SynchronizedDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = D138F6DA6160301F9281383E /* SynchronizedDictionary.swift */; }; + AD594BFB99E31A5E07579237 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = A913A57E72D723632E9A718F /* Client.swift */; }; + B301DB1B80F37C757550AA17 /* MixedPropertiesAndAdditionalPropertiesClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */; }; + B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2896F8BFD1AA2965C8A3015 /* Tag.swift */; }; + B637B9432565A6A8E7C73E7F /* OpenISO8601DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD7A1702ACD8737DED6588CD /* OpenISO8601DateFormatter.swift */; }; + BB1F3C6D50B8F0A8CC4F1749 /* Capitalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B38FA00A494D13F4C382A3 /* Capitalization.swift */; }; + CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */; }; + CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53274D99BBDE1B79BF3521C /* StoreAPI.swift */; }; + D3BAB7C7A607392CA838C580 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8699F7966F748ED026A6FB4C /* Models.swift */; }; + D95A5F83AAA7D5C95A29AB83 /* Cat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 212AA914B7F1793A4E32C119 /* Cat.swift */; }; + DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E00950725DC44436C5E238C /* FakeAPI.swift */; }; + DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */; }; + E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F2985D01F8D60A4B1925C69 /* Category.swift */; }; + EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */; }; + FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableHelper.swift; sourceTree = "<group>"; }; + 10503995D9EFD031A2EFB576 /* EnumArrays.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumArrays.swift; sourceTree = "<group>"; }; + 10A7A27EE12A4DFEA1C0EE35 /* JSONDataEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONDataEncoding.swift; sourceTree = "<group>"; }; + 11F49B24B6239C324722572C /* URLSessionImplementations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionImplementations.swift; sourceTree = "<group>"; }; + 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PetstoreClient.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeHolderExample.swift; sourceTree = "<group>"; }; + 212AA914B7F1793A4E32C119 /* Cat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cat.swift; sourceTree = "<group>"; }; + 27B2E9EF856E89FEAA359A3A /* Order.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Order.swift; sourceTree = "<group>"; }; + 28A444949BBC254798C3B3DD /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; }; + 3156CE41C001C80379B84BDB /* FormatTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormatTest.swift; sourceTree = "<group>"; }; + 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONEncodingHelper.swift; sourceTree = "<group>"; }; + 37DF825B8F3BADA2B2537D17 /* APIs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = "<group>"; }; + 386FD590658E90509C121118 /* SpecialModelName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialModelName.swift; sourceTree = "<group>"; }; + 3933D3B2A3AC4577094D0C23 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; }; + 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdditionalPropertiesClass.swift; sourceTree = "<group>"; }; + 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatAllOf.swift; sourceTree = "<group>"; }; + 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassModel.swift; sourceTree = "<group>"; }; + 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringBooleanMap.swift; sourceTree = "<group>"; }; + 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumClass.swift; sourceTree = "<group>"; }; + 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileSchemaTestClass.swift; sourceTree = "<group>"; }; + 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HasOnlyReadOnly.swift; sourceTree = "<group>"; }; + 5AD994DFAA0DA93C188A4DBA /* Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Name.swift; sourceTree = "<group>"; }; + 6E00950725DC44436C5E238C /* FakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeAPI.swift; sourceTree = "<group>"; }; + 6F2985D01F8D60A4B1925C69 /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = "<group>"; }; + 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadOnlyFirst.swift; sourceTree = "<group>"; }; + 7986861626C2B1CB49AD7000 /* MapTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTest.swift; sourceTree = "<group>"; }; + 7A6070F581E611FF44AFD40A /* List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = List.swift; sourceTree = "<group>"; }; + 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayOfArrayOfNumberOnly.swift; sourceTree = "<group>"; }; + 7C8D5F382979854D47F18DB1 /* UserAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAPI.swift; sourceTree = "<group>"; }; + 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model200Response.swift; sourceTree = "<group>"; }; + 8699F7966F748ED026A6FB4C /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = "<group>"; }; + 897716962D472FE162B723CB /* APIHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIHelper.swift; sourceTree = "<group>"; }; + 8D22BE01748F51106DE02332 /* AnimalFarm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalFarm.swift; sourceTree = "<group>"; }; + 95568E7C35F119EB4A12B498 /* Animal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Animal.swift; sourceTree = "<group>"; }; + 9A019F500E546A3292CE716A /* PetAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PetAPI.swift; sourceTree = "<group>"; }; + 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MixedPropertiesAndAdditionalPropertiesClass.swift; sourceTree = "<group>"; }; + 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnotherFakeAPI.swift; sourceTree = "<group>"; }; + A21A69C8402A60E01116ABBD /* DogAllOf.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogAllOf.swift; sourceTree = "<group>"; }; + A53274D99BBDE1B79BF3521C /* StoreAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreAPI.swift; sourceTree = "<group>"; }; + A7B38FA00A494D13F4C382A3 /* Capitalization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Capitalization.swift; sourceTree = "<group>"; }; + A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiResponse.swift; sourceTree = "<group>"; }; + A913A57E72D723632E9A718F /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = "<group>"; }; + B2896F8BFD1AA2965C8A3015 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = "<group>"; }; + B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeClassnameTags123API.swift; sourceTree = "<group>"; }; + B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayOfNumberOnly.swift; sourceTree = "<group>"; }; + B8C298FC8929DCB369053F11 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; }; + B8E0B16084741FCB82389F58 /* NumberOnly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberOnly.swift; sourceTree = "<group>"; }; + C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuterEnum.swift; sourceTree = "<group>"; }; + C6C3E1129526A353B963EFD7 /* Dog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dog.swift; sourceTree = "<group>"; }; + C81447828475F76C5CF4F08A /* Return.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Return.swift; sourceTree = "<group>"; }; + D138F6DA6160301F9281383E /* SynchronizedDictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SynchronizedDictionary.swift; sourceTree = "<group>"; }; + E5565A447062C7B8F695F451 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; }; + EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeHolderDefault.swift; sourceTree = "<group>"; }; + ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pet.swift; sourceTree = "<group>"; }; + F1A0379CDFC55705AE76C998 /* ArrayTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayTest.swift; sourceTree = "<group>"; }; + F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuterComposite.swift; sourceTree = "<group>"; }; + FD60AEA646791E0EDE885DE1 /* EnumTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnumTest.swift; sourceTree = "<group>"; }; + FD7A1702ACD8737DED6588CD /* OpenISO8601DateFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenISO8601DateFormatter.swift; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + 4FBDCF1330A9AB9122780DB3 /* Models */ = { + isa = PBXGroup; + children = ( + 396DEF3156BA0D12D0FC5C3C /* AdditionalPropertiesClass.swift */, + 95568E7C35F119EB4A12B498 /* Animal.swift */, + 8D22BE01748F51106DE02332 /* AnimalFarm.swift */, + A8E7B833748B4F0C7CDA90C6 /* ApiResponse.swift */, + 7B1B8B838B5D9D312F2002EB /* ArrayOfArrayOfNumberOnly.swift */, + B65BB72353DA24536A9049BE /* ArrayOfNumberOnly.swift */, + F1A0379CDFC55705AE76C998 /* ArrayTest.swift */, + A7B38FA00A494D13F4C382A3 /* Capitalization.swift */, + 212AA914B7F1793A4E32C119 /* Cat.swift */, + 3AD0F94F512DFBC09F9CC79A /* CatAllOf.swift */, + 6F2985D01F8D60A4B1925C69 /* Category.swift */, + 3C30827D8EAF8EA684E7BCEA /* ClassModel.swift */, + A913A57E72D723632E9A718F /* Client.swift */, + C6C3E1129526A353B963EFD7 /* Dog.swift */, + A21A69C8402A60E01116ABBD /* DogAllOf.swift */, + 10503995D9EFD031A2EFB576 /* EnumArrays.swift */, + 4B2C97AE6ACA1E5FB88F5BAA /* EnumClass.swift */, + FD60AEA646791E0EDE885DE1 /* EnumTest.swift */, + 3933D3B2A3AC4577094D0C23 /* File.swift */, + 4B3666552AA854DAF9C480A3 /* FileSchemaTestClass.swift */, + 3156CE41C001C80379B84BDB /* FormatTest.swift */, + 4C7FBC641752D2E13B150973 /* HasOnlyReadOnly.swift */, + 7A6070F581E611FF44AFD40A /* List.swift */, + 7986861626C2B1CB49AD7000 /* MapTest.swift */, + 9AD714C7CC59BDD18DE8DF4E /* MixedPropertiesAndAdditionalPropertiesClass.swift */, + 82A2C3DC2235F0114C2B08E5 /* Model200Response.swift */, + 5AD994DFAA0DA93C188A4DBA /* Name.swift */, + B8E0B16084741FCB82389F58 /* NumberOnly.swift */, + 27B2E9EF856E89FEAA359A3A /* Order.swift */, + F4E0AD8F60A91F72C7687560 /* OuterComposite.swift */, + C15008AABC804EB6FB4CDAC6 /* OuterEnum.swift */, + ECFEB4C6C257B3BB3CEA36D1 /* Pet.swift */, + 6FD42727E001E799E458C292 /* ReadOnlyFirst.swift */, + C81447828475F76C5CF4F08A /* Return.swift */, + 386FD590658E90509C121118 /* SpecialModelName.swift */, + 47B4DEBABEFE140768CFB70B /* StringBooleanMap.swift */, + B2896F8BFD1AA2965C8A3015 /* Tag.swift */, + EBC76F6D4D2AA8084B7EB50E /* TypeHolderDefault.swift */, + 19B65C66C97F082718DDD703 /* TypeHolderExample.swift */, + E5565A447062C7B8F695F451 /* User.swift */, + ); + path = Models; + sourceTree = "<group>"; + }; + 5FBA6AE5F64CD737F88B4565 = { + isa = PBXGroup; + children = ( + 9B364C01750D7AA4F983B9E7 /* PetstoreClient */, + 857F0DEA1890CE66D6DAD556 /* Products */, + ); + sourceTree = "<group>"; + }; + 67BF3478113E6B4DF1C4E04F /* OpenAPIs */ = { + isa = PBXGroup; + children = ( + 897716962D472FE162B723CB /* APIHelper.swift */, + 37DF825B8F3BADA2B2537D17 /* APIs.swift */, + 02A6F6BB2152ACEE1416D44A /* CodableHelper.swift */, + 28A444949BBC254798C3B3DD /* Configuration.swift */, + B8C298FC8929DCB369053F11 /* Extensions.swift */, + 10A7A27EE12A4DFEA1C0EE35 /* JSONDataEncoding.swift */, + 35D710108A69DD8A5297F926 /* JSONEncodingHelper.swift */, + 8699F7966F748ED026A6FB4C /* Models.swift */, + FD7A1702ACD8737DED6588CD /* OpenISO8601DateFormatter.swift */, + D138F6DA6160301F9281383E /* SynchronizedDictionary.swift */, + 11F49B24B6239C324722572C /* URLSessionImplementations.swift */, + F956D0CCAE23BCFD1C7BDD5D /* APIs */, + 4FBDCF1330A9AB9122780DB3 /* Models */, + ); + path = OpenAPIs; + sourceTree = "<group>"; + }; + 857F0DEA1890CE66D6DAD556 /* Products */ = { + isa = PBXGroup; + children = ( + 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */, + ); + name = Products; + sourceTree = "<group>"; + }; + 9B364C01750D7AA4F983B9E7 /* PetstoreClient */ = { + isa = PBXGroup; + children = ( + EF4C81BDD734856ED5023B77 /* Classes */, + ); + path = PetstoreClient; + sourceTree = "<group>"; + }; + EF4C81BDD734856ED5023B77 /* Classes */ = { + isa = PBXGroup; + children = ( + 67BF3478113E6B4DF1C4E04F /* OpenAPIs */, + ); + path = Classes; + sourceTree = "<group>"; + }; + F956D0CCAE23BCFD1C7BDD5D /* APIs */ = { + isa = PBXGroup; + children = ( + 9DF24D2714B9C4CF14146E88 /* AnotherFakeAPI.swift */, + 6E00950725DC44436C5E238C /* FakeAPI.swift */, + B42354B407EC173BEB54E042 /* FakeClassnameTags123API.swift */, + 9A019F500E546A3292CE716A /* PetAPI.swift */, + A53274D99BBDE1B79BF3521C /* StoreAPI.swift */, + 7C8D5F382979854D47F18DB1 /* UserAPI.swift */, + ); + path = APIs; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C1282C2230015E0D204BEAED /* PetstoreClient */ = { + isa = PBXNativeTarget; + buildConfigurationList = B46EDEB1A7F0D78FE6394544 /* Build configuration list for PBXNativeTarget "PetstoreClient" */; + buildPhases = ( + E539708354CE60FE486F81ED /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PetstoreClient; + productName = PetstoreClient; + productReference = 164AD6EC9C4CCF634D7C4590 /* PetstoreClient.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E7D276EE2369D8C455513C2E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + }; + buildConfigurationList = ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 5FBA6AE5F64CD737F88B4565; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C1282C2230015E0D204BEAED /* PetstoreClient */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + E539708354CE60FE486F81ED /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E6C7C7F271A802DF8099330 /* APIHelper.swift in Sources */, + 40E3027D2E38D8329C6AB01F /* APIs.swift in Sources */, + 248F2F0F29E8FDAE9CAD64C5 /* AdditionalPropertiesClass.swift in Sources */, + 2B441CDFFFDDB343C04F5375 /* Animal.swift in Sources */, + 45B3B29D7A62049F824751F8 /* AnimalFarm.swift in Sources */, + CA9B9B19882EA044EAD0B359 /* AnotherFakeAPI.swift in Sources */, + 0299339D13C3571C4C57368A /* ApiResponse.swift in Sources */, + 4B4BE77747413A9188CDABD2 /* ArrayOfArrayOfNumberOnly.swift in Sources */, + 3691B017D3AA18404A563C67 /* ArrayOfNumberOnly.swift in Sources */, + A85E190556818FFA79896E92 /* ArrayTest.swift in Sources */, + BB1F3C6D50B8F0A8CC4F1749 /* Capitalization.swift in Sources */, + D95A5F83AAA7D5C95A29AB83 /* Cat.swift in Sources */, + 4A344DF7ECE721B4BBEDCB4A /* CatAllOf.swift in Sources */, + E8A58C6414E88AF3EAE45B69 /* Category.swift in Sources */, + 7441BBA84C31E06400338F89 /* ClassModel.swift in Sources */, + AD594BFB99E31A5E07579237 /* Client.swift in Sources */, + 6FBD978F4D1ED92E7071FFBB /* CodableHelper.swift in Sources */, + 72547ECFB451A509409311EE /* Configuration.swift in Sources */, + 0C1E4C682F2D0AF7D9E431EE /* Dog.swift in Sources */, + 72CE544C52BB33778D1B89B8 /* DogAllOf.swift in Sources */, + 61322FC4325F1A4FF24ACA48 /* EnumArrays.swift in Sources */, + ACF3037926301D4D6E848745 /* EnumClass.swift in Sources */, + 9DA1C6F8B4D6C8595F28C098 /* EnumTest.swift in Sources */, + 269E3103C458C78EA5726EE2 /* Extensions.swift in Sources */, + DDBD4C0FBA3CD6A4DA3DF376 /* FakeAPI.swift in Sources */, + 34C26979F4678B5B579D26E8 /* FakeClassnameTags123API.swift in Sources */, + 97F7B85BF07A325EEBF92C93 /* File.swift in Sources */, + DDF1D589267D56D9BED3C6E5 /* FileSchemaTestClass.swift in Sources */, + 6B638A04B34C82B2091D6EDD /* FormatTest.swift in Sources */, + 86DE714469BE8BA28AFF710F /* HasOnlyReadOnly.swift in Sources */, + 9D22720B1B12BE43D3B45ADE /* JSONDataEncoding.swift in Sources */, + 7588B7E2960253174ADCCF16 /* JSONEncodingHelper.swift in Sources */, + 9CA19AA4483F6EB50270A81E /* List.swift in Sources */, + 081C0B80A989B1AAF2665121 /* MapTest.swift in Sources */, + B301DB1B80F37C757550AA17 /* MixedPropertiesAndAdditionalPropertiesClass.swift in Sources */, + 9CF06ACDA32CB0C3E74E435C /* Model200Response.swift in Sources */, + D3BAB7C7A607392CA838C580 /* Models.swift in Sources */, + 37DEADD6CD0496690725B8A7 /* Name.swift in Sources */, + 555DEA47352B42E49082922B /* NumberOnly.swift in Sources */, + B637B9432565A6A8E7C73E7F /* OpenISO8601DateFormatter.swift in Sources */, + 0E6932F1C55BA6880693C478 /* Order.swift in Sources */, + 922BDADAB291907A7FD14314 /* OuterComposite.swift in Sources */, + 41A491E9B577C510F927D126 /* OuterEnum.swift in Sources */, + 2C29D5B60E00DDA3878F1BDE /* Pet.swift in Sources */, + A6E5A5629495DB0ED672B06F /* PetAPI.swift in Sources */, + 914F4D1FCB17773C067C4E68 /* ReadOnlyFirst.swift in Sources */, + A6E50CC6845FE58D8C236253 /* Return.swift in Sources */, + 294CDFA409BC369C0FDC5FB3 /* SpecialModelName.swift in Sources */, + CB68ABDBAADAF6B8D7B93A5D /* StoreAPI.swift in Sources */, + EDFC6C5121A43997014049CB /* StringBooleanMap.swift in Sources */, + AD3A3107C12F2634CD22163B /* SynchronizedDictionary.swift in Sources */, + B3E35FE2773D4A8BA15CFA88 /* Tag.swift in Sources */, + 5695497F5DBF6C08842755A3 /* TypeHolderDefault.swift in Sources */, + FECA2E8C9D0BDFEC459E8996 /* TypeHolderExample.swift in Sources */, + A3E16915AA7FD644C4FE162E /* URLSessionImplementations.swift in Sources */, + 31DFF71D8CCCA0D2D2F8AC90 /* User.swift in Sources */, + 64C48E3658CF53EBE8AF82F9 /* UserAPI.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3B2C02AFB91CB5C82766ED5C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; + A9EB0A02B94C427CBACFEC7C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + DD3EEB93949E9EBA4437E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + APPLICATION_EXTENSION_API_ONLY = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + F81D4E5FECD46E9AA6DD2C29 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B46EDEB1A7F0D78FE6394544 /* Build configuration list for PBXNativeTarget "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DD3EEB93949E9EBA4437E9CD /* Debug */, + 3B2C02AFB91CB5C82766ED5C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ""; + }; + ECAB17FF35111B5E14DAAC08 /* Build configuration list for PBXProject "PetstoreClient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A9EB0A02B94C427CBACFEC7C /* Debug */, + F81D4E5FECD46E9AA6DD2C29 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = E7D276EE2369D8C455513C2E /* Project object */; +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000000..919434a6254f --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:"> + </FileRef> +</Workspace> diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme new file mode 100644 index 000000000000..26d510552bb0 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient.xcodeproj/xcshareddata/xcschemes/PetstoreClient.xcscheme @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1020" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "C1282C2230015E0D204BEAED" + BuildableName = "PetstoreClient.framework" + BlueprintName = "PetstoreClient" + ReferencedContainer = "container:PetstoreClient.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + onlyGenerateCoverageForSpecifiedTargets = "NO" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </Testables> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "C1282C2230015E0D204BEAED" + BuildableName = "PetstoreClient.framework" + BlueprintName = "PetstoreClient" + ReferencedContainer = "container:PetstoreClient.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <CommandLineArguments> + </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + <CodeCoverageTargets> + </CodeCoverageTargets> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "C1282C2230015E0D204BEAED" + BuildableName = "PetstoreClient.framework" + BlueprintName = "PetstoreClient" + ReferencedContainer = "container:PetstoreClient.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <CommandLineArguments> + </CommandLineArguments> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "C1282C2230015E0D204BEAED" + BuildableName = "PetstoreClient.framework" + BlueprintName = "PetstoreClient" + ReferencedContainer = "container:PetstoreClient.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + <CommandLineArguments> + </CommandLineArguments> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift new file mode 100644 index 000000000000..200070096800 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -0,0 +1,70 @@ +// APIHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct APIHelper { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { + let destination = source.reduce(into: [String: Any]()) { (result, item) in + if let value = item.value { + result[item.key] = value + } + } + + if destination.isEmpty { + return nil + } + return destination + } + + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { + return source.reduce(into: [String: String]()) { (result, item) in + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") + } else if let value: Any = item.value { + result[item.key] = "\(value)" + } + } + } + + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { + guard let source = source else { + return nil + } + + return source.reduce(into: [String: Any](), { (result, item) in + switch item.value { + case let x as Bool: + result[item.key] = x.description + default: + result[item.key] = item.value + } + }) + } + + public static func mapValueToPathItem(_ source: Any) -> Any { + if let collection = source as? [Any?] { + return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + } + return source + } + + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { + let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in + if let collection = item.value as? [Any?] { + let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + result.append(URLQueryItem(name: item.key, value: value)) + } else if let value = item.value { + result.append(URLQueryItem(name: item.key, value: "\(value)")) + } + } + + if destination.isEmpty { + return nil + } + return destination + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift new file mode 100644 index 000000000000..a5c2d605dff6 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -0,0 +1,64 @@ +// APIs.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class PetstoreClientAPI { + public static var basePath = "http://petstore.swagger.io:80/v2" + public static var credential: URLCredential? + public static var customHeaders: [String: String] = [:] + public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() + public static var apiResponseQueue: DispatchQueue = .main +} + +open class RequestBuilder<T> { + var credential: URLCredential? + var headers: [String: String] + public let parameters: [String: Any]? + public let isBody: Bool + public let method: String + public let URLString: String + + /// Optional block to obtain a reference to the request's progress instance when available. + /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. + /// If you need to get the request's progress in older OS versions, please use Alamofire http client. + public var onProgressReady: ((Progress) -> Void)? + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + self.method = method + self.URLString = URLString + self.parameters = parameters + self.isBody = isBody + self.headers = headers + + addHeaders(PetstoreClientAPI.customHeaders) + } + + open func addHeaders(_ aHeaders: [String: String]) { + for (header, value) in aHeaders { + headers[header] = value + } + } + + open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } + + public func addHeader(name: String, value: String) -> Self { + if !value.isEmpty { + headers[name] = value + } + return self + } + + open func addCredential() -> Self { + self.credential = PetstoreClientAPI.credential + return self + } +} + +public protocol RequestBuilderFactory { + func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift new file mode 100644 index 000000000000..5bbf323f820c --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -0,0 +1,48 @@ +// +// AnotherFakeAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class AnotherFakeAPI { + /** + To test special tags + + - parameter body: (body) client model + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + To test special tags + - PATCH /another-fake/dummy + - To test special tags and operation ID starting with number + - parameter body: (body) client model + - returns: RequestBuilder<Client> + */ + open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> { + let path = "/another-fake/dummy" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift new file mode 100644 index 000000000000..134d6aea416a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -0,0 +1,619 @@ +// +// FakeAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class FakeAPI { + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + - POST /fake/outer/boolean + - Test serialization of outer boolean types + - parameter body: (body) Input boolean as post body (optional) + - returns: RequestBuilder<Bool> + */ + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder<Bool> { + let path = "/fake/outer/boolean" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Bool>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + - POST /fake/outer/composite + - Test serialization of object with outer number type + - parameter body: (body) Input composite as post body (optional) + - returns: RequestBuilder<OuterComposite> + */ + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> { + let path = "/fake/outer/composite" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<OuterComposite>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input number as post body (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + - POST /fake/outer/number + - Test serialization of outer number types + - parameter body: (body) Input number as post body (optional) + - returns: RequestBuilder<Double> + */ + open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder<Double> { + let path = "/fake/outer/number" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Double>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input string as post body (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + - POST /fake/outer/string + - Test serialization of outer string types + - parameter body: (body) Input string as post body (optional) + - returns: RequestBuilder<String> + */ + open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder<String> { + let path = "/fake/outer/string" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + - PUT /fake/body-with-file-schema + - For this test, the body for this request much reference a schema named `File`. + - parameter body: (body) + - returns: RequestBuilder<Void> + */ + open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> { + let path = "/fake/body-with-file-schema" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter query: (query) + - parameter body: (body) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + - PUT /fake/body-with-query-params + - parameter query: (query) + - parameter body: (body) + - returns: RequestBuilder<Void> + */ + open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> { + let path = "/fake/body-with-query-params" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "query": query.encodeToJSON() + ]) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + To test \"client\" model + + - parameter body: (body) client model + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + To test \"client\" model + - PATCH /fake + - To test \"client\" model + - parameter body: (body) client model + - returns: RequestBuilder<Client> + */ + open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - POST /fake + - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - BASIC: + - type: http + - name: http_basic_test + - parameter number: (form) None + - parameter double: (form) None + - parameter patternWithoutDelimiter: (form) None + - parameter byte: (form) None + - parameter integer: (form) None (optional) + - parameter int32: (form) None (optional) + - parameter int64: (form) None (optional) + - parameter float: (form) None (optional) + - parameter string: (form) None (optional) + - parameter binary: (form) None (optional) + - parameter date: (form) None (optional) + - parameter dateTime: (form) None (optional) + - parameter password: (form) None (optional) + - parameter callback: (form) None (optional) + - returns: RequestBuilder<Void> + */ + open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "integer": integer?.encodeToJSON(), + "int32": int32?.encodeToJSON(), + "int64": int64?.encodeToJSON(), + "number": number.encodeToJSON(), + "float": float?.encodeToJSON(), + "double": double.encodeToJSON(), + "string": string?.encodeToJSON(), + "pattern_without_delimiter": patternWithoutDelimiter.encodeToJSON(), + "byte": byte.encodeToJSON(), + "binary": binary?.encodeToJSON(), + "date": date?.encodeToJSON(), + "dateTime": dateTime?.encodeToJSON(), + "password": password?.encodeToJSON(), + "callback": callback?.encodeToJSON() + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + * enum for parameter enumHeaderStringArray + */ + public enum EnumHeaderStringArray_testEnumParameters: String, CaseIterable { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumHeaderString + */ + public enum EnumHeaderString_testEnumParameters: String, CaseIterable { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + * enum for parameter enumQueryStringArray + */ + public enum EnumQueryStringArray_testEnumParameters: String, CaseIterable { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumQueryString + */ + public enum EnumQueryString_testEnumParameters: String, CaseIterable { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + * enum for parameter enumQueryInteger + */ + public enum EnumQueryInteger_testEnumParameters: Int, CaseIterable { + case _1 = 1 + case number2 = -2 + } + + /** + * enum for parameter enumQueryDouble + */ + public enum EnumQueryDouble_testEnumParameters: Double, CaseIterable { + case _11 = 1.1 + case number12 = -1.2 + } + + /** + * enum for parameter enumFormStringArray + */ + public enum EnumFormStringArray_testEnumParameters: String, CaseIterable { + case greaterThan = ">" + case dollar = "$" + } + + /** + * enum for parameter enumFormString + */ + public enum EnumFormString_testEnumParameters: String, CaseIterable { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" + } + + /** + To test enum parameters + + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + To test enum parameters + - GET /fake + - To test enum parameters + - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) + - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to .efg) + - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) + - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to .efg) + - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) + - parameter enumQueryDouble: (query) Query parameter enum test (double) (optional) + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .dollar) + - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg) + - returns: RequestBuilder<Void> + */ + open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "enum_form_string_array": enumFormStringArray?.encodeToJSON(), + "enum_form_string": enumFormString?.encodeToJSON() + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_double": enumQueryDouble?.encodeToJSON() + ]) + let nillableHeaders: [String: Any?] = [ + "enum_header_string_array": enumHeaderStringArray?.encodeToJSON(), + "enum_header_string": enumHeaderString?.encodeToJSON() + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + Fake endpoint to test group parameters (optional) + + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Fake endpoint to test group parameters (optional) + - DELETE /fake + - Fake endpoint to test group parameters (optional) + - parameter requiredStringGroup: (query) Required String in group parameters + - parameter requiredBooleanGroup: (header) Required Boolean in group parameters + - parameter requiredInt64Group: (query) Required Integer in group parameters + - parameter stringGroup: (query) String in group parameters (optional) + - parameter booleanGroup: (header) Boolean in group parameters (optional) + - parameter int64Group: (query) Integer in group parameters (optional) + - returns: RequestBuilder<Void> + */ + open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { + let path = "/fake" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), + "int64_group": int64Group?.encodeToJSON() + ]) + let nillableHeaders: [String: Any?] = [ + "required_boolean_group": requiredBooleanGroup.encodeToJSON(), + "boolean_group": booleanGroup?.encodeToJSON() + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + test inline additionalProperties + + - parameter param: (body) request body + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + test inline additionalProperties + - POST /fake/inline-additionalProperties + - parameter param: (body) request body + - returns: RequestBuilder<Void> + */ + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { + let path = "/fake/inline-additionalProperties" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + test json serialization of form data + + - parameter param: (form) field1 + - parameter param2: (form) field2 + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + test json serialization of form data + - GET /fake/jsonFormData + - parameter param: (form) field1 + - parameter param2: (form) field2 + - returns: RequestBuilder<Void> + */ + open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { + let path = "/fake/jsonFormData" + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "param": param.encodeToJSON(), + "param2": param2.encodeToJSON() + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift new file mode 100644 index 000000000000..48cfe7187b9a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -0,0 +1,51 @@ +// +// FakeClassnameTags123API.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class FakeClassnameTags123API { + /** + To test class name in snake case + + - parameter body: (body) client model + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { + testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + To test class name in snake case + - PATCH /fake_classname_test + - To test class name in snake case + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query + - parameter body: (body) client model + - returns: RequestBuilder<Client> + */ + open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> { + let path = "/fake_classname_test" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift new file mode 100644 index 000000000000..0552d4a6c16e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -0,0 +1,431 @@ +// +// PetAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class PetAPI { + /** + Add a new pet to the store + + - parameter body: (body) Pet object that needs to be added to the store + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Add a new pet to the store + - POST /pet + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter body: (body) Pet object that needs to be added to the store + - returns: RequestBuilder<Void> + */ + open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> { + let path = "/pet" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Deletes a pet + + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Deletes a pet + - DELETE /pet/{petId} + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) Pet id to delete + - parameter apiKey: (header) (optional) + - returns: RequestBuilder<Void> + */ + open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + let nillableHeaders: [String: Any?] = [ + "api_key": apiKey?.encodeToJSON() + ] + let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) + } + + /** + * enum for parameter status + */ + public enum Status_findPetsByStatus: String, CaseIterable { + case available = "available" + case pending = "pending" + case sold = "sold" + } + + /** + Finds Pets by status + + - parameter status: (query) Status values that need to be considered for filter + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Finds Pets by status + - GET /pet/findByStatus + - Multiple status values can be provided with comma separated strings + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter status: (query) Status values that need to be considered for filter + - returns: RequestBuilder<[Pet]> + */ + open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { + let path = "/pet/findByStatus" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "status": status.encodeToJSON() + ]) + + let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Finds Pets by tags + + - parameter tags: (query) Tags to filter by + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { + findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Finds Pets by tags + - GET /pet/findByTags + - Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter tags: (query) Tags to filter by + - returns: RequestBuilder<[Pet]> + */ + open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { + let path = "/pet/findByTags" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "tags": tags.encodeToJSON() + ]) + + let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Find pet by ID + + - parameter petId: (path) ID of pet to return + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { + getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Find pet by ID + - GET /pet/{petId} + - Returns a single pet + - API Key: + - type: apiKey api_key + - name: api_key + - parameter petId: (path) ID of pet to return + - returns: RequestBuilder<Pet> + */ + open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Update an existing pet + + - parameter body: (body) Pet object that needs to be added to the store + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Update an existing pet + - PUT /pet + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter body: (body) Pet object that needs to be added to the store + - returns: RequestBuilder<Void> + */ + open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> { + let path = "/pet" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Updates a pet in the store with form data + + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Updates a pet in the store with form data + - POST /pet/{petId} + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet that needs to be updated + - parameter name: (form) Updated name of the pet (optional) + - parameter status: (form) Updated status of the pet (optional) + - returns: RequestBuilder<Void> + */ + open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> { + var path = "/pet/{petId}" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "name": name?.encodeToJSON(), + "status": status?.encodeToJSON() + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + uploads an image + + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + uploads an image + - POST /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter file: (form) file to upload (optional) + - returns: RequestBuilder<ApiResponse> + */ + open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> { + var path = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "file": file?.encodeToJSON() + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + uploads an image (required) + + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { + uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + uploads an image (required) + - POST /fake/{petId}/uploadImageWithRequiredFile + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter requiredFile: (form) file to upload + - parameter additionalMetadata: (form) Additional data to pass to server (optional) + - returns: RequestBuilder<ApiResponse> + */ + open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> { + var path = "/fake/{petId}/uploadImageWithRequiredFile" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let formParams: [String: Any?] = [ + "additionalMetadata": additionalMetadata?.encodeToJSON(), + "requiredFile": requiredFile.encodeToJSON() + ] + + let nonNullParameters = APIHelper.rejectNil(formParams) + let parameters = APIHelper.convertBoolToString(nonNullParameters) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift new file mode 100644 index 000000000000..a8a83eda39a4 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -0,0 +1,165 @@ +// +// StoreAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class StoreAPI { + /** + Delete purchase order by ID + + - parameter orderId: (path) ID of the order that needs to be deleted + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Delete purchase order by ID + - DELETE /store/order/{order_id} + - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + - parameter orderId: (path) ID of the order that needs to be deleted + - returns: RequestBuilder<Void> + */ + open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> { + var path = "/store/order/{order_id}" + let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" + let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Returns pet inventories by status + + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { + getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Returns pet inventories by status + - GET /store/inventory + - Returns a map of status codes to quantities + - API Key: + - type: apiKey api_key + - name: api_key + - returns: RequestBuilder<[String:Int]> + */ + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { + let path = "/store/inventory" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Find purchase order by ID + + - parameter orderId: (path) ID of pet that needs to be fetched + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Find purchase order by ID + - GET /store/order/{order_id} + - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + - parameter orderId: (path) ID of pet that needs to be fetched + - returns: RequestBuilder<Order> + */ + open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> { + var path = "/store/order/{order_id}" + let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))" + let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Place an order for a pet + + - parameter body: (body) order placed for purchasing the pet + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { + placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Place an order for a pet + - POST /store/order + - parameter body: (body) order placed for purchasing the pet + - returns: RequestBuilder<Order> + */ + open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> { + let path = "/store/order" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift new file mode 100644 index 000000000000..505ed1b0c5c9 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -0,0 +1,318 @@ +// +// UserAPI.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class UserAPI { + /** + Create user + + - parameter body: (body) Created user object + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Create user + - POST /user + - This can only be done by the logged in user. + - parameter body: (body) Created user object + - returns: RequestBuilder<Void> + */ + open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> { + let path = "/user" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Creates list of users with given input array + - POST /user/createWithArray + - parameter body: (body) List of user object + - returns: RequestBuilder<Void> + */ + open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> { + let path = "/user/createWithArray" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Creates list of users with given input array + + - parameter body: (body) List of user object + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Creates list of users with given input array + - POST /user/createWithList + - parameter body: (body) List of user object + - returns: RequestBuilder<Void> + */ + open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> { + let path = "/user/createWithList" + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + Delete user + + - parameter username: (path) The name that needs to be deleted + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Delete user + - DELETE /user/{username} + - This can only be done by the logged in user. + - parameter username: (path) The name that needs to be deleted + - returns: RequestBuilder<Void> + */ + open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Get user by user name + + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { + getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Get user by user name + - GET /user/{username} + - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + - returns: RequestBuilder<User> + */ + open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Logs user into the system + + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { + loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Logs user into the system + - GET /user/login + - responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)] + - parameter username: (query) The user name for login + - parameter password: (query) The password for login in clear text + - returns: RequestBuilder<String> + */ + open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { + let path = "/user/login" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + var url = URLComponents(string: URLString) + url?.queryItems = APIHelper.mapValuesToQueryItems([ + "username": username.encodeToJSON(), + "password": password.encodeToJSON() + ]) + + let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Logs out current logged in user session + + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Logs out current logged in user session + - GET /user/logout + - returns: RequestBuilder<Void> + */ + open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { + let path = "/user/logout" + let URLString = PetstoreClientAPI.basePath + path + let parameters: [String: Any]? = nil + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) + } + + /** + Updated user + + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in + switch result { + case .success: + completion((), nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + Updated user + - PUT /user/{username} + - This can only be done by the logged in user. + - parameter username: (path) name that need to be deleted + - parameter body: (body) Updated user object + - returns: RequestBuilder<Void> + */ + open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> { + var path = "/user/{username}" + let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))" + let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) + let URLString = PetstoreClientAPI.basePath + path + let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body) + + let url = URLComponents(string: URLString) + + let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() + + return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift new file mode 100644 index 000000000000..ef971ebadc60 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -0,0 +1,48 @@ +// +// CodableHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class CodableHelper { + + private static var customDateFormatter: DateFormatter? + private static var defaultDateFormatter: DateFormatter = OpenISO8601DateFormatter() + private static var customJSONDecoder: JSONDecoder? + private static var defaultJSONDecoder: JSONDecoder = { + let decoder = JSONDecoder() + decoder.dateDecodingStrategy = .formatted(CodableHelper.dateFormatter) + return decoder + }() + private static var customJSONEncoder: JSONEncoder? + private static var defaultJSONEncoder: JSONEncoder = { + let encoder = JSONEncoder() + encoder.dateEncodingStrategy = .formatted(CodableHelper.dateFormatter) + encoder.outputFormatting = .prettyPrinted + return encoder + }() + + public static var dateFormatter: DateFormatter { + get { return self.customDateFormatter ?? self.defaultDateFormatter } + set { self.customDateFormatter = newValue } + } + public static var jsonDecoder: JSONDecoder { + get { return self.customJSONDecoder ?? self.defaultJSONDecoder } + set { self.customJSONDecoder = newValue } + } + public static var jsonEncoder: JSONEncoder { + get { return self.customJSONEncoder ?? self.defaultJSONEncoder } + set { self.customJSONEncoder = newValue } + } + + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } + } + + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift new file mode 100644 index 000000000000..627d9adb757e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -0,0 +1,16 @@ +// Configuration.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class Configuration { + + // This value is used to configure the date formatter that is used to serialize dates into JSON format. + // You must set it prior to encoding any dates, and it will only be read once. + @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") + public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift new file mode 100644 index 000000000000..93ed6b90b376 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -0,0 +1,179 @@ +// Extensions.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +extension Bool: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Float: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension Int32: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } +} + +extension Int64: JSONEncodable { + func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } +} + +extension Double: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension String: JSONEncodable { + func encodeToJSON() -> Any { return self as Any } +} + +extension RawRepresentable where RawValue: JSONEncodable { + func encodeToJSON() -> Any { return self.rawValue as Any } +} + +private func encodeIfPossible<T>(_ object: T) -> Any { + if let encodableObject = object as? JSONEncodable { + return encodableObject.encodeToJSON() + } else { + return object as Any + } +} + +extension Array: JSONEncodable { + func encodeToJSON() -> Any { + return self.map(encodeIfPossible) + } +} + +extension Dictionary: JSONEncodable { + func encodeToJSON() -> Any { + var dictionary = [AnyHashable: Any]() + for (key, value) in self { + dictionary[key] = encodeIfPossible(value) + } + return dictionary as Any + } +} + +extension Data: JSONEncodable { + func encodeToJSON() -> Any { + return self.base64EncodedString(options: Data.Base64EncodingOptions()) + } +} + +extension Date: JSONEncodable { + func encodeToJSON() -> Any { + return CodableHelper.dateFormatter.string(from: self) as Any + } +} + +extension URL: JSONEncodable { + func encodeToJSON() -> Any { + return self + } +} + +extension UUID: JSONEncodable { + func encodeToJSON() -> Any { + return self.uuidString + } +} + +extension String: CodingKey { + + public var stringValue: String { + return self + } + + public init?(stringValue: String) { + self.init(stringLiteral: stringValue) + } + + public var intValue: Int? { + return nil + } + + public init?(intValue: Int) { + return nil + } + +} + +extension KeyedEncodingContainerProtocol { + + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { + var arrayContainer = nestedUnkeyedContainer(forKey: key) + try arrayContainer.encode(contentsOf: values) + } + + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { + if let values = values { + try encodeArray(values, forKey: key) + } + } + + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { + for (key, value) in pairs { + try encode(value, forKey: key) + } + } + + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { + if let pairs = pairs { + try encodeMap(pairs) + } + } + +} + +extension KeyedDecodingContainerProtocol { + + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { + var tmpArray = [T]() + + var nestedContainer = try nestedUnkeyedContainer(forKey: key) + while !nestedContainer.isAtEnd { + let arrayValue = try nestedContainer.decode(T.self) + tmpArray.append(arrayValue) + } + + return tmpArray + } + + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? + + if contains(key) { + tmpArray = try decodeArray(T.self, forKey: key) + } + + return tmpArray + } + + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] + + for key in allKeys { + if !excludedKeys.contains(key) { + let value = try decode(T.self, forKey: key) + map[key] = value + } + } + + return map + } + +} + +extension HTTPURLResponse { + var isStatusCodeSuccessful: Bool { + return Array(200 ..< 300).contains(statusCode) + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift new file mode 100644 index 000000000000..b79e9f5e64d5 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -0,0 +1,53 @@ +// +// JSONDataEncoding.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct JSONDataEncoding { + + // MARK: Properties + + private static let jsonDataKey = "jsonData" + + // MARK: Encoding + + /// Creates a URL request by encoding parameters and applying them onto an existing request. + /// + /// - parameter urlRequest: The request to have parameters applied. + /// - parameter parameters: The parameters to apply. This should have a single key/value + /// pair with "jsonData" as the key and a Data object as the value. + /// + /// - throws: An `Error` if the encoding process encounters an error. + /// + /// - returns: The encoded request. + public func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) -> URLRequest { + var urlRequest = urlRequest + + guard let jsonData = parameters?[JSONDataEncoding.jsonDataKey] as? Data, !jsonData.isEmpty else { + return urlRequest + } + + if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { + urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + urlRequest.httpBody = jsonData + + return urlRequest + } + + public static func encodingParameters(jsonData: Data?) -> [String: Any]? { + var returnedParams: [String: Any]? + if let jsonData = jsonData, !jsonData.isEmpty { + var params: [String: Any] = [:] + params[jsonDataKey] = jsonData + returnedParams = params + } + return returnedParams + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift new file mode 100644 index 000000000000..02f78ffb4705 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -0,0 +1,45 @@ +// +// JSONEncodingHelper.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +open class JSONEncodingHelper { + + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? + + // Encode the Encodable object + if let encodableObj = encodableObj { + let encodeResult = CodableHelper.encode(encodableObj) + do { + let data = try encodeResult.get() + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error.localizedDescription) + } + } + + return params + } + + open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { + var params: [String: Any]? + + if let encodableObj = encodableObj { + do { + let data = try JSONSerialization.data(withJSONObject: encodableObj, options: .prettyPrinted) + params = JSONDataEncoding.encodingParameters(jsonData: data) + } catch { + print(error.localizedDescription) + return nil + } + } + + return params + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift new file mode 100644 index 000000000000..b0bfb1159760 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -0,0 +1,54 @@ +// Models.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +protocol JSONEncodable { + func encodeToJSON() -> Any +} + +public enum ErrorResponse: Error { + case error(Int, Data?, Error) +} + +public enum DownloadException: Error { + case responseDataMissing + case responseFailed + case requestMissing + case requestMissingPath + case requestMissingURL +} + +public enum DecodableRequestBuilderError: Error { + case emptyDataResponse + case nilHTTPResponse + case unsuccessfulHTTPStatusCode + case jsonDecoding(DecodingError) + case generalError(Error) +} + +open class Response<T> { + public let statusCode: Int + public let header: [String: String] + public let body: T? + + public init(statusCode: Int, header: [String: String], body: T?) { + self.statusCode = statusCode + self.header = header + self.body = body + } + + public convenience init(response: HTTPURLResponse, body: T?) { + let rawHeader = response.allHeaderFields + var header = [String: String]() + for (key, value) in rawHeader { + if let key = key as? String, let value = value as? String { + header[key] = value + } + } + self.init(statusCode: response.statusCode, header: header, body: body) + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift new file mode 100644 index 000000000000..3fda7052a7d3 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -0,0 +1,25 @@ +// +// AdditionalPropertiesClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct AdditionalPropertiesClass: Codable { + + public private(set) var mapString: [String: String]? + public private(set) var mapMapString: [String: [String: String]]? + + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { + self.mapString = mapString + self.mapMapString = mapMapString + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case mapString = "map_string" + case mapMapString = "map_map_string" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift new file mode 100644 index 000000000000..af59c2a9ef62 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -0,0 +1,20 @@ +// +// Animal.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Animal: Codable { + + public private(set) var className: String + public private(set) var color: String? = "red" + + public init(className: String, color: String?) { + self.className = className + self.color = color + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift new file mode 100644 index 000000000000..e09b0e9efdc8 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -0,0 +1,10 @@ +// +// AnimalFarm.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift new file mode 100644 index 000000000000..a89768595cc5 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -0,0 +1,22 @@ +// +// ApiResponse.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ApiResponse: Codable { + + public private(set) var code: Int? + public private(set) var type: String? + public private(set) var message: String? + + public init(code: Int?, type: String?, message: String?) { + self.code = code + self.type = type + self.message = message + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift new file mode 100644 index 000000000000..a2593b7c1a39 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -0,0 +1,22 @@ +// +// ArrayOfArrayOfNumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ArrayOfArrayOfNumberOnly: Codable { + + public private(set) var arrayArrayNumber: [[Double]]? + + public init(arrayArrayNumber: [[Double]]?) { + self.arrayArrayNumber = arrayArrayNumber + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case arrayArrayNumber = "ArrayArrayNumber" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift new file mode 100644 index 000000000000..c5edf1100537 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -0,0 +1,22 @@ +// +// ArrayOfNumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ArrayOfNumberOnly: Codable { + + public private(set) var arrayNumber: [Double]? + + public init(arrayNumber: [Double]?) { + self.arrayNumber = arrayNumber + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case arrayNumber = "ArrayNumber" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift new file mode 100644 index 000000000000..8ad39b8c09fc --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -0,0 +1,28 @@ +// +// ArrayTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ArrayTest: Codable { + + public private(set) var arrayOfString: [String]? + public private(set) var arrayArrayOfInteger: [[Int64]]? + public private(set) var arrayArrayOfModel: [[ReadOnlyFirst]]? + + public init(arrayOfString: [String]?, arrayArrayOfInteger: [[Int64]]?, arrayArrayOfModel: [[ReadOnlyFirst]]?) { + self.arrayOfString = arrayOfString + self.arrayArrayOfInteger = arrayArrayOfInteger + self.arrayArrayOfModel = arrayArrayOfModel + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case arrayOfString = "array_of_string" + case arrayArrayOfInteger = "array_array_of_integer" + case arrayArrayOfModel = "array_array_of_model" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift new file mode 100644 index 000000000000..eb3d6777e52b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -0,0 +1,38 @@ +// +// Capitalization.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Capitalization: Codable { + + public private(set) var smallCamel: String? + public private(set) var capitalCamel: String? + public private(set) var smallSnake: String? + public private(set) var capitalSnake: String? + public private(set) var sCAETHFlowPoints: String? + /** Name of the pet */ + public private(set) var ATT_NAME: String? + + public init(smallCamel: String?, capitalCamel: String?, smallSnake: String?, capitalSnake: String?, sCAETHFlowPoints: String?, ATT_NAME: String?) { + self.smallCamel = smallCamel + self.capitalCamel = capitalCamel + self.smallSnake = smallSnake + self.capitalSnake = capitalSnake + self.sCAETHFlowPoints = sCAETHFlowPoints + self.ATT_NAME = ATT_NAME + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case smallCamel + case capitalCamel = "CapitalCamel" + case smallSnake = "small_Snake" + case capitalSnake = "Capital_Snake" + case sCAETHFlowPoints = "SCA_ETH_Flow_Points" + case ATT_NAME + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift new file mode 100644 index 000000000000..2978b016f98e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -0,0 +1,22 @@ +// +// Cat.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Cat: Codable { + + public private(set) var className: String + public private(set) var color: String? = "red" + public private(set) var declawed: Bool? + + public init(className: String, color: String?, declawed: Bool?) { + self.className = className + self.color = color + self.declawed = declawed + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift new file mode 100644 index 000000000000..4ab80fbcd99e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -0,0 +1,18 @@ +// +// CatAllOf.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct CatAllOf: Codable { + + public private(set) var declawed: Bool? + + public init(declawed: Bool?) { + self.declawed = declawed + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift new file mode 100644 index 000000000000..3482703a6b41 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -0,0 +1,20 @@ +// +// Category.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Category: Codable { + + public private(set) var id: Int64? + public private(set) var name: String = "default-name" + + public init(id: Int64?, name: String) { + self.id = id + self.name = name + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift new file mode 100644 index 000000000000..319d88a70f7a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -0,0 +1,19 @@ +// +// ClassModel.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model with \"_class\" property */ +public struct ClassModel: Codable { + + public private(set) var _class: String? + + public init(_class: String?) { + self._class = _class + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift new file mode 100644 index 000000000000..5dd8cc3062dd --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -0,0 +1,18 @@ +// +// Client.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Client: Codable { + + public private(set) var client: String? + + public init(client: String?) { + self.client = client + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift new file mode 100644 index 000000000000..16ab196b8724 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -0,0 +1,22 @@ +// +// Dog.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Dog: Codable { + + public private(set) var className: String + public private(set) var color: String? = "red" + public private(set) var breed: String? + + public init(className: String, color: String?, breed: String?) { + self.className = className + self.color = color + self.breed = breed + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift new file mode 100644 index 000000000000..d8a838725cbf --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -0,0 +1,18 @@ +// +// DogAllOf.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct DogAllOf: Codable { + + public private(set) var breed: String? + + public init(breed: String?) { + self.breed = breed + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift new file mode 100644 index 000000000000..d9ce69e9fc86 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -0,0 +1,33 @@ +// +// EnumArrays.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct EnumArrays: Codable { + + public enum JustSymbol: String, Codable, CaseIterable { + case greaterThanOrEqualTo = ">=" + case dollar = "$" + } + public enum ArrayEnum: String, Codable, CaseIterable { + case fish = "fish" + case crab = "crab" + } + public private(set) var justSymbol: JustSymbol? + public private(set) var arrayEnum: [ArrayEnum]? + + public init(justSymbol: JustSymbol?, arrayEnum: [ArrayEnum]?) { + self.justSymbol = justSymbol + self.arrayEnum = arrayEnum + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case justSymbol = "just_symbol" + case arrayEnum = "array_enum" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift new file mode 100644 index 000000000000..d4029d73f8af --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -0,0 +1,14 @@ +// +// EnumClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public enum EnumClass: String, Codable, CaseIterable { + case abc = "_abc" + case efg = "-efg" + case xyz = "(xyz)" +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift new file mode 100644 index 000000000000..2b114d422d1b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -0,0 +1,52 @@ +// +// EnumTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct EnumTest: Codable { + + public enum EnumString: String, Codable, CaseIterable { + case upper = "UPPER" + case lower = "lower" + case empty = "" + } + public enum EnumStringRequired: String, Codable, CaseIterable { + case upper = "UPPER" + case lower = "lower" + case empty = "" + } + public enum EnumInteger: Int, Codable, CaseIterable { + case _1 = 1 + case number1 = -1 + } + public enum EnumNumber: Double, Codable, CaseIterable { + case _11 = 1.1 + case number12 = -1.2 + } + public private(set) var enumString: EnumString? + public private(set) var enumStringRequired: EnumStringRequired + public private(set) var enumInteger: EnumInteger? + public private(set) var enumNumber: EnumNumber? + public private(set) var outerEnum: OuterEnum? + + public init(enumString: EnumString?, enumStringRequired: EnumStringRequired, enumInteger: EnumInteger?, enumNumber: EnumNumber?, outerEnum: OuterEnum?) { + self.enumString = enumString + self.enumStringRequired = enumStringRequired + self.enumInteger = enumInteger + self.enumNumber = enumNumber + self.outerEnum = outerEnum + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case enumString = "enum_string" + case enumStringRequired = "enum_string_required" + case enumInteger = "enum_integer" + case enumNumber = "enum_number" + case outerEnum + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift new file mode 100644 index 000000000000..eeab58194415 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -0,0 +1,20 @@ +// +// File.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Must be named `File` for test. */ +public struct File: Codable { + + /** Test capitalization */ + public private(set) var sourceURI: String? + + public init(sourceURI: String?) { + self.sourceURI = sourceURI + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift new file mode 100644 index 000000000000..94574ca9955b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -0,0 +1,20 @@ +// +// FileSchemaTestClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct FileSchemaTestClass: Codable { + + public private(set) var file: File? + public private(set) var files: [File]? + + public init(file: File?, files: [File]?) { + self.file = file + self.files = files + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift new file mode 100644 index 000000000000..57bbd464b510 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -0,0 +1,42 @@ +// +// FormatTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct FormatTest: Codable { + + public private(set) var integer: Int? + public private(set) var int32: Int? + public private(set) var int64: Int64? + public private(set) var number: Double + public private(set) var float: Float? + public private(set) var double: Double? + public private(set) var string: String? + public private(set) var byte: Data + public private(set) var binary: URL? + public private(set) var date: Date + public private(set) var dateTime: Date? + public private(set) var uuid: UUID? + public private(set) var password: String + + public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: URL?, date: Date, dateTime: Date?, uuid: UUID?, password: String) { + self.integer = integer + self.int32 = int32 + self.int64 = int64 + self.number = number + self.float = float + self.double = double + self.string = string + self.byte = byte + self.binary = binary + self.date = date + self.dateTime = dateTime + self.uuid = uuid + self.password = password + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift new file mode 100644 index 000000000000..4de261f092d2 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -0,0 +1,20 @@ +// +// HasOnlyReadOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct HasOnlyReadOnly: Codable { + + public private(set) var bar: String? + public private(set) var foo: String? + + public init(bar: String?, foo: String?) { + self.bar = bar + self.foo = foo + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift new file mode 100644 index 000000000000..135160ff8de2 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -0,0 +1,22 @@ +// +// List.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct List: Codable { + + public private(set) var _123list: String? + + public init(_123list: String?) { + self._123list = _123list + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case _123list = "123-list" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift new file mode 100644 index 000000000000..ebd9dd5b5bc7 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -0,0 +1,35 @@ +// +// MapTest.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct MapTest: Codable { + + public enum MapOfEnumString: String, Codable, CaseIterable { + case upper = "UPPER" + case lower = "lower" + } + public private(set) var mapMapOfString: [String: [String: String]]? + public private(set) var mapOfEnumString: [String: String]? + public private(set) var directMap: [String: Bool]? + public private(set) var indirectMap: StringBooleanMap? + + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { + self.mapMapOfString = mapMapOfString + self.mapOfEnumString = mapOfEnumString + self.directMap = directMap + self.indirectMap = indirectMap + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case mapMapOfString = "map_map_of_string" + case mapOfEnumString = "map_of_enum_string" + case directMap = "direct_map" + case indirectMap = "indirect_map" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift new file mode 100644 index 000000000000..dc1ee0461be7 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -0,0 +1,22 @@ +// +// MixedPropertiesAndAdditionalPropertiesClass.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { + + public private(set) var uuid: UUID? + public private(set) var dateTime: Date? + public private(set) var map: [String: Animal]? + + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { + self.uuid = uuid + self.dateTime = dateTime + self.map = map + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift new file mode 100644 index 000000000000..a0f7127ef65c --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -0,0 +1,26 @@ +// +// Model200Response.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model name starting with number */ +public struct Model200Response: Codable { + + public private(set) var name: Int? + public private(set) var _class: String? + + public init(name: Int?, _class: String?) { + self.name = name + self._class = _class + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case name + case _class = "class" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift new file mode 100644 index 000000000000..ee70b1f6ee9b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -0,0 +1,32 @@ +// +// Name.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing model name same as property name */ +public struct Name: Codable { + + public private(set) var name: Int + public private(set) var snakeCase: Int? + public private(set) var property: String? + public private(set) var _123number: Int? + + public init(name: Int, snakeCase: Int?, property: String?, _123number: Int?) { + self.name = name + self.snakeCase = snakeCase + self.property = property + self._123number = _123number + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case name + case snakeCase = "snake_case" + case property + case _123number = "123Number" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift new file mode 100644 index 000000000000..007dfab800ce --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -0,0 +1,22 @@ +// +// NumberOnly.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct NumberOnly: Codable { + + public private(set) var justNumber: Double? + + public init(justNumber: Double?) { + self.justNumber = justNumber + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case justNumber = "JustNumber" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift new file mode 100644 index 000000000000..41a1d7d664e7 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -0,0 +1,34 @@ +// +// Order.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Order: Codable { + + public enum Status: String, Codable, CaseIterable { + case placed = "placed" + case approved = "approved" + case delivered = "delivered" + } + public private(set) var id: Int64? + public private(set) var petId: Int64? + public private(set) var quantity: Int? + public private(set) var shipDate: Date? + /** Order Status */ + public private(set) var status: Status? + public private(set) var complete: Bool? = false + + public init(id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) { + self.id = id + self.petId = petId + self.quantity = quantity + self.shipDate = shipDate + self.status = status + self.complete = complete + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift new file mode 100644 index 000000000000..df6d2512d6e4 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -0,0 +1,28 @@ +// +// OuterComposite.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct OuterComposite: Codable { + + public private(set) var myNumber: Double? + public private(set) var myString: String? + public private(set) var myBoolean: Bool? + + public init(myNumber: Double?, myString: String?, myBoolean: Bool?) { + self.myNumber = myNumber + self.myString = myString + self.myBoolean = myBoolean + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case myNumber = "my_number" + case myString = "my_string" + case myBoolean = "my_boolean" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift new file mode 100644 index 000000000000..c3b778cbbed4 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -0,0 +1,14 @@ +// +// OuterEnum.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public enum OuterEnum: String, Codable, CaseIterable { + case placed = "placed" + case approved = "approved" + case delivered = "delivered" +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift new file mode 100644 index 000000000000..7b99ef33751a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -0,0 +1,34 @@ +// +// Pet.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Pet: Codable { + + public enum Status: String, Codable, CaseIterable { + case available = "available" + case pending = "pending" + case sold = "sold" + } + public private(set) var id: Int64? + public private(set) var category: Category? + public private(set) var name: String + public private(set) var photoUrls: [String] + public private(set) var tags: [Tag]? + /** pet status in the store */ + public private(set) var status: Status? + + public init(id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) { + self.id = id + self.category = category + self.name = name + self.photoUrls = photoUrls + self.tags = tags + self.status = status + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift new file mode 100644 index 000000000000..30cd4837cc78 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -0,0 +1,20 @@ +// +// ReadOnlyFirst.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct ReadOnlyFirst: Codable { + + public private(set) var bar: String? + public private(set) var baz: String? + + public init(bar: String?, baz: String?) { + self.bar = bar + self.baz = baz + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift new file mode 100644 index 000000000000..b28b6e99d777 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -0,0 +1,23 @@ +// +// Return.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +/** Model for testing reserved words */ +public struct Return: Codable { + + public private(set) var _return: Int? + + public init(_return: Int?) { + self._return = _return + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case _return = "return" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift new file mode 100644 index 000000000000..266833a0dbc6 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -0,0 +1,22 @@ +// +// SpecialModelName.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct SpecialModelName: Codable { + + public private(set) var specialPropertyName: Int64? + + public init(specialPropertyName: Int64?) { + self.specialPropertyName = specialPropertyName + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case specialPropertyName = "$special[property.name]" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift new file mode 100644 index 000000000000..dbd5afe27091 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -0,0 +1,45 @@ +// +// StringBooleanMap.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct StringBooleanMap: Codable { + + public private(set) var additionalProperties: [String: Bool] = [:] + + public subscript(key: String) -> Bool? { + get { + if let value = additionalProperties[key] { + return value + } + return nil + } + + set { + additionalProperties[key] = newValue + } + } + + // Encodable protocol methods + + public func encode(to encoder: Encoder) throws { + + var container = encoder.container(keyedBy: String.self) + + try container.encodeMap(additionalProperties) + } + + // Decodable protocol methods + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: String.self) + + var nonAdditionalPropertyKeys = Set<String>() + additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift new file mode 100644 index 000000000000..f827ccf107ad --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -0,0 +1,20 @@ +// +// Tag.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct Tag: Codable { + + public private(set) var id: Int64? + public private(set) var name: String? + + public init(id: Int64?, name: String?) { + self.id = id + self.name = name + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 000000000000..ed3641fdb2fc --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -0,0 +1,34 @@ +// +// TypeHolderDefault.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct TypeHolderDefault: Codable { + + public private(set) var stringItem: String = "what" + public private(set) var numberItem: Double + public private(set) var integerItem: Int + public private(set) var boolItem: Bool = true + public private(set) var arrayItem: [Int] + + public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) { + self.stringItem = stringItem + self.numberItem = numberItem + self.integerItem = integerItem + self.boolItem = boolItem + self.arrayItem = arrayItem + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case stringItem = "string_item" + case numberItem = "number_item" + case integerItem = "integer_item" + case boolItem = "bool_item" + case arrayItem = "array_item" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 000000000000..4985005bdaf1 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -0,0 +1,34 @@ +// +// TypeHolderExample.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct TypeHolderExample: Codable { + + public private(set) var stringItem: String + public private(set) var numberItem: Double + public private(set) var integerItem: Int + public private(set) var boolItem: Bool + public private(set) var arrayItem: [Int] + + public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) { + self.stringItem = stringItem + self.numberItem = numberItem + self.integerItem = integerItem + self.boolItem = boolItem + self.arrayItem = arrayItem + } + + public enum CodingKeys: String, CodingKey, CaseIterable { + case stringItem = "string_item" + case numberItem = "number_item" + case integerItem = "integer_item" + case boolItem = "bool_item" + case arrayItem = "array_item" + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift new file mode 100644 index 000000000000..9fba7de81820 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -0,0 +1,33 @@ +// +// User.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +public struct User: Codable { + + public private(set) var id: Int64? + public private(set) var username: String? + public private(set) var firstName: String? + public private(set) var lastName: String? + public private(set) var email: String? + public private(set) var password: String? + public private(set) var phone: String? + /** User Status */ + public private(set) var userStatus: Int? + + public init(id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) { + self.id = id + self.username = username + self.firstName = firstName + self.lastName = lastName + self.email = email + self.password = password + self.phone = phone + self.userStatus = userStatus + } + +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift new file mode 100644 index 000000000000..e06208074cd9 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/OpenISO8601DateFormatter.swift @@ -0,0 +1,44 @@ +// +// OpenISO8601DateFormatter.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +// https://stackoverflow.com/a/50281094/976628 +public class OpenISO8601DateFormatter: DateFormatter { + static let withoutSeconds: DateFormatter = { + let formatter = DateFormatter() + formatter.calendar = Calendar(identifier: .iso8601) + formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.timeZone = TimeZone(secondsFromGMT: 0) + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" + return formatter + }() + + private func setup() { + calendar = Calendar(identifier: .iso8601) + locale = Locale(identifier: "en_US_POSIX") + timeZone = TimeZone(secondsFromGMT: 0) + dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" + } + + override init() { + super.init() + setup() + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setup() + } + + override public func date(from string: String) -> Date? { + if let result = super.date(from: string) { + return result + } + return OpenISO8601DateFormatter.withoutSeconds.date(from: string) + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift new file mode 100644 index 000000000000..acf7ff4031bd --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/SynchronizedDictionary.swift @@ -0,0 +1,36 @@ +// SynchronizedDictionary.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation + +internal struct SynchronizedDictionary<K: Hashable, V> { + + private var dictionary = [K: V]() + private let queue = DispatchQueue( + label: "SynchronizedDictionary", + qos: DispatchQoS.userInitiated, + attributes: [DispatchQueue.Attributes.concurrent], + autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit, + target: nil + ) + + internal subscript(key: K) -> V? { + get { + var value: V? + + queue.sync { + value = self.dictionary[key] + } + + return value + } + set { + queue.sync(flags: DispatchWorkItemFlags.barrier) { + self.dictionary[key] = newValue + } + } + } +} diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift new file mode 100644 index 000000000000..a31860adfdeb --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -0,0 +1,577 @@ +// URLSessionImplementations.swift +// +// Generated by openapi-generator +// https://openapi-generator.tech +// + +import Foundation +#if !os(macOS) +import MobileCoreServices +#endif + +class URLSessionRequestBuilderFactory: RequestBuilderFactory { + func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type { + return URLSessionRequestBuilder<T>.self + } + + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { + return URLSessionDecodableRequestBuilder<T>.self + } +} + +// Store the URLSession to retain its reference +private var urlSessionStore = SynchronizedDictionary<String, URLSession>() + +open class URLSessionRequestBuilder<T>: RequestBuilder<T> { + + let progress = Progress() + + private var observation: NSKeyValueObservation? + + deinit { + observation?.invalidate() + } + + // swiftlint:disable:next weak_delegate + fileprivate let sessionDelegate = SessionDelegate() + + /** + May be assigned if you want to control the authentication challenges. + */ + public var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? + + /** + May be assigned if you want to do any of those things: + - control the task completion + - intercept and handle errors like authorization + - retry the request. + */ + public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { + super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) + } + + /** + May be overridden by a subclass if you want to control the URLSession + configuration. + */ + open func createURLSession() -> URLSession { + let configuration = URLSessionConfiguration.default + configuration.httpAdditionalHeaders = buildHeaders() + sessionDelegate.credential = credential + sessionDelegate.taskDidReceiveChallenge = taskDidReceiveChallenge + return URLSession(configuration: configuration, delegate: sessionDelegate, delegateQueue: nil) + } + + /** + May be overridden by a subclass if you want to control the Content-Type + that is given to an uploaded form part. + + Return nil to use the default behavior (inferring the Content-Type from + the file extension). Return the desired Content-Type otherwise. + */ + open func contentTypeForFormPart(fileURL: URL) -> String? { + return nil + } + + /** + May be overridden by a subclass if you want to control the URLRequest + configuration (e.g. to override the cache policy). + */ + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + + guard let url = URL(string: URLString) else { + throw DownloadException.requestMissingURL + } + + var originalRequest = URLRequest(url: url) + + originalRequest.httpMethod = method.rawValue + + buildHeaders().forEach { key, value in + originalRequest.setValue(value, forHTTPHeaderField: key) + } + + headers.forEach { key, value in + originalRequest.setValue(value, forHTTPHeaderField: key) + } + + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) + + return modifiedRequest + } + + override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { + let urlSessionId: String = UUID().uuidString + // Create a new manager for each request to customize its request header + let urlSession = createURLSession() + urlSessionStore[urlSessionId] = urlSession + + let parameters: [String: Any] = self.parameters ?? [:] + + let fileKeys = parameters.filter { $1 is URL } + .map { $0.0 } + + let encoding: ParameterEncoding + if fileKeys.count > 0 { + encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) + } else if isBody { + encoding = JSONDataEncoding() + } else { + encoding = URLEncoding() + } + + guard let xMethod = HTTPMethod(rawValue: method) else { + fatalError("Unsuported Http method - \(method)") + } + + let cleanupRequest = { + urlSessionStore[urlSessionId] = nil + self.observation?.invalidate() + } + + 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 } + + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { + + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in + + guard let self = self else { return } + + if shouldRetry { + cleanupRequest() + self.execute(apiResponseQueue, completion) + } else { + apiResponseQueue.async { + self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) + } + } + } + } else { + apiResponseQueue.async { + self.processRequestResponse(urlRequest: request, data: data, response: response, error: error, completion: completion) + } + } + } + + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { + observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in + self.progress.totalUnitCount = newProgress.totalUnitCount + self.progress.completedUnitCount = newProgress.completedUnitCount + } + + onProgressReady?(progress) + } + + dataTask.resume() + + } catch { + apiResponseQueue.async { + cleanupRequest() + completion(.failure(ErrorResponse.error(415, nil, error))) + } + } + + } + + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { + + if let error = error { + completion(.failure(ErrorResponse.error(-1, data, error))) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + completion(.failure(ErrorResponse.error(-2, data, DecodableRequestBuilderError.nilHTTPResponse))) + return + } + + guard httpResponse.isStatusCodeSuccessful else { + completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, DecodableRequestBuilderError.unsuccessfulHTTPStatusCode))) + return + } + + switch T.self { + case is String.Type: + + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" + + completion(.success(Response<T>(response: httpResponse, body: body as? T))) + + case is URL.Type: + do { + + guard error == nil else { + throw DownloadException.responseFailed + } + + guard let data = data else { + throw DownloadException.responseDataMissing + } + + let fileManager = FileManager.default + let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] + let requestURL = try self.getURL(from: urlRequest) + + var requestPath = try self.getPath(from: requestURL) + + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { + requestPath = requestPath.appending("/\(headerFileName)") + } + + let filePath = documentsDirectory.appendingPathComponent(requestPath) + let directoryPath = filePath.deletingLastPathComponent().path + + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) + try data.write(to: filePath, options: .atomic) + + completion(.success(Response(response: httpResponse, body: filePath as? T))) + + } catch let requestParserError as DownloadException { + completion(.failure(ErrorResponse.error(400, data, requestParserError))) + } catch let error { + completion(.failure(ErrorResponse.error(400, data, error))) + } + + case is Void.Type: + + completion(.success(Response(response: httpResponse, body: nil))) + + default: + + completion(.success(Response(response: httpResponse, body: data as? T))) + } + + } + + open func buildHeaders() -> [String: String] { + var httpHeaders = PetstoreClientAPI.customHeaders + for (key, value) in self.headers { + httpHeaders[key] = value + } + return httpHeaders + } + + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { + + guard let contentDisposition = contentDisposition else { + return nil + } + + let items = contentDisposition.components(separatedBy: ";") + + var filename: String? + + for contentItem in items { + + let filenameKey = "filename=" + guard let range = contentItem.range(of: filenameKey) else { + break + } + + filename = contentItem + return filename? + .replacingCharacters(in: range, with: "") + .replacingOccurrences(of: "\"", with: "") + .trimmingCharacters(in: .whitespacesAndNewlines) + } + + return filename + + } + + fileprivate func getPath(from url: URL) throws -> String { + + guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { + throw DownloadException.requestMissingPath + } + + if path.hasPrefix("/") { + path.remove(at: path.startIndex) + } + + return path + + } + + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + return url + } + +} + +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { + + if let error = error { + completion(.failure(ErrorResponse.error(-1, data, error))) + return + } + + guard let httpResponse = response as? HTTPURLResponse else { + completion(.failure(ErrorResponse.error(-2, data, DecodableRequestBuilderError.nilHTTPResponse))) + return + } + + guard httpResponse.isStatusCodeSuccessful else { + completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, DecodableRequestBuilderError.unsuccessfulHTTPStatusCode))) + return + } + + switch T.self { + case is String.Type: + + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" + + completion(.success(Response<T>(response: httpResponse, body: body as? T))) + + case is Void.Type: + + completion(.success(Response(response: httpResponse, body: nil))) + + case is Data.Type: + + completion(.success(Response(response: httpResponse, body: data as? T))) + + default: + + guard let data = data, !data.isEmpty else { + completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) + return + } + + let decodeResult = CodableHelper.decode(T.self, from: data) + + switch decodeResult { + case let .success(decodableObj): + completion(.success(Response(response: httpResponse, body: decodableObj))) + case let .failure(error): + completion(.failure(ErrorResponse.error(httpResponse.statusCode, data, error))) + } + } + } +} + +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + + var credential: URLCredential? + + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? + + func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { + + var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling + + var credential: URLCredential? + + if let taskDidReceiveChallenge = taskDidReceiveChallenge { + (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) + } else { + if challenge.previousFailureCount > 0 { + disposition = .rejectProtectionSpace + } else { + credential = self.credential ?? session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace) + + if credential != nil { + disposition = .useCredential + } + } + } + + completionHandler(disposition, credential) + } +} + +public enum HTTPMethod: String { + case options = "OPTIONS" + case get = "GET" + case head = "HEAD" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" + case trace = "TRACE" + case connect = "CONNECT" +} + +public protocol ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest +} + +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + + var urlRequest = urlRequest + + guard let parameters = parameters else { return urlRequest } + + guard let url = urlRequest.url else { + throw DownloadException.requestMissingURL + } + + if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { + urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) + urlRequest.url = urlComponents.url + } + + return urlRequest + } +} + +private class FileUploadEncoding: ParameterEncoding { + + let contentTypeForFormPart: (_ fileURL: URL) -> String? + + init(contentTypeForFormPart: @escaping (_ fileURL: URL) -> String?) { + self.contentTypeForFormPart = contentTypeForFormPart + } + + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + + var urlRequest = urlRequest + + guard let parameters = parameters, !parameters.isEmpty else { + return urlRequest + } + + let boundary = "Boundary-\(UUID().uuidString)" + + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") + + for (key, value) in parameters { + switch value { + case let fileURL as URL: + + urlRequest = try configureFileUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + fileURL: fileURL + ) + + case let string as String: + + if let data = string.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } + + case let number as NSNumber: + + if let data = number.stringValue.data(using: .utf8) { + urlRequest = configureDataUploadRequest( + urlRequest: urlRequest, + boundary: boundary, + name: key, + data: data + ) + } + + default: + fatalError("Unprocessable value \(value) with key \(key)") + } + } + + var body = urlRequest.httpBody.orEmpty + + body.append("--\(boundary)--") + + urlRequest.httpBody = body + + return urlRequest + } + + private func configureFileUploadRequest(urlRequest: URLRequest, boundary: String, name: String, fileURL: URL) throws -> URLRequest { + + var urlRequest = urlRequest + + var body = urlRequest.httpBody.orEmpty + + let fileData = try Data(contentsOf: fileURL) + + let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) + + let fileName = fileURL.lastPathComponent + + body.append("--\(boundary)\r\n") + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") + + body.append("Content-Type: \(mimetype)\r\n\r\n") + + body.append(fileData) + + body.append("\r\n\r\n") + + urlRequest.httpBody = body + + return urlRequest + } + + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { + + var urlRequest = urlRequest + + var body = urlRequest.httpBody.orEmpty + + body.append("--\(boundary)\r\n") + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") + + body.append(data) + + body.append("\r\n\r\n") + + urlRequest.httpBody = body + + return urlRequest + + } + + func mimeType(for url: URL) -> String { + let pathExtension = url.pathExtension + + if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue() { + if let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() { + return mimetype as String + } + } + return "application/octet-stream" + } + +} + +fileprivate extension Data { + /// Append string to Data + /// + /// Rather than littering my code with calls to `dataUsingEncoding` to convert strings to Data, and then add that data to the Data, this wraps it in a nice convenient little extension to Data. This converts using UTF-8. + /// + /// - parameter string: The string to be added to the `Data`. + + mutating func append(_ string: String) { + if let data = string.data(using: .utf8) { + append(data) + } + } +} + +fileprivate extension Optional where Wrapped == Data { + var orEmpty: Data { + self ?? Data() + } +} + +extension JSONDataEncoding: ParameterEncoding {} diff --git a/samples/client/petstore/swift5/readonlyProperties/README.md b/samples/client/petstore/swift5/readonlyProperties/README.md new file mode 100644 index 000000000000..1725415f7e04 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/README.md @@ -0,0 +1,141 @@ +# Swift5 API client for PetstoreClient + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: +- Build package: org.openapitools.codegen.languages.Swift5ClientCodegen + +## Installation + +### Carthage + +Run `carthage update` + +### CocoaPods + +Run `pod install` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeAPI* | [**call123testSpecialTags**](docs/AnotherFakeAPI.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*FakeAPI* | [**fakeOuterBooleanSerialize**](docs/FakeAPI.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeAPI* | [**fakeOuterCompositeSerialize**](docs/FakeAPI.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeAPI* | [**fakeOuterNumberSerialize**](docs/FakeAPI.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeAPI* | [**fakeOuterStringSerialize**](docs/FakeAPI.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeAPI* | [**testBodyWithFileSchema**](docs/FakeAPI.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +*FakeAPI* | [**testBodyWithQueryParams**](docs/FakeAPI.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +*FakeAPI* | [**testClientModel**](docs/FakeAPI.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeAPI* | [**testEndpointParameters**](docs/FakeAPI.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeAPI* | [**testEnumParameters**](docs/FakeAPI.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeAPI* | [**testGroupParameters**](docs/FakeAPI.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeAPI* | [**testInlineAdditionalProperties**](docs/FakeAPI.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeAPI* | [**testJsonFormData**](docs/FakeAPI.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeClassnameTags123API* | [**testClassname**](docs/FakeClassnameTags123API.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*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 +*PetAPI* | [**uploadFileWithRequiredFile**](docs/PetAPI.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreAPI* | [**deleteOrder**](docs/StoreAPI.md#deleteorder) | **DELETE** /store/order/{order_id} | 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/{order_id} | 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 + + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Animal](docs/Animal.md) + - [AnimalFarm](docs/AnimalFarm.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [CatAllOf](docs/CatAllOf.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Dog](docs/Dog.md) + - [DogAllOf](docs/DogAllOf.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [List](docs/List.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Return](docs/Return.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [StringBooleanMap](docs/StringBooleanMap.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +## http_basic_test + +- **Type**: HTTP basic authentication + +## 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 + + +## Author + + + diff --git a/samples/client/petstore/swift5/readonlyProperties/docs/AdditionalPropertiesClass.md b/samples/client/petstore/swift5/readonlyProperties/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..e22d28be1de6 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapString** | **[String:String]** | | [optional] +**mapMapString** | [String:[String: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/swift5/readonlyProperties/docs/Animal.md b/samples/client/petstore/swift5/readonlyProperties/docs/Animal.md new file mode 100644 index 000000000000..69c601455cd8 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Animal.md @@ -0,0 +1,11 @@ +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to "red"] + +[[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/swift5/readonlyProperties/docs/AnimalFarm.md b/samples/client/petstore/swift5/readonlyProperties/docs/AnimalFarm.md new file mode 100644 index 000000000000..df6bab21dae8 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/AnimalFarm.md @@ -0,0 +1,9 @@ +# AnimalFarm + +## 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/petstore/swift5/readonlyProperties/docs/AnotherFakeAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/AnotherFakeAPI.md new file mode 100644 index 000000000000..aead5f1f980f --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/AnotherFakeAPI.md @@ -0,0 +1,59 @@ +# AnotherFakeAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeAPI.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +```swift + open class func call123testSpecialTags(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test special tags +AnotherFakeAPI.call123testSpecialTags(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **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/petstore/swift5/readonlyProperties/docs/ApiResponse.md b/samples/client/petstore/swift5/readonlyProperties/docs/ApiResponse.md new file mode 100644 index 000000000000..c6d9768fe9bf --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## 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/swift5/readonlyProperties/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/swift5/readonlyProperties/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..c6fceff5e08d --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [[Double]] | | [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/swift5/readonlyProperties/docs/ArrayOfNumberOnly.md b/samples/client/petstore/swift5/readonlyProperties/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..f09f8fa6f70f --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **[Double]** | | [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/swift5/readonlyProperties/docs/ArrayTest.md b/samples/client/petstore/swift5/readonlyProperties/docs/ArrayTest.md new file mode 100644 index 000000000000..bf416b8330cc --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/ArrayTest.md @@ -0,0 +1,12 @@ +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **[String]** | | [optional] +**arrayArrayOfInteger** | [[Int64]] | | [optional] +**arrayArrayOfModel** | [[ReadOnlyFirst]] | | [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/swift5/readonlyProperties/docs/Capitalization.md b/samples/client/petstore/swift5/readonlyProperties/docs/Capitalization.md new file mode 100644 index 000000000000..95374216c773 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Capitalization.md @@ -0,0 +1,15 @@ +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [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/swift5/readonlyProperties/docs/Cat.md b/samples/client/petstore/swift5/readonlyProperties/docs/Cat.md new file mode 100644 index 000000000000..fb5949b15761 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Cat.md @@ -0,0 +1,10 @@ +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Bool** | | [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/swift5/readonlyProperties/docs/CatAllOf.md b/samples/client/petstore/swift5/readonlyProperties/docs/CatAllOf.md new file mode 100644 index 000000000000..79789be61c01 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/CatAllOf.md @@ -0,0 +1,10 @@ +# CatAllOf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Bool** | | [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/swift5/readonlyProperties/docs/Category.md b/samples/client/petstore/swift5/readonlyProperties/docs/Category.md new file mode 100644 index 000000000000..5ca5408c0f96 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**name** | **String** | | [default to "default-name"] + +[[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/swift5/readonlyProperties/docs/ClassModel.md b/samples/client/petstore/swift5/readonlyProperties/docs/ClassModel.md new file mode 100644 index 000000000000..e3912fdf0fd5 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/ClassModel.md @@ -0,0 +1,10 @@ +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_class** | **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/swift5/readonlyProperties/docs/Client.md b/samples/client/petstore/swift5/readonlyProperties/docs/Client.md new file mode 100644 index 000000000000..0de1b238c36f --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Client.md @@ -0,0 +1,10 @@ +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **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/swift5/readonlyProperties/docs/Dog.md b/samples/client/petstore/swift5/readonlyProperties/docs/Dog.md new file mode 100644 index 000000000000..4824786da049 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Dog.md @@ -0,0 +1,10 @@ +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **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/swift5/readonlyProperties/docs/DogAllOf.md b/samples/client/petstore/swift5/readonlyProperties/docs/DogAllOf.md new file mode 100644 index 000000000000..9302ef52e938 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/DogAllOf.md @@ -0,0 +1,10 @@ +# DogAllOf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **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/swift5/readonlyProperties/docs/EnumArrays.md b/samples/client/petstore/swift5/readonlyProperties/docs/EnumArrays.md new file mode 100644 index 000000000000..b9a9807d3c8e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/EnumArrays.md @@ -0,0 +1,11 @@ +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **[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/swift5/readonlyProperties/docs/EnumClass.md b/samples/client/petstore/swift5/readonlyProperties/docs/EnumClass.md new file mode 100644 index 000000000000..67f017becd0c --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## 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/petstore/swift5/readonlyProperties/docs/EnumTest.md b/samples/client/petstore/swift5/readonlyProperties/docs/EnumTest.md new file mode 100644 index 000000000000..bc9b036dd769 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/EnumTest.md @@ -0,0 +1,14 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **Int** | | [optional] +**enumNumber** | **Double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.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/petstore/swift5/readonlyProperties/docs/FakeAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md new file mode 100644 index 000000000000..d0ab705d4e4b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/FakeAPI.md @@ -0,0 +1,662 @@ +# FakeAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeAPI.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeAPI.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeAPI.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeAPI.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeAPI.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeAPI.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeAPI.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeAPI.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeAPI.md#testenumparameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeAPI.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeAPI.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeAPI.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data + + +# **fakeOuterBooleanSerialize** +```swift + open class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping (_ data: Bool?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer boolean types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = true // Bool | Input boolean as post body (optional) + +FakeAPI.fakeOuterBooleanSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Bool** | Input boolean as post body | [optional] + +### Return type + +**Bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **fakeOuterCompositeSerialize** +```swift + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping (_ data: OuterComposite?, _ error: Error?) -> Void) +``` + + + +Test serialization of object with outer number type + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = OuterComposite(myNumber: 123, myString: "myString_example", myBoolean: false) // OuterComposite | Input composite as post body (optional) + +FakeAPI.fakeOuterCompositeSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md) | Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **fakeOuterNumberSerialize** +```swift + open class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping (_ data: Double?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer number types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = 987 // Double | Input number as post body (optional) + +FakeAPI.fakeOuterNumberSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Double** | Input number as post body | [optional] + +### Return type + +**Double** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **fakeOuterStringSerialize** +```swift + open class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping (_ data: String?, _ error: Error?) -> Void) +``` + + + +Test serialization of outer string types + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = "body_example" // String | Input string as post body (optional) + +FakeAPI.fakeOuterStringSerialize(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String** | Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + +# **testBodyWithFileSchema** +```swift + open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = FileSchemaTestClass(file: File(sourceURI: "sourceURI_example"), files: [File(sourceURI: "sourceURI_example")]) // FileSchemaTestClass | + +FakeAPI.testBodyWithFileSchema(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md) | | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + +# **testBodyWithQueryParams** +```swift + open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + + + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let query = "query_example" // String | +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | + +FakeAPI.testBodyWithQueryParams(query: query, body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String** | | + **body** | [**User**](User.md) | | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + +# **testClientModel** +```swift + open class func testClientModel(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test \"client\" model + +To test \"client\" model + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test \"client\" model +FakeAPI.testClientModel(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **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) + +# **testEndpointParameters** +```swift + 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, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let number = 987 // Double | None +let double = 987 // Double | None +let patternWithoutDelimiter = "patternWithoutDelimiter_example" // String | None +let byte = 987 // Data | None +let integer = 987 // Int | None (optional) +let int32 = 987 // Int | None (optional) +let int64 = 987 // Int64 | None (optional) +let float = 987 // Float | None (optional) +let string = "string_example" // String | None (optional) +let binary = URL(string: "https://example.com")! // URL | None (optional) +let date = Date() // Date | None (optional) +let dateTime = Date() // Date | None (optional) +let password = "password_example" // String | None (optional) +let callback = "callback_example" // String | None (optional) + +// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +FakeAPI.testEndpointParameters(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **Double** | None | + **double** | **Double** | None | + **patternWithoutDelimiter** | **String** | None | + **byte** | **Data** | None | + **integer** | **Int** | None | [optional] + **int32** | **Int** | None | [optional] + **int64** | **Int64** | None | [optional] + **float** | **Float** | None | [optional] + **string** | **String** | None | [optional] + **binary** | **URL** | None | [optional] + **date** | **Date** | None | [optional] + **dateTime** | **Date** | None | [optional] + **password** | **String** | None | [optional] + **callback** | **String** | None | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[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) + +# **testEnumParameters** +```swift + 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, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +To test enum parameters + +To test enum parameters + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let enumHeaderStringArray = ["enumHeaderStringArray_example"] // [String] | Header parameter enum test (string array) (optional) +let enumHeaderString = "enumHeaderString_example" // String | Header parameter enum test (string) (optional) (default to .efg) +let enumQueryStringArray = ["enumQueryStringArray_example"] // [String] | Query parameter enum test (string array) (optional) +let enumQueryString = "enumQueryString_example" // String | Query parameter enum test (string) (optional) (default to .efg) +let enumQueryInteger = 987 // Int | Query parameter enum test (double) (optional) +let enumQueryDouble = 987 // Double | Query parameter enum test (double) (optional) +let enumFormStringArray = ["inner_example"] // [String] | Form parameter enum test (string array) (optional) (default to .dollar) +let enumFormString = "enumFormString_example" // String | Form parameter enum test (string) (optional) (default to .efg) + +// To test enum parameters +FakeAPI.testEnumParameters(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**[String]**](String.md) | Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String** | Header parameter enum test (string) | [optional] [default to .efg] + **enumQueryStringArray** | [**[String]**](String.md) | Query parameter enum test (string array) | [optional] + **enumQueryString** | **String** | Query parameter enum test (string) | [optional] [default to .efg] + **enumQueryInteger** | **Int** | Query parameter enum test (double) | [optional] + **enumQueryDouble** | **Double** | Query parameter enum test (double) | [optional] + **enumFormStringArray** | [**[String]**](String.md) | Form parameter enum test (string array) | [optional] [default to .dollar] + **enumFormString** | **String** | Form parameter enum test (string) | [optional] [default to .efg] + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[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) + +# **testGroupParameters** +```swift + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let requiredStringGroup = 987 // Int | Required String in group parameters +let requiredBooleanGroup = true // Bool | Required Boolean in group parameters +let requiredInt64Group = 987 // Int64 | Required Integer in group parameters +let stringGroup = 987 // Int | String in group parameters (optional) +let booleanGroup = true // Bool | Boolean in group parameters (optional) +let int64Group = 987 // Int64 | Integer in group parameters (optional) + +// Fake endpoint to test group parameters (optional) +FakeAPI.testGroupParameters(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **Int** | Required String in group parameters | + **requiredBooleanGroup** | **Bool** | Required Boolean in group parameters | + **requiredInt64Group** | **Int64** | Required Integer in group parameters | + **stringGroup** | **Int** | String in group parameters | [optional] + **booleanGroup** | **Bool** | Boolean in group parameters | [optional] + **int64Group** | **Int64** | Integer in group parameters | [optional] + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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) + +# **testInlineAdditionalProperties** +```swift + open class func testInlineAdditionalProperties(param: [String:String], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +test inline additionalProperties + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let param = "TODO" // [String:String] | request body + +// test inline additionalProperties +FakeAPI.testInlineAdditionalProperties(param: param) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**[String:String]**](String.md) | request body | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + +# **testJsonFormData** +```swift + open class func testJsonFormData(param: String, param2: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +test json serialization of form data + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let param = "param_example" // String | field1 +let param2 = "param2_example" // String | field2 + +// test json serialization of form data +FakeAPI.testJsonFormData(param: param, param2: param2) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String** | field1 | + **param2** | **String** | field2 | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[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/swift5/readonlyProperties/docs/FakeClassnameTags123API.md b/samples/client/petstore/swift5/readonlyProperties/docs/FakeClassnameTags123API.md new file mode 100644 index 000000000000..9f24b46edbc3 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/FakeClassnameTags123API.md @@ -0,0 +1,59 @@ +# FakeClassnameTags123API + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123API.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +```swift + open class func testClassname(body: Client, completion: @escaping (_ data: Client?, _ error: Error?) -> Void) +``` + +To test class name in snake case + +To test class name in snake case + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Client(client: "client_example") // Client | client model + +// To test class name in snake case +FakeClassnameTags123API.testClassname(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md) | client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **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/petstore/swift5/readonlyProperties/docs/File.md b/samples/client/petstore/swift5/readonlyProperties/docs/File.md new file mode 100644 index 000000000000..3edfef17b794 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/File.md @@ -0,0 +1,10 @@ +# File + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [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/swift5/readonlyProperties/docs/FileSchemaTestClass.md b/samples/client/petstore/swift5/readonlyProperties/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..afdacc60b2c3 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [File] | | [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/swift5/readonlyProperties/docs/FormatTest.md b/samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md new file mode 100644 index 000000000000..f74d94f6c46a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/FormatTest.md @@ -0,0 +1,22 @@ +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Int** | | [optional] +**int32** | **Int** | | [optional] +**int64** | **Int64** | | [optional] +**number** | **Double** | | +**float** | **Float** | | [optional] +**double** | **Double** | | [optional] +**string** | **String** | | [optional] +**byte** | **Data** | | +**binary** | **URL** | | [optional] +**date** | **Date** | | +**dateTime** | **Date** | | [optional] +**uuid** | **UUID** | | [optional] +**password** | **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/petstore/swift5/readonlyProperties/docs/HasOnlyReadOnly.md b/samples/client/petstore/swift5/readonlyProperties/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..57b6e3a17e67 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + +[[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/swift5/readonlyProperties/docs/List.md b/samples/client/petstore/swift5/readonlyProperties/docs/List.md new file mode 100644 index 000000000000..b77718302edf --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/List.md @@ -0,0 +1,10 @@ +# List + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_123list** | **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/swift5/readonlyProperties/docs/MapTest.md b/samples/client/petstore/swift5/readonlyProperties/docs/MapTest.md new file mode 100644 index 000000000000..56213c4113f6 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/MapTest.md @@ -0,0 +1,13 @@ +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [String:[String:String]] | | [optional] +**mapOfEnumString** | **[String:String]** | | [optional] +**directMap** | **[String:Bool]** | | [optional] +**indirectMap** | [**StringBooleanMap**](StringBooleanMap.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/petstore/swift5/readonlyProperties/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/swift5/readonlyProperties/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..fcffb8ecdbf3 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **UUID** | | [optional] +**dateTime** | **Date** | | [optional] +**map** | [String:Animal] | | [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/swift5/readonlyProperties/docs/Model200Response.md b/samples/client/petstore/swift5/readonlyProperties/docs/Model200Response.md new file mode 100644 index 000000000000..5865ea690cc3 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Model200Response.md @@ -0,0 +1,11 @@ +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Int** | | [optional] +**_class** | **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/swift5/readonlyProperties/docs/Name.md b/samples/client/petstore/swift5/readonlyProperties/docs/Name.md new file mode 100644 index 000000000000..f7b180292cd6 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Name.md @@ -0,0 +1,13 @@ +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Int** | | +**snakeCase** | **Int** | | [optional] [readonly] +**property** | **String** | | [optional] +**_123number** | **Int** | | [optional] [readonly] + +[[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/swift5/readonlyProperties/docs/NumberOnly.md b/samples/client/petstore/swift5/readonlyProperties/docs/NumberOnly.md new file mode 100644 index 000000000000..72bd361168b5 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/NumberOnly.md @@ -0,0 +1,10 @@ +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **Double** | | [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/swift5/readonlyProperties/docs/Order.md b/samples/client/petstore/swift5/readonlyProperties/docs/Order.md new file mode 100644 index 000000000000..15487f01175c --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**petId** | **Int64** | | [optional] +**quantity** | **Int** | | [optional] +**shipDate** | **Date** | | [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/swift5/readonlyProperties/docs/OuterComposite.md b/samples/client/petstore/swift5/readonlyProperties/docs/OuterComposite.md new file mode 100644 index 000000000000..d6b3583bc3ff --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **Double** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Bool** | | [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/swift5/readonlyProperties/docs/OuterEnum.md b/samples/client/petstore/swift5/readonlyProperties/docs/OuterEnum.md new file mode 100644 index 000000000000..06d413b01680 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/OuterEnum.md @@ -0,0 +1,9 @@ +# OuterEnum + +## 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/petstore/swift5/readonlyProperties/docs/Pet.md b/samples/client/petstore/swift5/readonlyProperties/docs/Pet.md new file mode 100644 index 000000000000..5c05f98fad4a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **[String]** | | +**tags** | [Tag] | | [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/swift5/readonlyProperties/docs/PetAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md new file mode 100644 index 000000000000..27efe0833476 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md @@ -0,0 +1,469 @@ +# PetAPI + +All URIs are relative to *http://petstore.swagger.io:80/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 +[**uploadFileWithRequiredFile**](PetAPI.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +```swift + open class func addPet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Add a new pet to the store + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Pet(id: 123, category: Category(id: 123, name: "name_example"), name: "name_example", photoUrls: ["photoUrls_example"], tags: [Tag(id: 123, name: "name_example")], status: "status_example") // Pet | Pet object that needs to be added to the store + +// Add a new pet to the store +PetAPI.addPet(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[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** +```swift + open class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Deletes a pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | Pet id to delete +let apiKey = "apiKey_example" // String | (optional) + +// Deletes a pet +PetAPI.deletePet(petId: petId, apiKey: apiKey) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | 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 + +[[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** +```swift + open class func findPetsByStatus(status: [String], completion: @escaping (_ data: [Pet]?, _ error: Error?) -> Void) +``` + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let status = ["status_example"] // [String] | Status values that need to be considered for filter + +// Finds Pets by status +PetAPI.findPetsByStatus(status: status) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[String]**](String.md) | Status values that need to be considered for filter | + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, 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) + +# **findPetsByTags** +```swift + open class func findPetsByTags(tags: [String], completion: @escaping (_ data: [Pet]?, _ error: Error?) -> Void) +``` + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let tags = ["inner_example"] // [String] | Tags to filter by + +// Finds Pets by tags +PetAPI.findPetsByTags(tags: tags) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[String]**](String.md) | Tags to filter by | + +### Return type + +[**[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, 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) + +# **getPetById** +```swift + open class func getPetById(petId: Int64, completion: @escaping (_ data: Pet?, _ error: Error?) -> Void) +``` + +Find pet by ID + +Returns a single pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to return + +// Find pet by ID +PetAPI.getPetById(petId: petId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | 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 + +[[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** +```swift + open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Update an existing pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Pet(id: 123, category: Category(id: 123, name: "name_example"), name: "name_example", photoUrls: ["photoUrls_example"], tags: [Tag(id: 123, name: "name_example")], status: "status_example") // Pet | Pet object that needs to be added to the store + +// Update an existing pet +PetAPI.updatePet(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | + +### Return type + +Void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[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** +```swift + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Updates a pet in the store with form data + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet that needs to be updated +let name = "name_example" // String | Updated name of the pet (optional) +let status = "status_example" // String | Updated status of the pet (optional) + +// Updates a pet in the store with form data +PetAPI.updatePetWithForm(petId: petId, name: name, status: status) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | 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 + +[[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** +```swift + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +uploads an image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) +let file = URL(string: "https://example.com")! // URL | file to upload (optional) + +// uploads an image +PetAPI.uploadFile(petId: petId, additionalMetadata: additionalMetadata, file: file) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **additionalMetadata** | **String** | Additional data to pass to server | [optional] + **file** | **URL** | 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 + +[[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) + +# **uploadFileWithRequiredFile** +```swift + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +uploads an image (required) + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let requiredFile = URL(string: "https://example.com")! // URL | file to upload +let additionalMetadata = "additionalMetadata_example" // String | Additional data to pass to server (optional) + +// uploads an image (required) +PetAPI.uploadFileWithRequiredFile(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **requiredFile** | **URL** | file to upload | + **additionalMetadata** | **String** | Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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/petstore/swift5/readonlyProperties/docs/ReadOnlyFirst.md b/samples/client/petstore/swift5/readonlyProperties/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..ed537b87598b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **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/swift5/readonlyProperties/docs/Return.md b/samples/client/petstore/swift5/readonlyProperties/docs/Return.md new file mode 100644 index 000000000000..66d17c27c887 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Return.md @@ -0,0 +1,10 @@ +# Return + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **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/petstore/swift5/readonlyProperties/docs/SpecialModelName.md b/samples/client/petstore/swift5/readonlyProperties/docs/SpecialModelName.md new file mode 100644 index 000000000000..3ec27a38c2ac --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/SpecialModelName.md @@ -0,0 +1,10 @@ +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**specialPropertyName** | **Int64** | | [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/swift5/readonlyProperties/docs/StoreAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/StoreAPI.md new file mode 100644 index 000000000000..36365ca51993 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/StoreAPI.md @@ -0,0 +1,206 @@ +# StoreAPI + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreAPI.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreAPI.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreAPI.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreAPI.md#placeorder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +```swift + open class func deleteOrder(orderId: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let orderId = "orderId_example" // String | ID of the order that needs to be deleted + +// Delete purchase order by ID +StoreAPI.deleteOrder(orderId: orderId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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 + +[[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** +```swift + open class func getInventory(completion: @escaping (_ data: [String:Int]?, _ error: Error?) -> Void) +``` + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + + +// Returns pet inventories by status +StoreAPI.getInventory() { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**[String:Int]** + +### Authorization + +[api_key](../README.md#api_key) + +### 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) + +# **getOrderById** +```swift + open class func getOrderById(orderId: Int64, completion: @escaping (_ data: Order?, _ error: Error?) -> Void) +``` + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let orderId = 987 // Int64 | ID of pet that needs to be fetched + +// Find purchase order by ID +StoreAPI.getOrderById(orderId: orderId) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Int64** | 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 + +[[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** +```swift + open class func placeOrder(body: Order, completion: @escaping (_ data: Order?, _ error: Error?) -> Void) +``` + +Place an order for a pet + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = Order(id: 123, petId: 123, quantity: 123, shipDate: Date(), status: "status_example", complete: false) // Order | order placed for purchasing the pet + +// Place an order for a pet +StoreAPI.placeOrder(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md) | order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, 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/petstore/swift5/readonlyProperties/docs/StringBooleanMap.md b/samples/client/petstore/swift5/readonlyProperties/docs/StringBooleanMap.md new file mode 100644 index 000000000000..7abf11ec68b1 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ +# StringBooleanMap + +## 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/petstore/swift5/readonlyProperties/docs/Tag.md b/samples/client/petstore/swift5/readonlyProperties/docs/Tag.md new file mode 100644 index 000000000000..ff4ac8aa4519 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [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/swift5/readonlyProperties/docs/TypeHolderDefault.md b/samples/client/petstore/swift5/readonlyProperties/docs/TypeHolderDefault.md new file mode 100644 index 000000000000..5161394bdc3e --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/TypeHolderDefault.md @@ -0,0 +1,14 @@ +# TypeHolderDefault + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | [default to "what"] +**numberItem** | **Double** | | +**integerItem** | **Int** | | +**boolItem** | **Bool** | | [default to true] +**arrayItem** | **[Int]** | | + +[[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/swift5/readonlyProperties/docs/TypeHolderExample.md b/samples/client/petstore/swift5/readonlyProperties/docs/TypeHolderExample.md new file mode 100644 index 000000000000..46d0471cd71a --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/TypeHolderExample.md @@ -0,0 +1,14 @@ +# TypeHolderExample + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | **Double** | | +**integerItem** | **Int** | | +**boolItem** | **Bool** | | +**arrayItem** | **[Int]** | | + +[[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/swift5/readonlyProperties/docs/User.md b/samples/client/petstore/swift5/readonlyProperties/docs/User.md new file mode 100644 index 000000000000..5a439de0ff95 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Int64** | | [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/swift5/readonlyProperties/docs/UserAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/UserAPI.md new file mode 100644 index 000000000000..380813bc68c0 --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/docs/UserAPI.md @@ -0,0 +1,406 @@ +# UserAPI + +All URIs are relative to *http://petstore.swagger.io:80/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** +```swift + open class func createUser(body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Create user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = 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 +UserAPI.createUser(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md) | Created user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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** +```swift + open class func createUsersWithArrayInput(body: [User], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Creates list of users with given input array + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = [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 +UserAPI.createUsersWithArrayInput(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md) | List of user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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** +```swift + open class func createUsersWithListInput(body: [User], completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Creates list of users with given input array + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let body = [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 +UserAPI.createUsersWithListInput(body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[User]**](User.md) | List of user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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** +```swift + open class func deleteUser(username: String, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Delete user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The name that needs to be deleted + +// Delete user +UserAPI.deleteUser(username: username) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | The name 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 + +[[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** +```swift + open class func getUserByName(username: String, completion: @escaping (_ data: User?, _ error: Error?) -> Void) +``` + +Get user by user name + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The name that needs to be fetched. Use user1 for testing. + +// Get user by user name +UserAPI.getUserByName(username: username) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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 + +[[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** +```swift + open class func loginUser(username: String, password: String, completion: @escaping (_ data: String?, _ error: Error?) -> Void) +``` + +Logs user into the system + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | The user name for login +let password = "password_example" // String | The password for login in clear text + +// Logs user into the system +UserAPI.loginUser(username: username, password: password) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### 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 + +[[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** +```swift + open class func logoutUser(completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Logs out current logged in user session + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + + +// Logs out current logged in user session +UserAPI.logoutUser() { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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** +```swift + open class func updateUser(username: String, body: User, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) +``` + +Updated user + +This can only be done by the logged in user. + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let username = "username_example" // String | name that need to be deleted +let body = User(id: 123, username: "username_example", firstName: "firstName_example", lastName: "lastName_example", email: "email_example", password: "password_example", phone: "phone_example", userStatus: 123) // User | Updated user object + +// Updated user +UserAPI.updateUser(username: username, body: body) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String** | name that need to be deleted | + **body** | [**User**](User.md) | Updated user object | + +### Return type + +Void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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/swift5/readonlyProperties/git_push.sh b/samples/client/petstore/swift5/readonlyProperties/git_push.sh new file mode 100644 index 000000000000..ced3be2b0c7b --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/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/swift5/readonlyProperties/project.yml b/samples/client/petstore/swift5/readonlyProperties/project.yml new file mode 100644 index 000000000000..892005fdd5aa --- /dev/null +++ b/samples/client/petstore/swift5/readonlyProperties/project.yml @@ -0,0 +1,14 @@ +name: PetstoreClient +targets: + PetstoreClient: + type: framework + platform: iOS + deploymentTarget: "10.0" + sources: [PetstoreClient] + info: + path: ./Info.plist + version: 1.0.0 + settings: + APPLICATION_EXTENSION_API_ONLY: true + scheme: {} + From a8cc42d170303c43a11d9b01b9a8db7a71cb3fa1 Mon Sep 17 00:00:00 2001 From: Jim Schubert <james.schubert@gmail.com> Date: Tue, 28 Apr 2020 23:48:05 -0400 Subject: [PATCH 33/78] [validation] Warn on duplicate tags (#6061) The specification requires that tags are unique. This isn't caught by swagger-parser, so we will issue a warning if duplicate tag names are found. --- .../validations/oas/OpenApiEvaluator.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/validations/oas/OpenApiEvaluator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/validations/oas/OpenApiEvaluator.java index 5cbe4c9eb894..56097b74d0fd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/validations/oas/OpenApiEvaluator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/validations/oas/OpenApiEvaluator.java @@ -6,12 +6,11 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.parameters.Parameter; import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.tags.Tag; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.validation.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; /** * A validator which evaluates an OpenAPI 3.x specification document @@ -101,6 +100,27 @@ public ValidationResult validate(OpenAPI specification) { validationResult.consume(parameterValidations.validate(wrapper)); }); + List<Tag> tags = specification.getTags(); + if (tags != null && tags.size() > 1) { + Set<String> distinct = new HashSet<>(); + Set<String> duplicated = new HashSet<>(); + tags.forEach(tag -> { + // add returns false if it already exists… + if (!distinct.add(tag.getName())) { + duplicated.add(tag.getName()); + } + }); + if (duplicated.size() > 0) { + // From https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#fixed-fields + // A list of tags used by the specification with additional metadata. The order of the tags can be used + // to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object + // must be declared. The tags that are not declared MAY be organized randomly or based on the tools' + // logic. Each tag name in the list MUST be unique. + ValidationRule rule = ValidationRule.warn("Duplicate tags", "The specification requires that tag names are unique.", s -> ValidationRule.Fail.empty()); + validationResult.addResult(Validated.invalid(rule, "Duplicated tag(s): " + String.join(",", duplicated))); + } + } + return validationResult; } } From a8885e838a71330d21b75e3bf9e07a9a7b779cc6 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 29 Apr 2020 18:03:19 +0800 Subject: [PATCH 34/78] update swift5 samples (#6102) --- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../petstore/swift5/default/Package.swift | 4 +- .../Classes/OpenAPIs/APIHelper.swift | 17 +- .../Classes/OpenAPIs/APIs.swift | 14 +- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 4 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 56 +++--- .../APIs/FakeClassnameTags123API.swift | 4 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 48 +++-- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 26 ++- .../Classes/OpenAPIs/APIs/UserAPI.swift | 36 ++-- .../Classes/OpenAPIs/CodableHelper.swift | 2 +- .../Classes/OpenAPIs/Configuration.swift | 6 +- .../Classes/OpenAPIs/Extensions.swift | 20 +- .../Classes/OpenAPIs/JSONDataEncoding.swift | 2 +- .../Classes/OpenAPIs/JSONEncodingHelper.swift | 8 +- .../Classes/OpenAPIs/Models.swift | 7 +- .../Models/AdditionalPropertiesClass.swift | 12 +- .../Classes/OpenAPIs/Models/Animal.swift | 4 +- .../Classes/OpenAPIs/Models/AnimalFarm.swift | 1 - .../Classes/OpenAPIs/Models/ApiResponse.swift | 4 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 6 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 6 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 6 +- .../OpenAPIs/Models/Capitalization.swift | 6 +- .../Classes/OpenAPIs/Models/Cat.swift | 4 +- .../Classes/OpenAPIs/Models/CatAllOf.swift | 4 +- .../Classes/OpenAPIs/Models/Category.swift | 4 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 3 +- .../Classes/OpenAPIs/Models/Client.swift | 4 +- .../Classes/OpenAPIs/Models/Dog.swift | 4 +- .../Classes/OpenAPIs/Models/DogAllOf.swift | 4 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 6 +- .../Classes/OpenAPIs/Models/EnumClass.swift | 1 - .../Classes/OpenAPIs/Models/EnumTest.swift | 6 +- .../Classes/OpenAPIs/Models/File.swift | 3 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 4 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 4 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 4 +- .../Classes/OpenAPIs/Models/List.swift | 6 +- .../Classes/OpenAPIs/Models/MapTest.swift | 14 +- ...opertiesAndAdditionalPropertiesClass.swift | 8 +- .../OpenAPIs/Models/Model200Response.swift | 5 +- .../Classes/OpenAPIs/Models/Name.swift | 5 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 6 +- .../Classes/OpenAPIs/Models/Order.swift | 4 +- .../OpenAPIs/Models/OuterComposite.swift | 6 +- .../Classes/OpenAPIs/Models/OuterEnum.swift | 1 - .../Classes/OpenAPIs/Models/Pet.swift | 4 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 4 +- .../Classes/OpenAPIs/Models/Return.swift | 5 +- .../OpenAPIs/Models/SpecialModelName.swift | 6 +- .../OpenAPIs/Models/StringBooleanMap.swift | 8 +- .../Classes/OpenAPIs/Models/Tag.swift | 4 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 6 +- .../OpenAPIs/Models/TypeHolderExample.swift | 6 +- .../Classes/OpenAPIs/Models/User.swift | 4 +- .../OpenAPIs/URLSessionImplementations.swift | 172 +++++++++--------- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- .../OpenAPIs/URLSessionImplementations.swift | 35 +++- samples/client/test/swift5/default/README.md | 2 +- .../TestClient/Classes/OpenAPIs/APIs.swift | 2 +- .../Classes/OpenAPIs/CodableHelper.swift | 8 +- .../OpenAPIs/URLSessionImplementations.swift | 41 +++-- .../swift5/default/docs/SampleSubClass.md | 2 + 69 files changed, 523 insertions(+), 440 deletions(-) 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body diff --git a/samples/client/petstore/swift5/default/Package.swift b/samples/client/petstore/swift5/default/Package.swift index 79f6f8188738..96dfff54edf4 100644 --- a/samples/client/petstore/swift5/default/Package.swift +++ b/samples/client/petstore/swift5/default/Package.swift @@ -14,7 +14,7 @@ let package = Package( // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "PetstoreClient", - targets: ["PetstoreClient"]), + targets: ["PetstoreClient"]) ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -26,6 +26,6 @@ let package = Package( name: "PetstoreClient", dependencies: [], path: "PetstoreClient/Classes" - ), + ) ] ) diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index d94614b34fc7..200070096800 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,7 +7,7 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { + public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? { let destination = source.reduce(into: [String: Any]()) { (result, item) in if let value = item.value { result[item.key] = value @@ -20,17 +20,17 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { + public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] { return source.reduce(into: [String: String]()) { (result, item) in - if let collection = item.value as? Array<Any?> { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + if let collection = item.value as? [Any?] { + result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",") } else if let value: Any = item.value { result[item.key] = "\(value)" } } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { + public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { guard let source = source else { return nil } @@ -46,15 +46,15 @@ public struct APIHelper { } public static func mapValueToPathItem(_ source: Any) -> Any { - if let collection = source as? Array<Any?> { + if let collection = source as? [Any?] { return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") } return source } - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { + public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? { let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in - if let collection = item.value as? Array<Any?> { + if let collection = item.value as? [Any?] { let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") result.append(URLQueryItem(name: item.key, value: value)) } else if let value = item.value { @@ -68,4 +68,3 @@ public struct APIHelper { return destination } } - diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift index c5d1b9b42df3..a5c2d605dff6 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,15 +9,15 @@ import Foundation open class PetstoreClientAPI { public static var basePath = "http://petstore.swagger.io:80/v2" public static var credential: URLCredential? - public static var customHeaders: [String:String] = [:] + public static var customHeaders: [String: String] = [:] public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory() public static var apiResponseQueue: DispatchQueue = .main } open class RequestBuilder<T> { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + var headers: [String: String] + public let parameters: [String: Any]? public let isBody: Bool public let method: String public let URLString: String @@ -25,9 +25,9 @@ open class RequestBuilder<T> { /// Optional block to obtain a reference to the request's progress instance when available. /// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0. /// If you need to get the request's progress in older OS versions, please use Alamofire http client. - public var onProgressReady: ((Progress) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -37,7 +37,7 @@ open class RequestBuilder<T> { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } @@ -60,5 +60,5 @@ open class RequestBuilder<T> { public protocol RequestBuilderFactory { func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index bb3ae7178254..5bbf323f820c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class AnotherFakeAPI { /** To test special tags @@ -17,7 +15,7 @@ open class AnotherFakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d1d81faa335c..134d6aea416a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeAPI { /** @@ -16,7 +14,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) { + open class func fakeOuterBooleanSerialize(body: Bool? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Bool?, _ error: Error?) -> Void)) { fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -51,7 +49,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -86,7 +84,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) { + open class func fakeOuterNumberSerialize(body: Double? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Double?, _ error: Error?) -> Void)) { fakeOuterNumberSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -121,7 +119,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func fakeOuterStringSerialize(body: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { fakeOuterStringSerializeWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -156,7 +154,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithFileSchema(body: FileSchemaTestClass, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithFileSchemaWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -192,7 +190,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testBodyWithQueryParams(query: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -231,7 +229,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -281,7 +279,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -318,7 +316,7 @@ open class FakeAPI { open class func testEndpointParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -337,7 +335,7 @@ open class FakeAPI { let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -426,7 +424,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - 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, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + 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, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -454,19 +452,19 @@ open class FakeAPI { open class func testEnumParametersWithRequestBuilder(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) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray?.encodeToJSON(), "enum_form_string": enumFormString?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), - "enum_query_string": enumQueryString?.encodeToJSON(), - "enum_query_integer": enumQueryInteger?.encodeToJSON(), + "enum_query_string_array": enumQueryStringArray?.encodeToJSON(), + "enum_query_string": enumQueryString?.encodeToJSON(), + "enum_query_integer": enumQueryInteger?.encodeToJSON(), "enum_query_double": enumQueryDouble?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -492,7 +490,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -518,13 +516,13 @@ open class FakeAPI { open class func testGroupParametersWithRequestBuilder(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) -> RequestBuilder<Void> { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": requiredStringGroup.encodeToJSON(), - "required_int64_group": requiredInt64Group.encodeToJSON(), - "string_group": stringGroup?.encodeToJSON(), + "required_string_group": requiredStringGroup.encodeToJSON(), + "required_int64_group": requiredInt64Group.encodeToJSON(), + "string_group": stringGroup?.encodeToJSON(), "int64_group": int64Group?.encodeToJSON() ]) let nillableHeaders: [String: Any?] = [ @@ -545,7 +543,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(param: [String:String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testInlineAdditionalProperties(param: [String: String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -562,7 +560,7 @@ open class FakeAPI { - parameter param: (body) request body - returns: RequestBuilder<Void> */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> { + open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String: String]) -> RequestBuilder<Void> { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param) @@ -582,7 +580,7 @@ open class FakeAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func testJsonFormData(param: String, param2: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -603,14 +601,14 @@ open class FakeAPI { open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { let path = "/fake/jsonFormData" let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "param": param.encodeToJSON(), "param2": param2.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d21c4a49d43d..48cfe7187b9a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -7,8 +7,6 @@ import Foundation - - open class FakeClassnameTags123API { /** To test class name in snake case @@ -17,7 +15,7 @@ open class FakeClassnameTags123API { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 496da91171ac..0552d4a6c16e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class PetAPI { /** Add a new pet to the store @@ -17,7 +15,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func addPet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { addPetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -57,7 +55,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deletePet(petId: Int64, apiKey: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -84,8 +82,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ "api_key": apiKey?.encodeToJSON() @@ -113,7 +111,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByStatus(status: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -137,8 +135,8 @@ open class PetAPI { open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "status": status.encodeToJSON() @@ -156,7 +154,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?,_ error: Error?) -> Void)) { + open class func findPetsByTags(tags: [String], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [Pet]?, _ error: Error?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -180,8 +178,8 @@ open class PetAPI { open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ "tags": tags.encodeToJSON() @@ -199,7 +197,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?,_ error: Error?) -> Void)) { + open class func getPetById(petId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Pet?, _ error: Error?) -> Void)) { getPetByIdWithRequestBuilder(petId: petId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -226,8 +224,8 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -242,7 +240,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePet(body: Pet, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -283,7 +281,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -311,14 +309,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "name": name?.encodeToJSON(), "status": status?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -335,7 +333,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -363,14 +361,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "file": file?.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -387,7 +385,7 @@ open class PetAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?,_ error: Error?) -> Void)) { + open class func uploadFileWithRequiredFile(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) { uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -415,14 +413,14 @@ open class PetAPI { let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let formParams: [String:Any?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata?.encodeToJSON(), "requiredFile": requiredFile.encodeToJSON() ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3848eda85ad6..a8a83eda39a4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class StoreAPI { /** Delete purchase order by ID @@ -17,7 +15,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteOrder(orderId: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteOrderWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -41,8 +39,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -56,7 +54,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String:Int]?,_ error: Error?) -> Void)) { + open class func getInventory(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: [String: Int]?, _ error: Error?) -> Void)) { getInventoryWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -76,14 +74,14 @@ open class StoreAPI { - name: api_key - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> { + open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String: Int]> { let path = "/store/inventory" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + let requestBuilder: RequestBuilder<[String: Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) } @@ -95,7 +93,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func getOrderById(orderId: Int64, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { getOrderByIdWithRequestBuilder(orderId: orderId).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -119,8 +117,8 @@ open class StoreAPI { let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -135,7 +133,7 @@ open class StoreAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(body: Order, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 546166841d9e..505ed1b0c5c9 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -7,8 +7,6 @@ import Foundation - - open class UserAPI { /** Create user @@ -17,7 +15,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUser(body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUserWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -54,7 +52,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithArrayInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -90,7 +88,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func createUsersWithListInput(body: [User], apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -126,7 +124,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func deleteUser(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { deleteUserWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -150,8 +148,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -166,7 +164,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?,_ error: Error?) -> Void)) { + open class func getUserByName(username: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: User?, _ error: Error?) -> Void)) { getUserByNameWithRequestBuilder(username: username).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -189,8 +187,8 @@ open class UserAPI { let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil) let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -206,7 +204,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) { + open class func loginUser(username: String, password: String, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: String?, _ error: Error?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute(apiResponseQueue) { result -> Void in switch result { case let .success(response): @@ -228,11 +226,11 @@ open class UserAPI { open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username.encodeToJSON(), + "username": username.encodeToJSON(), "password": password.encodeToJSON() ]) @@ -247,7 +245,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func logoutUser(apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { logoutUserWithRequestBuilder().execute(apiResponseQueue) { result -> Void in switch result { case .success: @@ -266,8 +264,8 @@ open class UserAPI { open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -283,7 +281,7 @@ open class UserAPI { - parameter apiResponseQueue: The queue on which api response is dispatched. - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { + open class func updateUser(username: String, body: User, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute(apiResponseQueue) { result -> Void in switch result { case .success: diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 01b28a4bd42d..ef971ebadc60 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -45,4 +45,4 @@ open class CodableHelper { open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { return Swift.Result { try self.jsonEncoder.encode(value) } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f171525e4394..627d9adb757e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,10 +7,10 @@ import Foundation open class Configuration { - + // This value is used to configure the date formatter that is used to serialize dates into JSON format. // You must set it prior to encoding any dates, and it will only be read once. @available(*, unavailable, message: "To set a different date format, use CodableHelper.dateFormatter instead.") public static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file + +} 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 6e279679c67a..93ed6b90b376 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -108,24 +108,24 @@ extension String: CodingKey { extension KeyedEncodingContainerProtocol { - public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArray<T>(_ values: [T], forKey key: Self.Key) throws where T: Encodable { var arrayContainer = nestedUnkeyedContainer(forKey: key) try arrayContainer.encode(contentsOf: values) } - public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T : Encodable { + public mutating func encodeArrayIfPresent<T>(_ values: [T]?, forKey key: Self.Key) throws where T: Encodable { if let values = values { try encodeArray(values, forKey: key) } } - public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T : Encodable { + public mutating func encodeMap<T>(_ pairs: [Self.Key: T]) throws where T: Encodable { for (key, value) in pairs { try encode(value, forKey: key) } } - public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T : Encodable { + public mutating func encodeMapIfPresent<T>(_ pairs: [Self.Key: T]?) throws where T: Encodable { if let pairs = pairs { try encodeMap(pairs) } @@ -135,7 +135,7 @@ extension KeyedEncodingContainerProtocol { extension KeyedDecodingContainerProtocol { - public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T : Decodable { + public func decodeArray<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -147,8 +147,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { - var tmpArray: [T]? = nil + public func decodeArrayIfPresent<T>(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { + var tmpArray: [T]? if contains(key) { tmpArray = try decodeArray(T.self, forKey: key) @@ -157,8 +157,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap<T>(_ type: T.Type, excludedKeys: Set<Self.Key>) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -177,5 +177,3 @@ extension HTTPURLResponse { return Array(200 ..< 300).contains(statusCode) } } - - diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift index 08f1ef334dff..b79e9f5e64d5 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONDataEncoding.swift @@ -41,7 +41,7 @@ public struct JSONDataEncoding { } public static func encodingParameters(jsonData: Data?) -> [String: Any]? { - var returnedParams: [String: Any]? = nil + var returnedParams: [String: Any]? if let jsonData = jsonData, !jsonData.isEmpty { var params: [String: Any] = [:] params[jsonDataKey] = jsonData diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 314f1eff1f9b..02f78ffb4705 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -9,8 +9,8 @@ import Foundation open class JSONEncodingHelper { - open class func encodingParameters<T:Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { - var params: [String: Any]? = nil + open class func encodingParameters<T: Encodable>(forEncodableObject encodableObj: T?) -> [String: Any]? { + var params: [String: Any]? // Encode the Encodable object if let encodableObj = encodableObj { @@ -27,7 +27,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> [String: Any]? { - var params: [String: Any]? = nil + var params: [String: Any]? if let encodableObj = encodableObj { do { @@ -41,5 +41,5 @@ open class JSONEncodingHelper { return params } - + } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift index 290c7f35e478..b0bfb1159760 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,11 +10,11 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } -public enum DownloadException : Error { +public enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -30,7 +30,6 @@ public enum DecodableRequestBuilderError: Error { case generalError(Error) } - open class Response<T> { public let statusCode: Int public let header: [String: String] @@ -44,7 +43,7 @@ open class Response<T> { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for (key, value) in rawHeader { if let key = key as? String, let value = value as? String { header[key] = value diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 28ca8377b889..1af031535967 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,19 +7,17 @@ import Foundation +public struct AdditionalPropertiesClass: Codable { -public struct AdditionalPropertiesClass: Codable { + public var mapString: [String: String]? + public var mapMapString: [String: [String: String]]? - - public var mapString: [String:String]? - public var mapMapString: [String:[String:String]]? - - public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { + public init(mapString: [String: String]?, mapMapString: [String: [String: String]]?) { self.mapString = mapString self.mapMapString = mapMapString } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapString = "map_string" case mapMapString = "map_map_string" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 1050d79dbe9d..5ed9f31e2a36 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Animal: Codable { - +public struct Animal: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed2..e09b0e9efdc8 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index 4d0393b9ba45..ec270da89074 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ApiResponse: Codable { - +public struct ApiResponse: Codable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 1363c96394ba..6c252ed475b2 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfArrayOfNumberOnly: Codable { - +public struct ArrayOfArrayOfNumberOnly: Codable { public var arrayArrayNumber: [[Double]]? @@ -17,7 +15,7 @@ public struct ArrayOfArrayOfNumberOnly: Codable { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayArrayNumber = "ArrayArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 6b8873730c43..e84eb5d65025 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayOfNumberOnly: Codable { - +public struct ArrayOfNumberOnly: Codable { public var arrayNumber: [Double]? @@ -17,7 +15,7 @@ public struct ArrayOfNumberOnly: Codable { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayNumber = "ArrayNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 64f7c6d9db99..d2140933d181 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ArrayTest: Codable { - +public struct ArrayTest: Codable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? @@ -21,7 +19,7 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case arrayOfString = "array_of_string" case arrayArrayOfInteger = "array_array_of_integer" case arrayArrayOfModel = "array_array_of_model" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index ddb669a59045..d1b3b27616ed 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Capitalization: Codable { - +public struct Capitalization: Codable { public var smallCamel: String? public var capitalCamel: String? @@ -28,7 +26,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index c4f6e0d488ca..7ab887f3113f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Cat: Codable { - +public struct Cat: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift index 7b1d7e32be80..a51ad0dffab1 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/CatAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct CatAllOf: Codable { - +public struct CatAllOf: Codable { public var declawed: Bool? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 3ec00f5ab10d..eb8f7e5e1974 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Category: Codable { - +public struct Category: Codable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index af030c3dd626..e2a7d4427a06 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Codable { - +public struct ClassModel: Codable { public var _class: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 0aae748c76b4..00245ca37280 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Client: Codable { - +public struct Client: Codable { public var client: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 198e28b94dd6..492c1228008e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Dog: Codable { - +public struct Dog: Codable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift index 8ff49b2af23f..7786f8acc5ae 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/DogAllOf.swift @@ -7,9 +7,7 @@ import Foundation - -public struct DogAllOf: Codable { - +public struct DogAllOf: Codable { public var breed: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index e2d3fa04f94b..9844e7c40e35 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumArrays: Codable { - +public struct EnumArrays: Codable { public enum JustSymbol: String, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" @@ -27,7 +25,7 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index c2c639ba3246..d4029d73f8af 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable, CaseIterable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index a56e1f36389b..789f583e1d77 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct EnumTest: Codable { - +public struct EnumTest: Codable { public enum EnumString: String, Codable, CaseIterable { case upper = "UPPER" @@ -43,7 +41,7 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case enumString = "enum_string" case enumStringRequired = "enum_string_required" case enumInteger = "enum_integer" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 773b53b2cb76..abf3ccffc485 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,8 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Codable { - +public struct File: Codable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 83dc1148cfa3..532f1457939a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FileSchemaTestClass: Codable { - +public struct FileSchemaTestClass: Codable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index bccd3f9fb178..20bd6d103b3d 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,9 +7,7 @@ import Foundation - -public struct FormatTest: Codable { - +public struct FormatTest: Codable { public var integer: Int? public var int32: Int? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 566d71a35ef0..906ddb06fb17 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct HasOnlyReadOnly: Codable { - +public struct HasOnlyReadOnly: Codable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 80cecab242f2..fe13d302ccbf 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,9 +7,7 @@ import Foundation - -public struct List: Codable { - +public struct List: Codable { public var _123list: String? @@ -17,7 +15,7 @@ public struct List: Codable { self._123list = _123list } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _123list = "123-list" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index f0c02de95f7a..4b6037f378ee 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,27 +7,25 @@ import Foundation - -public struct MapTest: Codable { - +public struct MapTest: Codable { public enum MapOfEnumString: String, Codable, CaseIterable { case upper = "UPPER" case lower = "lower" } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + public var mapMapOfString: [String: [String: String]]? + public var mapOfEnumString: [String: String]? + public var directMap: [String: Bool]? public var indirectMap: StringBooleanMap? - public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) { + public init(mapMapOfString: [String: [String: String]]?, mapOfEnumString: [String: String]?, directMap: [String: Bool]?, indirectMap: StringBooleanMap?) { self.mapMapOfString = mapMapOfString self.mapOfEnumString = mapOfEnumString self.directMap = directMap self.indirectMap = indirectMap } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case mapMapOfString = "map_map_of_string" case mapOfEnumString = "map_of_enum_string" case directMap = "direct_map" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 710e62a9b587..c3deb2f28932 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,15 +7,13 @@ import Foundation - -public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - +public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, map: [String:Animal]?) { + public init(uuid: UUID?, dateTime: Date?, map: [String: Animal]?) { self.uuid = uuid self.dateTime = dateTime self.map = map diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 450a53b918ca..b61db7d6e716 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Codable { - +public struct Model200Response: Codable { public var name: Int? public var _class: String? @@ -19,7 +18,7 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case _class = "class" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index 6deb69fcd731..8ab4db44b73a 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Codable { - +public struct Name: Codable { public var name: Int public var snakeCase: Int? @@ -23,7 +22,7 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case name case snakeCase = "snake_case" case property diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 0c9ee2b7b9f4..4d1dafcc2c1f 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,9 +7,7 @@ import Foundation - -public struct NumberOnly: Codable { - +public struct NumberOnly: Codable { public var justNumber: Double? @@ -17,7 +15,7 @@ public struct NumberOnly: Codable { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case justNumber = "JustNumber" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index ab0eac0b304e..40c30cc8609c 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Order: Codable { - +public struct Order: Codable { public enum Status: String, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 4a7d22710441..18c3a024f122 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,9 +7,7 @@ import Foundation - -public struct OuterComposite: Codable { - +public struct OuterComposite: Codable { public var myNumber: Double? public var myString: String? @@ -21,7 +19,7 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index 9e6b8d74e874..c3b778cbbed4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,7 +7,6 @@ import Foundation - public enum OuterEnum: String, Codable, CaseIterable { case placed = "placed" case approved = "approved" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index a973071d6c96..b9ce0e933256 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Pet: Codable { - +public struct Pet: Codable { public enum Status: String, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index b2a6b7e2b8a6..0acd21fd1000 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,9 +7,7 @@ import Foundation - -public struct ReadOnlyFirst: Codable { - +public struct ReadOnlyFirst: Codable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 7e089dcee2b4..c223f993a69e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,8 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Codable { - +public struct Return: Codable { public var _return: Int? @@ -17,7 +16,7 @@ public struct Return: Codable { self._return = _return } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case _return = "return" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index e890ef952520..6e8650f76d8e 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,9 +7,7 @@ import Foundation - -public struct SpecialModelName: Codable { - +public struct SpecialModelName: Codable { public var specialPropertyName: Int64? @@ -17,7 +15,7 @@ public struct SpecialModelName: Codable { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case specialPropertyName = "$special[property.name]" } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index f65ae0623d6e..3f1237fee477 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,9 @@ import Foundation +public struct StringBooleanMap: Codable { -public struct StringBooleanMap: Codable { - - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -45,5 +42,4 @@ public struct StringBooleanMap: Codable { additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index a91b6061bcf7..4dd8a9a9f5a0 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,9 +7,7 @@ import Foundation - -public struct Tag: Codable { - +public struct Tag: Codable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 2d377c3edb02..a9e088808ed3 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderDefault: Codable { - +public struct TypeHolderDefault: Codable { public var stringItem: String = "what" public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderDefault: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index e5eb92da696e..dff4083ae432 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,9 +7,7 @@ import Foundation - -public struct TypeHolderExample: Codable { - +public struct TypeHolderExample: Codable { public var stringItem: String public var numberItem: Double @@ -25,7 +23,7 @@ public struct TypeHolderExample: Codable { self.arrayItem = arrayItem } - public enum CodingKeys: String, CodingKey, CaseIterable { + public enum CodingKeys: String, CodingKey, CaseIterable { case stringItem = "string_item" case numberItem = "number_item" case integerItem = "integer_item" diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift index f70328ca9e59..79f271ed7356 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,9 +7,7 @@ import Foundation - -public struct User: Codable { - +public struct User: Codable { public var id: Int64? public var username: String? 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 b31b84b50079..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -14,7 +14,7 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { return URLSessionRequestBuilder<T>.self } - func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type { + func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type { return URLSessionDecodableRequestBuilder<T>.self } } @@ -23,18 +23,18 @@ class URLSessionRequestBuilderFactory: RequestBuilderFactory { private var urlSessionStore = SynchronizedDictionary<String, URLSession>() open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - + let progress = Progress() - + private var observation: NSKeyValueObservation? - + deinit { observation?.invalidate() } - + // swiftlint:disable:next weak_delegate fileprivate let sessionDelegate = SessionDelegate() - + /** May be assigned if you want to control the authentication challenges. */ @@ -47,11 +47,11 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { - retry the request. */ public var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)? - - required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { + + required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) } - + /** May be overridden by a subclass if you want to control the URLSession configuration. @@ -79,40 +79,40 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { May be overridden by a subclass if you want to control the URLRequest configuration (e.g. to override the cache policy). */ - open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) throws -> URLRequest { - + open func createURLRequest(urlSession: URLSession, method: HTTPMethod, encoding: ParameterEncoding, headers: [String: String]) throws -> URLRequest { + guard let url = URL(string: URLString) else { throw DownloadException.requestMissingURL } - + var originalRequest = URLRequest(url: url) - + originalRequest.httpMethod = method.rawValue - + buildHeaders().forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + headers.forEach { key, value in originalRequest.setValue(value, forHTTPHeaderField: key) } - + let modifiedRequest = try encoding.encode(originalRequest, with: parameters) - + return modifiedRequest } override open func execute(_ apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { - let urlSessionId:String = UUID().uuidString + let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() urlSessionStore[urlSessionId] = urlSession - + let parameters: [String: Any] = self.parameters ?? [:] - + let fileKeys = parameters.filter { $1 is URL } .map { $0.0 } - + let encoding: ParameterEncoding if fileKeys.count > 0 { encoding = FileUploadEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) @@ -121,29 +121,29 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } else { encoding = URLEncoding() } - + guard let xMethod = HTTPMethod(rawValue: method) else { fatalError("Unsuported Http method - \(method)") } - + let cleanupRequest = { urlSessionStore[urlSessionId] = nil self.observation?.invalidate() } - + 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 } - + if let taskCompletionShouldRetry = self.taskCompletionShouldRetry { - + taskCompletionShouldRetry(data, response, error) { [weak self] shouldRetry in - + guard let self = self else { return } - + if shouldRetry { cleanupRequest() self.execute(apiResponseQueue, completion) @@ -159,18 +159,18 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } } - + if #available(iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0, *) { observation = dataTask.progress.observe(\.fractionCompleted) { newProgress, _ in self.progress.totalUnitCount = newProgress.totalUnitCount self.progress.completedUnitCount = newProgress.completedUnitCount } - + onProgressReady?(progress) } - + dataTask.resume() - + } catch { apiResponseQueue.async { cleanupRequest() @@ -179,7 +179,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } } - + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -199,52 +199,52 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is URL.Type: do { - + guard error == nil else { throw DownloadException.responseFailed } - + guard let data = data else { throw DownloadException.responseDataMissing } - + let fileManager = FileManager.default let documentsDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0] let requestURL = try self.getURL(from: urlRequest) - + var requestPath = try self.getPath(from: requestURL) - + if let headerFileName = self.getFileName(fromContentDisposition: httpResponse.allHeaderFields["Content-Disposition"] as? String) { requestPath = requestPath.appending("/\(headerFileName)") } - + let filePath = documentsDirectory.appendingPathComponent(requestPath) let directoryPath = filePath.deletingLastPathComponent().path - + try fileManager.createDirectory(atPath: directoryPath, withIntermediateDirectories: true, attributes: nil) try data.write(to: filePath, options: .atomic) - + completion(.success(Response(response: httpResponse, body: filePath as? T))) - + } catch let requestParserError as DownloadException { completion(.failure(ErrorResponse.error(400, data, requestParserError))) } catch let error { completion(.failure(ErrorResponse.error(400, data, error))) } - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + default: - + completion(.success(Response(response: httpResponse, body: data as? T))) } @@ -258,7 +258,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil @@ -277,7 +277,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } @@ -286,7 +286,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getPath(from url : URL) throws -> String { + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath @@ -300,7 +300,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL @@ -311,7 +311,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } -open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuilder<T> { +open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { @@ -331,28 +331,28 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil switch T.self { case is String.Type: - + let body = data.flatMap { String(data: $0, encoding: .utf8) } ?? "" - + completion(.success(Response<T>(response: httpResponse, body: body as? T))) - + case is Void.Type: - + completion(.success(Response(response: httpResponse, body: nil))) - + case is Data.Type: - + completion(.success(Response(response: httpResponse, body: data as? T))) - + default: - + guard let data = data, !data.isEmpty else { completion(.failure(ErrorResponse.error(httpResponse.statusCode, nil, DecodableRequestBuilderError.emptyDataResponse))) return } - + let decodeResult = CodableHelper.decode(T.self, from: data) - + switch decodeResult { case let .success(decodableObj): completion(.success(Response(response: httpResponse, body: decodableObj))) @@ -363,10 +363,10 @@ open class URLSessionDecodableRequestBuilder<T:Decodable>: URLSessionRequestBuil } } -fileprivate class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { - +private class SessionDelegate: NSObject, URLSessionDelegate, URLSessionDataDelegate { + var credential: URLCredential? - + var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { @@ -409,13 +409,13 @@ public protocol ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest } -fileprivate class URLEncoding: ParameterEncoding { - func encode(_ urlRequest: URLRequest, with parameters: [String : Any]?) throws -> URLRequest { - +private class URLEncoding: ParameterEncoding { + func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { + var urlRequest = urlRequest - + guard let parameters = parameters else { return urlRequest } - + guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } @@ -424,12 +424,12 @@ fileprivate class URLEncoding: ParameterEncoding { urlComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters) urlRequest.url = urlComponents.url } - + return urlRequest } } -fileprivate class FileUploadEncoding: ParameterEncoding { +private class FileUploadEncoding: ParameterEncoding { let contentTypeForFormPart: (_ fileURL: URL) -> String? @@ -440,13 +440,13 @@ fileprivate class FileUploadEncoding: ParameterEncoding { func encode(_ urlRequest: URLRequest, with parameters: [String: Any]?) throws -> URLRequest { var urlRequest = urlRequest - + guard let parameters = parameters, !parameters.isEmpty else { return urlRequest } - + let boundary = "Boundary-\(UUID().uuidString)" - + urlRequest.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") for (key, value) in parameters { @@ -486,7 +486,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { fatalError("Unprocessable value \(value) with key \(key)") } } - + var body = urlRequest.httpBody.orEmpty body.append("\r\n--\(boundary)--\r\n") @@ -501,7 +501,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { var urlRequest = urlRequest var body = urlRequest.httpBody.orEmpty - + let fileData = try Data(contentsOf: fileURL) let mimetype = self.contentTypeForFormPart(fileURL) ?? mimeType(for: fileURL) @@ -509,7 +509,7 @@ fileprivate class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } @@ -525,20 +525,20 @@ fileprivate class FileUploadEncoding: ParameterEncoding { // The value data. body.append(fileData) - + urlRequest.httpBody = body return urlRequest } - + private func configureDataUploadRequest(urlRequest: URLRequest, boundary: String, name: String, data: Data) -> URLRequest { var urlRequest = urlRequest - + var body = urlRequest.httpBody.orEmpty // If we already added something then we need an additional newline. - if (body.count > 0) { + if body.count > 0 { body.append("\r\n") } 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 ae2e1d0b86ea..ab4d3a4a6c76 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body 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 a31860adfdeb..7b74d0884aeb 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body diff --git a/samples/client/test/swift5/default/README.md b/samples/client/test/swift5/default/README.md index 76c19ec12ca0..bb57a7ddf5d1 100644 --- a/samples/client/test/swift5/default/README.md +++ b/samples/client/test/swift5/default/README.md @@ -3,7 +3,7 @@ This is a test schema which exercises Swagger schema features for testing the swift5 language codegen module. ## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec from a remote server, you can easily generate an API client. +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - API version: 1.0 - Package version: diff --git a/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIs.swift b/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIs.swift index 359d938d4534..d2c1afbb9bc0 100644 --- a/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/APIs.swift @@ -43,7 +43,7 @@ open class RequestBuilder<T> { } } - open func execute(_ apiResponseQueue: DispatchQueue = TestClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { } + open func execute(_ apiResponseQueue: DispatchQueue = TestClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { } public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { diff --git a/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/CodableHelper.swift index 32e194f6ee12..ef971ebadc60 100644 --- a/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/CodableHelper.swift @@ -38,11 +38,11 @@ open class CodableHelper { set { self.customJSONEncoder = newValue } } - open class func decode<T>(_ type: T.Type, from data: Data) -> Result<T, Error> where T: Decodable { - return Result { try self.jsonDecoder.decode(type, from: data) } + open class func decode<T>(_ type: T.Type, from data: Data) -> Swift.Result<T, Error> where T: Decodable { + return Swift.Result { try self.jsonDecoder.decode(type, from: data) } } - open class func encode<T>(_ value: T) -> Result<Data, Error> where T: Encodable { - return Result { try self.jsonEncoder.encode(value) } + open class func encode<T>(_ value: T) -> Swift.Result<Data, Error> where T: Encodable { + return Swift.Result { try self.jsonEncoder.encode(value) } } } diff --git a/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/URLSessionImplementations.swift index 7cf1df17fb79..3018e3695f9d 100644 --- a/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/test/swift5/default/TestClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -102,7 +102,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { return modifiedRequest } - override open func execute(_ apiResponseQueue: DispatchQueue = TestClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override open func execute(_ apiResponseQueue: DispatchQueue = TestClientAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { let urlSessionId: String = UUID().uuidString // Create a new manager for each request to customize its request header let urlSession = createURLSession() @@ -180,7 +180,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } - fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -312,7 +312,7 @@ open class URLSessionRequestBuilder<T>: RequestBuilder<T> { } open class URLSessionDecodableRequestBuilder<T: Decodable>: URLSessionRequestBuilder<T> { - override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Result<Response<T>, Error>) -> Void) { + override fileprivate func processRequestResponse(urlRequest: URLRequest, data: Data?, response: URLResponse?, error: Error?, completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { if let error = error { completion(.failure(ErrorResponse.error(-1, data, error))) @@ -489,7 +489,7 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty - body.append("--\(boundary)--") + body.append("\r\n--\(boundary)--\r\n") urlRequest.httpBody = body @@ -508,14 +508,23 @@ private class FileUploadEncoding: ParameterEncoding { let fileName = fileURL.lastPathComponent + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n\r\n") - body.append("Content-Type: \(mimetype)\r\n\r\n") + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(fileName)\"\r\n") + body.append("Content-Type: \(mimetype)\r\n") - body.append(fileData) + // Separate headers and body. + body.append("\r\n") - body.append("\r\n\r\n") + // The value data. + body.append(fileData) urlRequest.httpBody = body @@ -528,12 +537,22 @@ private class FileUploadEncoding: ParameterEncoding { var body = urlRequest.httpBody.orEmpty + // If we already added something then we need an additional newline. + if body.count > 0 { + body.append("\r\n") + } + + // Value boundary. body.append("--\(boundary)\r\n") - body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n\r\n") - body.append(data) + // Value headers. + body.append("Content-Disposition: form-data; name=\"\(name)\"\r\n") - body.append("\r\n\r\n") + // Separate headers and body. + body.append("\r\n") + + // The value data. + body.append(data) urlRequest.httpBody = body diff --git a/samples/client/test/swift5/default/docs/SampleSubClass.md b/samples/client/test/swift5/default/docs/SampleSubClass.md index d32058a5b2c4..435633ccde1c 100644 --- a/samples/client/test/swift5/default/docs/SampleSubClass.md +++ b/samples/client/test/swift5/default/docs/SampleSubClass.md @@ -3,6 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**baseClassStringProp** | **String** | | [optional] +**baseClassIntegerProp** | **Int** | | [optional] **subClassStringProp** | **String** | | [optional] **subClassIntegerProp** | **Int** | | [optional] From bc097cfddef9d7a4bfcd265d2da255328127a40b Mon Sep 17 00:00:00 2001 From: Geoff Brown <gbrown@centeredgesoftware.com> Date: Wed, 29 Apr 2020 09:36:27 -0400 Subject: [PATCH 35/78] [C#] Fixed valuetype parameters and discriminator deserialization (#5680) * Fixed valuetype parameters and discriminator deserialization - Made non-required valuetypes nullable, and flagged required valuetypes as "x-csharp-value-type" - Made sure to camelCase discriminator property names in Subtype converter * Ran pet store sample script * Ensure that readWriteVars and readOnlyVars are also marked as isEnum and isPrimitiveType where appropriate * Updated petstore sample with enum fix * Fields that are required should emit default values (otherwise the consuming API might throw a fit * Added missing sample updated * Re-ran petstore example script to grab all changes * Rebased and re-ran example update script * update csharp samples Co-authored-by: William Cheng <wing328hk@gmail.com> --- .../languages/AbstractCSharpCodegen.java | 26 ++++++ .../languages/CSharpClientCodegen.java | 12 +++ .../resources/csharp/modelGeneric.mustache | 6 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 2 +- .../csharp/OpenAPIClient/docs/FakeApi.md | 62 +++++++------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 80 +++++++++--------- .../src/Org.OpenAPITools/Model/Animal.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 4 +- .../Model/TypeHolderDefault.cs | 10 +-- .../Model/TypeHolderExample.cs | 12 +-- .../csharp/OpenAPIClientNet35/docs/FakeApi.md | 62 +++++++------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 40 ++++----- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 - .../src/Org.OpenAPITools/Model/Animal.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 4 +- .../Model/TypeHolderDefault.cs | 10 +-- .../Model/TypeHolderExample.cs | 12 +-- .../csharp/OpenAPIClientNet40/docs/FakeApi.md | 62 +++++++------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 40 ++++----- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 - .../src/Org.OpenAPITools/Model/Animal.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 24 ++---- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 4 +- .../Model/TypeHolderDefault.cs | 10 +-- .../Model/TypeHolderExample.cs | 12 +-- .../docs/FakeApi.md | 62 +++++++------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 80 +++++++++--------- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 - .../src/Org.OpenAPITools/Model/Animal.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 4 +- .../Model/TypeHolderDefault.cs | 10 +-- .../Model/TypeHolderExample.cs | 12 +-- .../OpenAPIClientNetStandard/docs/FakeApi.md | 62 +++++++------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 82 +++++++++---------- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 - .../src/Org.OpenAPITools/Model/Animal.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 4 +- .../Model/TypeHolderDefault.cs | 10 +-- .../Model/TypeHolderExample.cs | 12 +-- .../docs/FakeApi.md | 62 +++++++------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 82 +++++++++---------- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 - .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 16 +--- 65 files changed, 550 insertions(+), 545 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 2a0b97066b49..a3411f68a2a4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -470,6 +470,32 @@ private void postProcessEnumRefs(final Map<String, Object> models) { var.isPrimitiveType = true; } } + for (CodegenProperty var : model.readWriteVars) { + if (enumRefs.containsKey(var.dataType)) { + // Handle any enum properties referred to by $ref. + // This is different in C# than most other generators, because enums in C# are compiled to integral types, + // while enums in many other languages are true objects. + CodegenModel refModel = enumRefs.get(var.dataType); + var.allowableValues = refModel.allowableValues; + var.isEnum = true; + + // We do these after updateCodegenPropertyEnum to avoid generalities that don't mesh with C#. + var.isPrimitiveType = true; + } + } + for (CodegenProperty var : model.readOnlyVars) { + if (enumRefs.containsKey(var.dataType)) { + // Handle any enum properties referred to by $ref. + // This is different in C# than most other generators, because enums in C# are compiled to integral types, + // while enums in many other languages are true objects. + CodegenModel refModel = enumRefs.get(var.dataType); + var.allowableValues = refModel.allowableValues; + var.isEnum = true; + + // We do these after updateCodegenPropertyEnum to avoid generalities that don't mesh with C#. + var.isPrimitiveType = true; + } + } // We're looping all models here. if (model.isEnum) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index 6c2dcc7a714f..a12d712c3ffa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -661,6 +661,14 @@ public void postProcessParameter(CodegenParameter parameter) { postProcessPattern(parameter.pattern, parameter.vendorExtensions); postProcessEmitDefaultValue(parameter.vendorExtensions); super.postProcessParameter(parameter); + + if (nullableType.contains(parameter.dataType)) { + if (!parameter.required) { //optional + parameter.dataType = parameter.dataType + "?"; + } else { + parameter.vendorExtensions.put("x-csharp-value-type", true); + } + } } @Override @@ -668,6 +676,10 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert postProcessPattern(property.pattern, property.vendorExtensions); postProcessEmitDefaultValue(property.vendorExtensions); super.postProcessModelProperty(model, property); + + if (!property.isContainer && (nullableType.contains(property.dataType) || property.isEnum)) { + property.vendorExtensions.put("x-csharp-value-type", true); + } } /* diff --git a/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache index 6a9be0147f81..65422c10c4de 100644 --- a/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache @@ -3,7 +3,7 @@ /// </summary> [DataContract] {{#discriminator}} - [JsonConverter(typeof(JsonSubtypes), "{{{discriminatorName}}}")]{{#children}} + [JsonConverter(typeof(JsonSubtypes), "{{#lambda.camelcase_param}}{{{discriminatorName}}}{{/lambda.camelcase_param}}")]{{#children}} [JsonSubtypes.KnownSubType(typeof({{classname}}), "{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}")]{{/children}} {{/discriminator}} {{#generatePropertyChanged}} @@ -31,7 +31,7 @@ {{#description}} /// <value>{{description}}</value> {{/description}} - [DataMember(Name="{{baseName}}", EmitDefaultValue={{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/vendorExtensions.x-emit-default-value}})] + [DataMember(Name="{{baseName}}", EmitDefaultValue={{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#required}}true{{/required}}{{^required}}false{{/required}}{{/isNullable}}{{/vendorExtensions.x-emit-default-value}})] public {{#complexType}}{{{complexType}}}{{/complexType}}{{^complexType}}{{{datatypeWithEnum}}}{{/complexType}}{{^isContainer}}{{^required}}?{{/required}}{{/isContainer}} {{name}} { get; set; } {{/isEnum}} {{/vars}} @@ -108,7 +108,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} /// </summary>{{#description}} /// <value>{{description}}</value>{{/description}} - [DataMember(Name="{{baseName}}", EmitDefaultValue={{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/vendorExtensions.x-emit-default-value}})]{{#isDate}} + [DataMember(Name="{{baseName}}", EmitDefaultValue={{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#required}}true{{/required}}{{^required}}false{{/required}}{{/isNullable}}{{/vendorExtensions.x-emit-default-value}})]{{#isDate}} [JsonConverter(typeof(OpenAPIDateConverter))]{{/isDate}} public {{{dataType}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; } {{/isEnum}} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs index 595a92331504..eb028bacfb5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs @@ -159,7 +159,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { this.EnumStringRequired = enumStringRequired; this.EnumString = enumString; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs index 595a92331504..eb028bacfb5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -159,7 +159,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { this.EnumStringRequired = enumStringRequired; this.EnumString = enumString; diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md index edffb58d3c79..661c2cba6ab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md @@ -97,7 +97,7 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize (bool body = null) +> bool FakeOuterBooleanSerialize (bool? body = null) @@ -120,7 +120,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = true; // bool | Input boolean as post body (optional) + var body = true; // bool? | Input boolean as post body (optional) try { @@ -143,7 +143,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool?**| Input boolean as post body | [optional] ### Return type @@ -245,7 +245,7 @@ No authorization required ## FakeOuterNumberSerialize -> decimal FakeOuterNumberSerialize (decimal body = null) +> decimal FakeOuterNumberSerialize (decimal? body = null) @@ -268,7 +268,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = 8.14; // decimal | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { @@ -291,7 +291,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **decimal**| Input number as post body | [optional] + **body** | **decimal?**| Input number as post body | [optional] ### Return type @@ -614,7 +614,7 @@ No authorization required ## TestEndpointParameters -> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = null, int int32 = null, long int64 = null, float _float = null, string _string = null, System.IO.Stream binary = null, DateTime date = null, DateTime dateTime = null, string password = null, string callback = null) +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -645,14 +645,14 @@ namespace Example var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None - var integer = 56; // int | None (optional) - var int32 = 56; // int | None (optional) - var int64 = 789; // long | None (optional) - var _float = 3.4F; // float | None (optional) + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) - var date = 2013-10-20; // DateTime | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) var password = password_example; // string | None (optional) var callback = callback_example; // string | None (optional) @@ -681,14 +681,14 @@ Name | Type | Description | Notes **_double** | **double**| None | **patternWithoutDelimiter** | **string**| None | **_byte** | **byte[]**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **long**| None | [optional] - **_float** | **float**| None | [optional] + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] **_string** | **string**| None | [optional] **binary** | **System.IO.Stream**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] **password** | **string**| None | [optional] **callback** | **string**| None | [optional] @@ -719,7 +719,7 @@ void (empty response body) ## TestEnumParameters -> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int enumQueryInteger = null, double enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) +> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) To test enum parameters @@ -746,8 +746,8 @@ namespace Example var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) @@ -776,8 +776,8 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] @@ -808,7 +808,7 @@ No authorization required ## TestGroupParameters -> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = null, bool booleanGroup = null, long int64Group = null) +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) Fake endpoint to test group parameters (optional) @@ -834,9 +834,9 @@ namespace Example var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters - var stringGroup = 56; // int | String in group parameters (optional) - var booleanGroup = true; // bool | Boolean in group parameters (optional) - var int64Group = 789; // long | Integer in group parameters (optional) + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) try { @@ -862,9 +862,9 @@ Name | Type | Description | Notes **requiredStringGroup** | **int**| Required String in group parameters | **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | **requiredInt64Group** | **long**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **long**| Integer in group parameters | [optional] + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs index e7f144292bb9..d739d62f0a98 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -54,7 +54,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - bool FakeOuterBooleanSerialize (bool body = default(bool)); + bool FakeOuterBooleanSerialize (bool? body = default(bool?)); /// <summary> /// @@ -65,7 +65,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)); + ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -96,7 +96,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - decimal FakeOuterNumberSerialize (decimal body = default(decimal)); + decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)); /// <summary> /// @@ -107,7 +107,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)); + ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -216,7 +216,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -240,7 +240,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -257,7 +257,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -275,7 +275,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -290,7 +290,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -306,7 +306,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -412,7 +412,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)); + System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)); /// <summary> /// @@ -423,7 +423,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)); + System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -454,7 +454,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)); + System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)); /// <summary> /// @@ -465,7 +465,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)); + System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -574,7 +574,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -598,7 +598,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -615,7 +615,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -633,7 +633,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -648,7 +648,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -664,7 +664,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -1010,7 +1010,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - public bool FakeOuterBooleanSerialize (bool body = default(bool)) + public bool FakeOuterBooleanSerialize (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1022,7 +1022,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)) + public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "/fake/outer/boolean"; @@ -1080,7 +1080,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)) + public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1093,7 +1093,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)) + public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "/fake/outer/boolean"; @@ -1292,7 +1292,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - public decimal FakeOuterNumberSerialize (decimal body = default(decimal)) + public decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1304,7 +1304,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)) + public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "/fake/outer/number"; @@ -1362,7 +1362,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1375,7 +1375,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "/fake/outer/number"; @@ -2038,7 +2038,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -2062,7 +2062,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2157,7 +2157,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { await TestEndpointParametersAsyncWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); @@ -2182,7 +2182,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2271,7 +2271,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -2289,7 +2289,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "/fake"; @@ -2354,7 +2354,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { await TestEnumParametersAsyncWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); @@ -2373,7 +2373,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "/fake"; @@ -2436,7 +2436,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } @@ -2452,7 +2452,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) @@ -2521,7 +2521,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { await TestGroupParametersAsyncWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); @@ -2538,7 +2538,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs index eb9b58f20753..f3c0d8a79e8c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs @@ -29,7 +29,7 @@ namespace Org.OpenAPITools.Model /// Animal /// </summary> [DataContract] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonConverter(typeof(JsonSubtypes), "className")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")] @@ -71,7 +71,7 @@ protected Animal() { } /// <summary> /// Gets or Sets ClassName /// </summary> - [DataMember(Name="className", EmitDefaultValue=false)] + [DataMember(Name="className", EmitDefaultValue=true)] public string ClassName { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs index 9cf54d7ea340..2901d8bf67c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Category.cs @@ -64,7 +64,7 @@ protected Category() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs index 48a0f2fa0844..fe1b1e00aa1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/EnumTest.cs @@ -90,7 +90,7 @@ public enum EnumStringRequiredEnum /// <summary> /// Gets or Sets EnumStringRequired /// </summary> - [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + [DataMember(Name="enum_string_required", EmitDefaultValue=true)] public EnumStringRequiredEnum EnumStringRequired { get; set; } /// <summary> /// Defines EnumInteger @@ -157,7 +157,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { // to ensure "enumStringRequired" is required (not null) if (enumStringRequired == null) diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs index eedd4b6236e1..0346d447e435 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -127,7 +127,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Number /// </summary> - [DataMember(Name="number", EmitDefaultValue=false)] + [DataMember(Name="number", EmitDefaultValue=true)] public decimal Number { get; set; } /// <summary> @@ -151,7 +151,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Byte /// </summary> - [DataMember(Name="byte", EmitDefaultValue=false)] + [DataMember(Name="byte", EmitDefaultValue=true)] public byte[] Byte { get; set; } /// <summary> @@ -163,7 +163,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Date /// </summary> - [DataMember(Name="date", EmitDefaultValue=false)] + [DataMember(Name="date", EmitDefaultValue=true)] [JsonConverter(typeof(OpenAPIDateConverter))] public DateTime Date { get; set; } @@ -182,7 +182,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Password /// </summary> - [DataMember(Name="password", EmitDefaultValue=false)] + [DataMember(Name="password", EmitDefaultValue=true)] public string Password { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Name.cs index 2c76d68a122b..c22d454e1ea4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Name.cs @@ -58,7 +58,7 @@ protected Name() { } /// <summary> /// Gets or Sets _Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public int _Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Pet.cs index 4616c0230970..681dccedc28d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Pet.cs @@ -120,13 +120,13 @@ protected Pet() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> /// Gets or Sets PhotoUrls /// </summary> - [DataMember(Name="photoUrls", EmitDefaultValue=false)] + [DataMember(Name="photoUrls", EmitDefaultValue=true)] public List<string> PhotoUrls { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderDefault.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderDefault.cs index 5cce95ad3a0d..dbcea03c41ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderDefault.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderDefault.cs @@ -100,31 +100,31 @@ protected TypeHolderDefault() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderExample.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderExample.cs index f72c763b0397..0a71dbe00b87 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderExample.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/TypeHolderExample.cs @@ -111,37 +111,37 @@ protected TypeHolderExample() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets FloatItem /// </summary> - [DataMember(Name="float_item", EmitDefaultValue=false)] + [DataMember(Name="float_item", EmitDefaultValue=true)] public float FloatItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md index edffb58d3c79..661c2cba6ab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md @@ -97,7 +97,7 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize (bool body = null) +> bool FakeOuterBooleanSerialize (bool? body = null) @@ -120,7 +120,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = true; // bool | Input boolean as post body (optional) + var body = true; // bool? | Input boolean as post body (optional) try { @@ -143,7 +143,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool?**| Input boolean as post body | [optional] ### Return type @@ -245,7 +245,7 @@ No authorization required ## FakeOuterNumberSerialize -> decimal FakeOuterNumberSerialize (decimal body = null) +> decimal FakeOuterNumberSerialize (decimal? body = null) @@ -268,7 +268,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = 8.14; // decimal | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { @@ -291,7 +291,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **decimal**| Input number as post body | [optional] + **body** | **decimal?**| Input number as post body | [optional] ### Return type @@ -614,7 +614,7 @@ No authorization required ## TestEndpointParameters -> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = null, int int32 = null, long int64 = null, float _float = null, string _string = null, System.IO.Stream binary = null, DateTime date = null, DateTime dateTime = null, string password = null, string callback = null) +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -645,14 +645,14 @@ namespace Example var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None - var integer = 56; // int | None (optional) - var int32 = 56; // int | None (optional) - var int64 = 789; // long | None (optional) - var _float = 3.4F; // float | None (optional) + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) - var date = 2013-10-20; // DateTime | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) var password = password_example; // string | None (optional) var callback = callback_example; // string | None (optional) @@ -681,14 +681,14 @@ Name | Type | Description | Notes **_double** | **double**| None | **patternWithoutDelimiter** | **string**| None | **_byte** | **byte[]**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **long**| None | [optional] - **_float** | **float**| None | [optional] + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] **_string** | **string**| None | [optional] **binary** | **System.IO.Stream**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] **password** | **string**| None | [optional] **callback** | **string**| None | [optional] @@ -719,7 +719,7 @@ void (empty response body) ## TestEnumParameters -> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int enumQueryInteger = null, double enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) +> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) To test enum parameters @@ -746,8 +746,8 @@ namespace Example var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) @@ -776,8 +776,8 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] @@ -808,7 +808,7 @@ No authorization required ## TestGroupParameters -> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = null, bool booleanGroup = null, long int64Group = null) +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) Fake endpoint to test group parameters (optional) @@ -834,9 +834,9 @@ namespace Example var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters - var stringGroup = 56; // int | String in group parameters (optional) - var booleanGroup = true; // bool | Boolean in group parameters (optional) - var int64Group = 789; // long | Integer in group parameters (optional) + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) try { @@ -862,9 +862,9 @@ Name | Type | Description | Notes **requiredStringGroup** | **int**| Required String in group parameters | **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | **requiredInt64Group** | **long**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **long**| Integer in group parameters | [optional] + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs index c933df3c19e2..d2255161537d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs @@ -54,7 +54,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - bool FakeOuterBooleanSerialize (bool body = default(bool)); + bool FakeOuterBooleanSerialize (bool? body = default(bool?)); /// <summary> /// @@ -65,7 +65,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)); + ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -96,7 +96,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - decimal FakeOuterNumberSerialize (decimal body = default(decimal)); + decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)); /// <summary> /// @@ -107,7 +107,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)); + ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -216,7 +216,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -240,7 +240,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -257,7 +257,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -275,7 +275,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -290,7 +290,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -306,7 +306,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -574,7 +574,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - public bool FakeOuterBooleanSerialize (bool body = default(bool)) + public bool FakeOuterBooleanSerialize (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -586,7 +586,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)) + public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "/fake/outer/boolean"; @@ -714,7 +714,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - public decimal FakeOuterNumberSerialize (decimal body = default(decimal)) + public decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -726,7 +726,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)) + public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "/fake/outer/number"; @@ -1091,7 +1091,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -1115,7 +1115,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -1204,7 +1204,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -1222,7 +1222,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "/fake"; @@ -1285,7 +1285,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } @@ -1301,7 +1301,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs index 8c65f55887b8..0d0e5fad12f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs @@ -473,7 +473,6 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> - /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Animal.cs index 464ee255eb9a..7a099f21b4a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Animal.cs @@ -29,7 +29,7 @@ namespace Org.OpenAPITools.Model /// Animal /// </summary> [DataContract] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonConverter(typeof(JsonSubtypes), "className")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")] @@ -71,7 +71,7 @@ protected Animal() { } /// <summary> /// Gets or Sets ClassName /// </summary> - [DataMember(Name="className", EmitDefaultValue=false)] + [DataMember(Name="className", EmitDefaultValue=true)] public string ClassName { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs index 34612d86007b..4261e7767d38 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Category.cs @@ -64,7 +64,7 @@ protected Category() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs index 824b6d85716e..fb86bb0c298c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs @@ -90,7 +90,7 @@ public enum EnumStringRequiredEnum /// <summary> /// Gets or Sets EnumStringRequired /// </summary> - [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + [DataMember(Name="enum_string_required", EmitDefaultValue=true)] public EnumStringRequiredEnum EnumStringRequired { get; set; } /// <summary> /// Defines EnumInteger @@ -157,7 +157,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { // to ensure "enumStringRequired" is required (not null) if (enumStringRequired == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FormatTest.cs index 018c10fb6061..13dc6109e349 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FormatTest.cs @@ -127,7 +127,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Number /// </summary> - [DataMember(Name="number", EmitDefaultValue=false)] + [DataMember(Name="number", EmitDefaultValue=true)] public decimal Number { get; set; } /// <summary> @@ -151,7 +151,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Byte /// </summary> - [DataMember(Name="byte", EmitDefaultValue=false)] + [DataMember(Name="byte", EmitDefaultValue=true)] public byte[] Byte { get; set; } /// <summary> @@ -163,7 +163,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Date /// </summary> - [DataMember(Name="date", EmitDefaultValue=false)] + [DataMember(Name="date", EmitDefaultValue=true)] [JsonConverter(typeof(OpenAPIDateConverter))] public DateTime Date { get; set; } @@ -182,7 +182,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Password /// </summary> - [DataMember(Name="password", EmitDefaultValue=false)] + [DataMember(Name="password", EmitDefaultValue=true)] public string Password { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Name.cs index 948ed5889cc5..c9040b4538e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Name.cs @@ -58,7 +58,7 @@ protected Name() { } /// <summary> /// Gets or Sets _Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public int _Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs index c9994c453aa4..2329c8b0690e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs @@ -120,13 +120,13 @@ protected Pet() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> /// Gets or Sets PhotoUrls /// </summary> - [DataMember(Name="photoUrls", EmitDefaultValue=false)] + [DataMember(Name="photoUrls", EmitDefaultValue=true)] public List<string> PhotoUrls { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderDefault.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderDefault.cs index 00789fba4d72..0e02333a151d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderDefault.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderDefault.cs @@ -100,31 +100,31 @@ protected TypeHolderDefault() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderExample.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderExample.cs index 086e142bed6b..ef1da190a1c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderExample.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/TypeHolderExample.cs @@ -111,37 +111,37 @@ protected TypeHolderExample() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets FloatItem /// </summary> - [DataMember(Name="float_item", EmitDefaultValue=false)] + [DataMember(Name="float_item", EmitDefaultValue=true)] public float FloatItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md index edffb58d3c79..661c2cba6ab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md @@ -97,7 +97,7 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize (bool body = null) +> bool FakeOuterBooleanSerialize (bool? body = null) @@ -120,7 +120,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = true; // bool | Input boolean as post body (optional) + var body = true; // bool? | Input boolean as post body (optional) try { @@ -143,7 +143,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool?**| Input boolean as post body | [optional] ### Return type @@ -245,7 +245,7 @@ No authorization required ## FakeOuterNumberSerialize -> decimal FakeOuterNumberSerialize (decimal body = null) +> decimal FakeOuterNumberSerialize (decimal? body = null) @@ -268,7 +268,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = 8.14; // decimal | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { @@ -291,7 +291,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **decimal**| Input number as post body | [optional] + **body** | **decimal?**| Input number as post body | [optional] ### Return type @@ -614,7 +614,7 @@ No authorization required ## TestEndpointParameters -> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = null, int int32 = null, long int64 = null, float _float = null, string _string = null, System.IO.Stream binary = null, DateTime date = null, DateTime dateTime = null, string password = null, string callback = null) +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -645,14 +645,14 @@ namespace Example var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None - var integer = 56; // int | None (optional) - var int32 = 56; // int | None (optional) - var int64 = 789; // long | None (optional) - var _float = 3.4F; // float | None (optional) + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) - var date = 2013-10-20; // DateTime | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) var password = password_example; // string | None (optional) var callback = callback_example; // string | None (optional) @@ -681,14 +681,14 @@ Name | Type | Description | Notes **_double** | **double**| None | **patternWithoutDelimiter** | **string**| None | **_byte** | **byte[]**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **long**| None | [optional] - **_float** | **float**| None | [optional] + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] **_string** | **string**| None | [optional] **binary** | **System.IO.Stream**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] **password** | **string**| None | [optional] **callback** | **string**| None | [optional] @@ -719,7 +719,7 @@ void (empty response body) ## TestEnumParameters -> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int enumQueryInteger = null, double enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) +> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) To test enum parameters @@ -746,8 +746,8 @@ namespace Example var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) @@ -776,8 +776,8 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] @@ -808,7 +808,7 @@ No authorization required ## TestGroupParameters -> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = null, bool booleanGroup = null, long int64Group = null) +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) Fake endpoint to test group parameters (optional) @@ -834,9 +834,9 @@ namespace Example var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters - var stringGroup = 56; // int | String in group parameters (optional) - var booleanGroup = true; // bool | Boolean in group parameters (optional) - var int64Group = 789; // long | Integer in group parameters (optional) + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) try { @@ -862,9 +862,9 @@ Name | Type | Description | Notes **requiredStringGroup** | **int**| Required String in group parameters | **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | **requiredInt64Group** | **long**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **long**| Integer in group parameters | [optional] + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs index 375d57575239..87e2ad08ec8c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs @@ -54,7 +54,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - bool FakeOuterBooleanSerialize (bool body = default(bool)); + bool FakeOuterBooleanSerialize (bool? body = default(bool?)); /// <summary> /// @@ -65,7 +65,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)); + ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -96,7 +96,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - decimal FakeOuterNumberSerialize (decimal body = default(decimal)); + decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)); /// <summary> /// @@ -107,7 +107,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)); + ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -216,7 +216,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -240,7 +240,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -257,7 +257,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -275,7 +275,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -290,7 +290,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -306,7 +306,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -574,7 +574,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - public bool FakeOuterBooleanSerialize (bool body = default(bool)) + public bool FakeOuterBooleanSerialize (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -586,7 +586,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)) + public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "/fake/outer/boolean"; @@ -714,7 +714,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - public decimal FakeOuterNumberSerialize (decimal body = default(decimal)) + public decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -726,7 +726,7 @@ public ApiResponse<Object> CreateXmlItemWithHttpInfo (XmlItem xmlItem) /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)) + public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "/fake/outer/number"; @@ -1091,7 +1091,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -1115,7 +1115,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -1204,7 +1204,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -1222,7 +1222,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "/fake"; @@ -1285,7 +1285,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } @@ -1301,7 +1301,7 @@ public ApiResponse<ModelClient> TestClientModelWithHttpInfo (ModelClient body) /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs index 8c65f55887b8..0d0e5fad12f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs @@ -473,7 +473,6 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> - /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Animal.cs index eb9b58f20753..f3c0d8a79e8c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Animal.cs @@ -29,7 +29,7 @@ namespace Org.OpenAPITools.Model /// Animal /// </summary> [DataContract] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonConverter(typeof(JsonSubtypes), "className")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")] @@ -71,7 +71,7 @@ protected Animal() { } /// <summary> /// Gets or Sets ClassName /// </summary> - [DataMember(Name="className", EmitDefaultValue=false)] + [DataMember(Name="className", EmitDefaultValue=true)] public string ClassName { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs index 9cf54d7ea340..2901d8bf67c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Category.cs @@ -64,7 +64,7 @@ protected Category() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs index 48a0f2fa0844..fe1b1e00aa1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs @@ -90,7 +90,7 @@ public enum EnumStringRequiredEnum /// <summary> /// Gets or Sets EnumStringRequired /// </summary> - [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + [DataMember(Name="enum_string_required", EmitDefaultValue=true)] public EnumStringRequiredEnum EnumStringRequired { get; set; } /// <summary> /// Defines EnumInteger @@ -157,7 +157,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { // to ensure "enumStringRequired" is required (not null) if (enumStringRequired == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs index eedd4b6236e1..becce06e2006 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs @@ -127,7 +127,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Number /// </summary> - [DataMember(Name="number", EmitDefaultValue=false)] + [DataMember(Name="number", EmitDefaultValue=true)] public decimal Number { get; set; } /// <summary> @@ -151,7 +151,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Byte /// </summary> - [DataMember(Name="byte", EmitDefaultValue=false)] + [DataMember(Name="byte", EmitDefaultValue=true)] public byte[] Byte { get; set; } /// <summary> @@ -163,7 +163,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Date /// </summary> - [DataMember(Name="date", EmitDefaultValue=false)] + [DataMember(Name="date", EmitDefaultValue=true)] [JsonConverter(typeof(OpenAPIDateConverter))] public DateTime Date { get; set; } @@ -182,7 +182,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Password /// </summary> - [DataMember(Name="password", EmitDefaultValue=false)] + [DataMember(Name="password", EmitDefaultValue=true)] public string Password { get; set; } /// <summary> @@ -367,8 +367,6 @@ public override int GetHashCode() /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { - - // Integer (int) maximum if(this.Integer > (int)100) { @@ -381,8 +379,6 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - - // Int32 (int) maximum if(this.Int32 > (int)200) { @@ -395,8 +391,6 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } - - // Number (decimal) maximum if(this.Number > (decimal)543.2) { @@ -409,8 +403,6 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); } - - // Float (float) maximum if(this.Float > (float)987.6) { @@ -423,8 +415,6 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); } - - // Double (double) maximum if(this.Double > (double)123.4) { @@ -437,8 +427,6 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); } - - // String (string) pattern Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) @@ -446,8 +434,6 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); } - - // Password (string) maxLength if(this.Password != null && this.Password.Length > 64) { @@ -459,7 +445,7 @@ public override int GetHashCode() { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } - + yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Name.cs index 2c76d68a122b..c22d454e1ea4 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Name.cs @@ -58,7 +58,7 @@ protected Name() { } /// <summary> /// Gets or Sets _Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public int _Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs index 4616c0230970..681dccedc28d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs @@ -120,13 +120,13 @@ protected Pet() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> /// Gets or Sets PhotoUrls /// </summary> - [DataMember(Name="photoUrls", EmitDefaultValue=false)] + [DataMember(Name="photoUrls", EmitDefaultValue=true)] public List<string> PhotoUrls { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderDefault.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderDefault.cs index 5cce95ad3a0d..dbcea03c41ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderDefault.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderDefault.cs @@ -100,31 +100,31 @@ protected TypeHolderDefault() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderExample.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderExample.cs index f72c763b0397..0a71dbe00b87 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderExample.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/TypeHolderExample.cs @@ -111,37 +111,37 @@ protected TypeHolderExample() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets FloatItem /// </summary> - [DataMember(Name="float_item", EmitDefaultValue=false)] + [DataMember(Name="float_item", EmitDefaultValue=true)] public float FloatItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/docs/FakeApi.md index edffb58d3c79..661c2cba6ab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/docs/FakeApi.md @@ -97,7 +97,7 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize (bool body = null) +> bool FakeOuterBooleanSerialize (bool? body = null) @@ -120,7 +120,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = true; // bool | Input boolean as post body (optional) + var body = true; // bool? | Input boolean as post body (optional) try { @@ -143,7 +143,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool?**| Input boolean as post body | [optional] ### Return type @@ -245,7 +245,7 @@ No authorization required ## FakeOuterNumberSerialize -> decimal FakeOuterNumberSerialize (decimal body = null) +> decimal FakeOuterNumberSerialize (decimal? body = null) @@ -268,7 +268,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = 8.14; // decimal | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { @@ -291,7 +291,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **decimal**| Input number as post body | [optional] + **body** | **decimal?**| Input number as post body | [optional] ### Return type @@ -614,7 +614,7 @@ No authorization required ## TestEndpointParameters -> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = null, int int32 = null, long int64 = null, float _float = null, string _string = null, System.IO.Stream binary = null, DateTime date = null, DateTime dateTime = null, string password = null, string callback = null) +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -645,14 +645,14 @@ namespace Example var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None - var integer = 56; // int | None (optional) - var int32 = 56; // int | None (optional) - var int64 = 789; // long | None (optional) - var _float = 3.4F; // float | None (optional) + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) - var date = 2013-10-20; // DateTime | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) var password = password_example; // string | None (optional) var callback = callback_example; // string | None (optional) @@ -681,14 +681,14 @@ Name | Type | Description | Notes **_double** | **double**| None | **patternWithoutDelimiter** | **string**| None | **_byte** | **byte[]**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **long**| None | [optional] - **_float** | **float**| None | [optional] + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] **_string** | **string**| None | [optional] **binary** | **System.IO.Stream**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] **password** | **string**| None | [optional] **callback** | **string**| None | [optional] @@ -719,7 +719,7 @@ void (empty response body) ## TestEnumParameters -> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int enumQueryInteger = null, double enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) +> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) To test enum parameters @@ -746,8 +746,8 @@ namespace Example var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) @@ -776,8 +776,8 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] @@ -808,7 +808,7 @@ No authorization required ## TestGroupParameters -> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = null, bool booleanGroup = null, long int64Group = null) +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) Fake endpoint to test group parameters (optional) @@ -834,9 +834,9 @@ namespace Example var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters - var stringGroup = 56; // int | String in group parameters (optional) - var booleanGroup = true; // bool | Boolean in group parameters (optional) - var int64Group = 789; // long | Integer in group parameters (optional) + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) try { @@ -862,9 +862,9 @@ Name | Type | Description | Notes **requiredStringGroup** | **int**| Required String in group parameters | **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | **requiredInt64Group** | **long**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **long**| Integer in group parameters | [optional] + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs index 51077f789e20..42d7e6b373c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs @@ -54,7 +54,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - bool FakeOuterBooleanSerialize (bool body = default(bool)); + bool FakeOuterBooleanSerialize (bool? body = default(bool?)); /// <summary> /// @@ -65,7 +65,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)); + ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -96,7 +96,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - decimal FakeOuterNumberSerialize (decimal body = default(decimal)); + decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)); /// <summary> /// @@ -107,7 +107,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)); + ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -216,7 +216,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -240,7 +240,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -257,7 +257,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -275,7 +275,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -290,7 +290,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -306,7 +306,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -412,7 +412,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)); + System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)); /// <summary> /// @@ -423,7 +423,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)); + System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -454,7 +454,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)); + System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)); /// <summary> /// @@ -465,7 +465,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)); + System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -574,7 +574,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -598,7 +598,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -615,7 +615,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -633,7 +633,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -648,7 +648,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -664,7 +664,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -1010,7 +1010,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - public bool FakeOuterBooleanSerialize (bool body = default(bool)) + public bool FakeOuterBooleanSerialize (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1022,7 +1022,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)) + public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "./fake/outer/boolean"; @@ -1080,7 +1080,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)) + public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1093,7 +1093,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)) + public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "./fake/outer/boolean"; @@ -1292,7 +1292,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - public decimal FakeOuterNumberSerialize (decimal body = default(decimal)) + public decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1304,7 +1304,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)) + public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "./fake/outer/number"; @@ -1362,7 +1362,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1375,7 +1375,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "./fake/outer/number"; @@ -2038,7 +2038,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -2062,7 +2062,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2157,7 +2157,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { await TestEndpointParametersAsyncWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); @@ -2182,7 +2182,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2271,7 +2271,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -2289,7 +2289,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "./fake"; @@ -2354,7 +2354,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { await TestEnumParametersAsyncWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); @@ -2373,7 +2373,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "./fake"; @@ -2436,7 +2436,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } @@ -2452,7 +2452,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) @@ -2521,7 +2521,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { await TestGroupParametersAsyncWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); @@ -2538,7 +2538,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs index 83f3b0a7b66d..4b8e41dc2a13 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs @@ -505,7 +505,6 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> - /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Animal.cs index 1f209ecbc1c4..455c3a9bcef3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Animal.cs @@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Model /// Animal /// </summary> [DataContract] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonConverter(typeof(JsonSubtypes), "className")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")] @@ -69,7 +69,7 @@ protected Animal() { } /// <summary> /// Gets or Sets ClassName /// </summary> - [DataMember(Name="className", EmitDefaultValue=false)] + [DataMember(Name="className", EmitDefaultValue=true)] public string ClassName { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Category.cs index 845a5fba42ff..6dd4b2c6f254 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Category.cs @@ -62,7 +62,7 @@ protected Category() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/EnumTest.cs index 8854d4e9610c..e234f80d68de 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/EnumTest.cs @@ -88,7 +88,7 @@ public enum EnumStringRequiredEnum /// <summary> /// Gets or Sets EnumStringRequired /// </summary> - [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + [DataMember(Name="enum_string_required", EmitDefaultValue=true)] public EnumStringRequiredEnum EnumStringRequired { get; set; } /// <summary> /// Defines EnumInteger @@ -155,7 +155,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { // to ensure "enumStringRequired" is required (not null) if (enumStringRequired == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/FormatTest.cs index 714402191f51..8128f7a332c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/FormatTest.cs @@ -125,7 +125,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Number /// </summary> - [DataMember(Name="number", EmitDefaultValue=false)] + [DataMember(Name="number", EmitDefaultValue=true)] public decimal Number { get; set; } /// <summary> @@ -149,7 +149,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Byte /// </summary> - [DataMember(Name="byte", EmitDefaultValue=false)] + [DataMember(Name="byte", EmitDefaultValue=true)] public byte[] Byte { get; set; } /// <summary> @@ -161,7 +161,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Date /// </summary> - [DataMember(Name="date", EmitDefaultValue=false)] + [DataMember(Name="date", EmitDefaultValue=true)] [JsonConverter(typeof(OpenAPIDateConverter))] public DateTime Date { get; set; } @@ -180,7 +180,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Password /// </summary> - [DataMember(Name="password", EmitDefaultValue=false)] + [DataMember(Name="password", EmitDefaultValue=true)] public string Password { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Name.cs index fa62132db171..64fdd861b644 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Name.cs @@ -56,7 +56,7 @@ protected Name() { } /// <summary> /// Gets or Sets _Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public int _Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Pet.cs index 3e1f5c228bc7..ac454a7840af 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/Pet.cs @@ -118,13 +118,13 @@ protected Pet() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> /// Gets or Sets PhotoUrls /// </summary> - [DataMember(Name="photoUrls", EmitDefaultValue=false)] + [DataMember(Name="photoUrls", EmitDefaultValue=true)] public List<string> PhotoUrls { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderDefault.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderDefault.cs index 93307c2324a6..8dcfb5aee00b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderDefault.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderDefault.cs @@ -98,31 +98,31 @@ protected TypeHolderDefault() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderExample.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderExample.cs index a4c7d9f028da..74fdf9563a85 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderExample.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Model/TypeHolderExample.cs @@ -109,37 +109,37 @@ protected TypeHolderExample() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets FloatItem /// </summary> - [DataMember(Name="float_item", EmitDefaultValue=false)] + [DataMember(Name="float_item", EmitDefaultValue=true)] public float FloatItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md index edffb58d3c79..661c2cba6ab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md @@ -97,7 +97,7 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize (bool body = null) +> bool FakeOuterBooleanSerialize (bool? body = null) @@ -120,7 +120,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = true; // bool | Input boolean as post body (optional) + var body = true; // bool? | Input boolean as post body (optional) try { @@ -143,7 +143,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool?**| Input boolean as post body | [optional] ### Return type @@ -245,7 +245,7 @@ No authorization required ## FakeOuterNumberSerialize -> decimal FakeOuterNumberSerialize (decimal body = null) +> decimal FakeOuterNumberSerialize (decimal? body = null) @@ -268,7 +268,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = 8.14; // decimal | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { @@ -291,7 +291,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **decimal**| Input number as post body | [optional] + **body** | **decimal?**| Input number as post body | [optional] ### Return type @@ -614,7 +614,7 @@ No authorization required ## TestEndpointParameters -> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = null, int int32 = null, long int64 = null, float _float = null, string _string = null, System.IO.Stream binary = null, DateTime date = null, DateTime dateTime = null, string password = null, string callback = null) +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -645,14 +645,14 @@ namespace Example var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None - var integer = 56; // int | None (optional) - var int32 = 56; // int | None (optional) - var int64 = 789; // long | None (optional) - var _float = 3.4F; // float | None (optional) + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) - var date = 2013-10-20; // DateTime | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) var password = password_example; // string | None (optional) var callback = callback_example; // string | None (optional) @@ -681,14 +681,14 @@ Name | Type | Description | Notes **_double** | **double**| None | **patternWithoutDelimiter** | **string**| None | **_byte** | **byte[]**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **long**| None | [optional] - **_float** | **float**| None | [optional] + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] **_string** | **string**| None | [optional] **binary** | **System.IO.Stream**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] **password** | **string**| None | [optional] **callback** | **string**| None | [optional] @@ -719,7 +719,7 @@ void (empty response body) ## TestEnumParameters -> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int enumQueryInteger = null, double enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) +> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) To test enum parameters @@ -746,8 +746,8 @@ namespace Example var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) @@ -776,8 +776,8 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] @@ -808,7 +808,7 @@ No authorization required ## TestGroupParameters -> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = null, bool booleanGroup = null, long int64Group = null) +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) Fake endpoint to test group parameters (optional) @@ -834,9 +834,9 @@ namespace Example var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters - var stringGroup = 56; // int | String in group parameters (optional) - var booleanGroup = true; // bool | Boolean in group parameters (optional) - var int64Group = 789; // long | Integer in group parameters (optional) + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) try { @@ -862,9 +862,9 @@ Name | Type | Description | Notes **requiredStringGroup** | **int**| Required String in group parameters | **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | **requiredInt64Group** | **long**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **long**| Integer in group parameters | [optional] + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs index 129610f908f9..42d7e6b373c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs @@ -54,7 +54,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - bool FakeOuterBooleanSerialize (bool body = default(bool)); + bool FakeOuterBooleanSerialize (bool? body = default(bool?)); /// <summary> /// @@ -65,7 +65,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)); + ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -96,7 +96,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - decimal FakeOuterNumberSerialize (decimal body = default(decimal)); + decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)); /// <summary> /// @@ -107,7 +107,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)); + ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -216,7 +216,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -240,7 +240,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -257,7 +257,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -275,7 +275,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -290,7 +290,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -306,7 +306,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -412,7 +412,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)); + System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)); /// <summary> /// @@ -423,7 +423,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)); + System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -454,7 +454,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)); + System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)); /// <summary> /// @@ -465,7 +465,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)); + System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -574,7 +574,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -598,7 +598,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -615,7 +615,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -633,7 +633,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -648,7 +648,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -664,7 +664,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -1010,7 +1010,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - public bool FakeOuterBooleanSerialize (bool body = default(bool)) + public bool FakeOuterBooleanSerialize (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1022,7 +1022,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)) + public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "./fake/outer/boolean"; @@ -1080,7 +1080,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)) + public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1093,7 +1093,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)) + public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "./fake/outer/boolean"; @@ -1292,7 +1292,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - public decimal FakeOuterNumberSerialize (decimal body = default(decimal)) + public decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1304,7 +1304,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)) + public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "./fake/outer/number"; @@ -1362,7 +1362,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1375,7 +1375,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "./fake/outer/number"; @@ -2038,7 +2038,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -2062,7 +2062,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2157,7 +2157,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { await TestEndpointParametersAsyncWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); @@ -2182,7 +2182,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2271,7 +2271,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -2289,7 +2289,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "./fake"; @@ -2354,7 +2354,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { await TestEnumParametersAsyncWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); @@ -2373,7 +2373,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "./fake"; @@ -2403,7 +2403,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod if (enumQueryDouble != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_double", enumQueryDouble)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", this.Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", this.Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.Serialize(enumFormStringArray)); // form parameter + if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter if (enumFormString != null) localVarFormParams.Add("enum_form_string", this.Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter @@ -2436,7 +2436,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } @@ -2452,7 +2452,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) @@ -2521,7 +2521,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { await TestGroupParametersAsyncWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); @@ -2538,7 +2538,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs index 83f3b0a7b66d..4b8e41dc2a13 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs @@ -505,7 +505,6 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> - /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Animal.cs index 1f209ecbc1c4..455c3a9bcef3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Animal.cs @@ -27,7 +27,7 @@ namespace Org.OpenAPITools.Model /// Animal /// </summary> [DataContract] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonConverter(typeof(JsonSubtypes), "className")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")] @@ -69,7 +69,7 @@ protected Animal() { } /// <summary> /// Gets or Sets ClassName /// </summary> - [DataMember(Name="className", EmitDefaultValue=false)] + [DataMember(Name="className", EmitDefaultValue=true)] public string ClassName { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs index 845a5fba42ff..6dd4b2c6f254 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Category.cs @@ -62,7 +62,7 @@ protected Category() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs index 8854d4e9610c..e234f80d68de 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs @@ -88,7 +88,7 @@ public enum EnumStringRequiredEnum /// <summary> /// Gets or Sets EnumStringRequired /// </summary> - [DataMember(Name="enum_string_required", EmitDefaultValue=false)] + [DataMember(Name="enum_string_required", EmitDefaultValue=true)] public EnumStringRequiredEnum EnumStringRequired { get; set; } /// <summary> /// Defines EnumInteger @@ -155,7 +155,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { // to ensure "enumStringRequired" is required (not null) if (enumStringRequired == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FormatTest.cs index 714402191f51..8128f7a332c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FormatTest.cs @@ -125,7 +125,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Number /// </summary> - [DataMember(Name="number", EmitDefaultValue=false)] + [DataMember(Name="number", EmitDefaultValue=true)] public decimal Number { get; set; } /// <summary> @@ -149,7 +149,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Byte /// </summary> - [DataMember(Name="byte", EmitDefaultValue=false)] + [DataMember(Name="byte", EmitDefaultValue=true)] public byte[] Byte { get; set; } /// <summary> @@ -161,7 +161,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Date /// </summary> - [DataMember(Name="date", EmitDefaultValue=false)] + [DataMember(Name="date", EmitDefaultValue=true)] [JsonConverter(typeof(OpenAPIDateConverter))] public DateTime Date { get; set; } @@ -180,7 +180,7 @@ protected FormatTest() { } /// <summary> /// Gets or Sets Password /// </summary> - [DataMember(Name="password", EmitDefaultValue=false)] + [DataMember(Name="password", EmitDefaultValue=true)] public string Password { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Name.cs index fa62132db171..64fdd861b644 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Name.cs @@ -56,7 +56,7 @@ protected Name() { } /// <summary> /// Gets or Sets _Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public int _Name { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs index 3e1f5c228bc7..ac454a7840af 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs @@ -118,13 +118,13 @@ protected Pet() { } /// <summary> /// Gets or Sets Name /// </summary> - [DataMember(Name="name", EmitDefaultValue=false)] + [DataMember(Name="name", EmitDefaultValue=true)] public string Name { get; set; } /// <summary> /// Gets or Sets PhotoUrls /// </summary> - [DataMember(Name="photoUrls", EmitDefaultValue=false)] + [DataMember(Name="photoUrls", EmitDefaultValue=true)] public List<string> PhotoUrls { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderDefault.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderDefault.cs index 93307c2324a6..8dcfb5aee00b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderDefault.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderDefault.cs @@ -98,31 +98,31 @@ protected TypeHolderDefault() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderExample.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderExample.cs index a4c7d9f028da..74fdf9563a85 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderExample.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/TypeHolderExample.cs @@ -109,37 +109,37 @@ protected TypeHolderExample() { } /// <summary> /// Gets or Sets StringItem /// </summary> - [DataMember(Name="string_item", EmitDefaultValue=false)] + [DataMember(Name="string_item", EmitDefaultValue=true)] public string StringItem { get; set; } /// <summary> /// Gets or Sets NumberItem /// </summary> - [DataMember(Name="number_item", EmitDefaultValue=false)] + [DataMember(Name="number_item", EmitDefaultValue=true)] public decimal NumberItem { get; set; } /// <summary> /// Gets or Sets FloatItem /// </summary> - [DataMember(Name="float_item", EmitDefaultValue=false)] + [DataMember(Name="float_item", EmitDefaultValue=true)] public float FloatItem { get; set; } /// <summary> /// Gets or Sets IntegerItem /// </summary> - [DataMember(Name="integer_item", EmitDefaultValue=false)] + [DataMember(Name="integer_item", EmitDefaultValue=true)] public int IntegerItem { get; set; } /// <summary> /// Gets or Sets BoolItem /// </summary> - [DataMember(Name="bool_item", EmitDefaultValue=false)] + [DataMember(Name="bool_item", EmitDefaultValue=true)] public bool BoolItem { get; set; } /// <summary> /// Gets or Sets ArrayItem /// </summary> - [DataMember(Name="array_item", EmitDefaultValue=false)] + [DataMember(Name="array_item", EmitDefaultValue=true)] public List<int> ArrayItem { get; set; } /// <summary> diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md index edffb58d3c79..661c2cba6ab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md @@ -97,7 +97,7 @@ No authorization required ## FakeOuterBooleanSerialize -> bool FakeOuterBooleanSerialize (bool body = null) +> bool FakeOuterBooleanSerialize (bool? body = null) @@ -120,7 +120,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = true; // bool | Input boolean as post body (optional) + var body = true; // bool? | Input boolean as post body (optional) try { @@ -143,7 +143,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] + **body** | **bool?**| Input boolean as post body | [optional] ### Return type @@ -245,7 +245,7 @@ No authorization required ## FakeOuterNumberSerialize -> decimal FakeOuterNumberSerialize (decimal body = null) +> decimal FakeOuterNumberSerialize (decimal? body = null) @@ -268,7 +268,7 @@ namespace Example { Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; var apiInstance = new FakeApi(Configuration.Default); - var body = 8.14; // decimal | Input number as post body (optional) + var body = 8.14; // decimal? | Input number as post body (optional) try { @@ -291,7 +291,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | **decimal**| Input number as post body | [optional] + **body** | **decimal?**| Input number as post body | [optional] ### Return type @@ -614,7 +614,7 @@ No authorization required ## TestEndpointParameters -> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = null, int int32 = null, long int64 = null, float _float = null, string _string = null, System.IO.Stream binary = null, DateTime date = null, DateTime dateTime = null, string password = null, string callback = null) +> void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, System.IO.Stream binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -645,14 +645,14 @@ namespace Example var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None - var integer = 56; // int | None (optional) - var int32 = 56; // int | None (optional) - var int64 = 789; // long | None (optional) - var _float = 3.4F; // float | None (optional) + var integer = 56; // int? | None (optional) + var int32 = 56; // int? | None (optional) + var int64 = 789; // long? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) - var date = 2013-10-20; // DateTime | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None (optional) + var date = 2013-10-20; // DateTime? | None (optional) + var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) var password = password_example; // string | None (optional) var callback = callback_example; // string | None (optional) @@ -681,14 +681,14 @@ Name | Type | Description | Notes **_double** | **double**| None | **patternWithoutDelimiter** | **string**| None | **_byte** | **byte[]**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **long**| None | [optional] - **_float** | **float**| None | [optional] + **integer** | **int?**| None | [optional] + **int32** | **int?**| None | [optional] + **int64** | **long?**| None | [optional] + **_float** | **float?**| None | [optional] **_string** | **string**| None | [optional] **binary** | **System.IO.Stream**| None | [optional] - **date** | **DateTime**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **date** | **DateTime?**| None | [optional] + **dateTime** | **DateTime?**| None | [optional] **password** | **string**| None | [optional] **callback** | **string**| None | [optional] @@ -719,7 +719,7 @@ void (empty response body) ## TestEnumParameters -> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int enumQueryInteger = null, double enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) +> void TestEnumParameters (List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null, List<string> enumFormStringArray = null, string enumFormString = null) To test enum parameters @@ -746,8 +746,8 @@ namespace Example var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List<string> | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) @@ -776,8 +776,8 @@ Name | Type | Description | Notes **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] **enumQueryStringArray** | **List<string>**| Query parameter enum test (string array) | [optional] **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] @@ -808,7 +808,7 @@ No authorization required ## TestGroupParameters -> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = null, bool booleanGroup = null, long int64Group = null) +> void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = null, bool? booleanGroup = null, long? int64Group = null) Fake endpoint to test group parameters (optional) @@ -834,9 +834,9 @@ namespace Example var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters - var stringGroup = 56; // int | String in group parameters (optional) - var booleanGroup = true; // bool | Boolean in group parameters (optional) - var int64Group = 789; // long | Integer in group parameters (optional) + var stringGroup = 56; // int? | String in group parameters (optional) + var booleanGroup = true; // bool? | Boolean in group parameters (optional) + var int64Group = 789; // long? | Integer in group parameters (optional) try { @@ -862,9 +862,9 @@ Name | Type | Description | Notes **requiredStringGroup** | **int**| Required String in group parameters | **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | **requiredInt64Group** | **long**| Required Integer in group parameters | - **stringGroup** | **int**| String in group parameters | [optional] - **booleanGroup** | **bool**| Boolean in group parameters | [optional] - **int64Group** | **long**| Integer in group parameters | [optional] + **stringGroup** | **int?**| String in group parameters | [optional] + **booleanGroup** | **bool?**| Boolean in group parameters | [optional] + **int64Group** | **long?**| Integer in group parameters | [optional] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs index e7f144292bb9..3749f51f3f9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs @@ -54,7 +54,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - bool FakeOuterBooleanSerialize (bool body = default(bool)); + bool FakeOuterBooleanSerialize (bool? body = default(bool?)); /// <summary> /// @@ -65,7 +65,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)); + ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -96,7 +96,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - decimal FakeOuterNumberSerialize (decimal body = default(decimal)); + decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)); /// <summary> /// @@ -107,7 +107,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)); + ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -216,7 +216,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -240,7 +240,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -257,7 +257,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -275,7 +275,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -290,7 +290,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -306,7 +306,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -412,7 +412,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)); + System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)); /// <summary> /// @@ -423,7 +423,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)); + System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)); /// <summary> /// /// </summary> @@ -454,7 +454,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)); + System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)); /// <summary> /// @@ -465,7 +465,7 @@ public interface IFakeApi : IApiAccessor /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)); + System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)); /// <summary> /// /// </summary> @@ -574,7 +574,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -598,7 +598,7 @@ public interface IFakeApi : IApiAccessor /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)); /// <summary> /// To test enum parameters /// </summary> @@ -615,7 +615,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// To test enum parameters @@ -633,7 +633,7 @@ public interface IFakeApi : IApiAccessor /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)); /// <summary> /// Fake endpoint to test group parameters (optional) /// </summary> @@ -648,7 +648,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// Fake endpoint to test group parameters (optional) @@ -664,7 +664,7 @@ public interface IFakeApi : IApiAccessor /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)); + System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)); /// <summary> /// test inline additionalProperties /// </summary> @@ -1010,7 +1010,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>bool</returns> - public bool FakeOuterBooleanSerialize (bool body = default(bool)) + public bool FakeOuterBooleanSerialize (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1022,7 +1022,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>ApiResponse of bool</returns> - public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool body = default(bool)) + public ApiResponse<bool> FakeOuterBooleanSerializeWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "/fake/outer/boolean"; @@ -1080,7 +1080,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of bool</returns> - public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool body = default(bool)) + public async System.Threading.Tasks.Task<bool> FakeOuterBooleanSerializeAsync (bool? body = default(bool?)) { ApiResponse<bool> localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1093,7 +1093,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input boolean as post body (optional)</param> /// <returns>Task of ApiResponse (bool)</returns> - public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool body = default(bool)) + public async System.Threading.Tasks.Task<ApiResponse<bool>> FakeOuterBooleanSerializeAsyncWithHttpInfo (bool? body = default(bool?)) { var localVarPath = "/fake/outer/boolean"; @@ -1292,7 +1292,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>decimal</returns> - public decimal FakeOuterNumberSerialize (decimal body = default(decimal)) + public decimal FakeOuterNumberSerialize (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); return localVarResponse.Data; @@ -1304,7 +1304,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>ApiResponse of decimal</returns> - public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal body = default(decimal)) + public ApiResponse<decimal> FakeOuterNumberSerializeWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "/fake/outer/number"; @@ -1362,7 +1362,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of decimal</returns> - public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<decimal> FakeOuterNumberSerializeAsync (decimal? body = default(decimal?)) { ApiResponse<decimal> localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1375,7 +1375,7 @@ public async System.Threading.Tasks.Task<ApiResponse<Object>> CreateXmlItemAsync /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="body">Input number as post body (optional)</param> /// <returns>Task of ApiResponse (decimal)</returns> - public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal body = default(decimal)) + public async System.Threading.Tasks.Task<ApiResponse<decimal>> FakeOuterNumberSerializeAsyncWithHttpInfo (decimal? body = default(decimal?)) { var localVarPath = "/fake/outer/number"; @@ -2038,7 +2038,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns></returns> - public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public void TestEndpointParameters (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } @@ -2062,7 +2062,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public ApiResponse<Object> TestEndpointParametersWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2157,7 +2157,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { await TestEndpointParametersAsyncWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); @@ -2182,7 +2182,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="password">None (optional)</param> /// <param name="callback">None (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int integer = default(int), int int32 = default(int), long int64 = default(long), float _float = default(float), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), string password = default(string), string callback = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (decimal number, double _double, string patternWithoutDelimiter, byte[] _byte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? _float = default(float?), string _string = default(string), System.IO.Stream binary = default(System.IO.Stream), DateTime? date = default(DateTime?), DateTime? dateTime = default(DateTime?), string password = default(string), string callback = default(string)) { // verify the required parameter 'number' is set if (number == null) @@ -2271,7 +2271,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns></returns> - public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public void TestEnumParameters (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -2289,7 +2289,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public ApiResponse<Object> TestEnumParametersWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "/fake"; @@ -2354,7 +2354,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task TestEnumParametersAsync (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { await TestEnumParametersAsyncWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); @@ -2373,7 +2373,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="enumFormStringArray">Form parameter enum test (string array) (optional, default to $)</param> /// <param name="enumFormString">Form parameter enum test (string) (optional, default to -efg)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int enumQueryInteger = default(int), double enumQueryDouble = default(double), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (List<string> enumHeaderStringArray = default(List<string>), string enumHeaderString = default(string), List<string> enumQueryStringArray = default(List<string>), string enumQueryString = default(string), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List<string> enumFormStringArray = default(List<string>), string enumFormString = default(string)) { var localVarPath = "/fake"; @@ -2403,7 +2403,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod if (enumQueryDouble != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_double", enumQueryDouble)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", this.Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", this.Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.Serialize(enumFormStringArray)); // form parameter + if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter if (enumFormString != null) localVarFormParams.Add("enum_form_string", this.Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter @@ -2436,7 +2436,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns></returns> - public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public void TestGroupParameters (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } @@ -2452,7 +2452,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>ApiResponse of Object(void)</returns> - public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public ApiResponse<Object> TestGroupParametersWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) @@ -2521,7 +2521,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of void</returns> - public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task TestGroupParametersAsync (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { await TestGroupParametersAsyncWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); @@ -2538,7 +2538,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod /// <param name="booleanGroup">Boolean in group parameters (optional)</param> /// <param name="int64Group">Integer in group parameters (optional)</param> /// <returns>Task of ApiResponse</returns> - public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int stringGroup = default(int), bool booleanGroup = default(bool), long int64Group = default(long)) + public async System.Threading.Tasks.Task<ApiResponse<Object>> TestGroupParametersAsyncWithHttpInfo (int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?)) { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs index 9ccb39dfeedd..4d536076615e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs @@ -500,7 +500,6 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> - /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Animal.cs index 2180878c9cd3..e51ad5f9cbb4 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Animal.cs @@ -31,7 +31,7 @@ namespace Org.OpenAPITools.Model /// Animal /// </summary> [DataContract] - [JsonConverter(typeof(JsonSubtypes), "ClassName")] + [JsonConverter(typeof(JsonSubtypes), "className")] [JsonSubtypes.KnownSubType(typeof(Dog), "Dog")] [JsonSubtypes.KnownSubType(typeof(Cat), "Cat")] [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")] diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs index c712f71825e2..d8c3e6f1cab9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs @@ -160,7 +160,7 @@ protected EnumTest() { } /// <param name="enumInteger">enumInteger.</param> /// <param name="enumNumber">enumNumber.</param> /// <param name="outerEnum">outerEnum.</param> - public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum outerEnum = default(OuterEnum)) + public EnumTest(EnumStringEnum? enumString = default(EnumStringEnum?), EnumStringRequiredEnum enumStringRequired = default(EnumStringRequiredEnum), EnumIntegerEnum? enumInteger = default(EnumIntegerEnum?), EnumNumberEnum? enumNumber = default(EnumNumberEnum?), OuterEnum? outerEnum = default(OuterEnum?)) { // to ensure "enumStringRequired" is required (not null) if (enumStringRequired == null) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs index b3ebc9f373b9..d8452eb07cb6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs @@ -390,8 +390,6 @@ public virtual void OnPropertyChanged(string propertyName) /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { - - // Integer (int) maximum if(this.Integer > (int)100) { @@ -404,8 +402,6 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - - // Int32 (int) maximum if(this.Int32 > (int)200) { @@ -418,8 +414,6 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } - - // Number (decimal) maximum if(this.Number > (decimal)543.2) { @@ -432,8 +426,6 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); } - - // Float (float) maximum if(this.Float > (float)987.6) { @@ -446,8 +438,6 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); } - - // Double (double) maximum if(this.Double > (double)123.4) { @@ -460,8 +450,6 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); } - - // String (string) pattern Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) @@ -469,8 +457,6 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); } - - // Password (string) maxLength if(this.Password != null && this.Password.Length > 64) { @@ -482,7 +468,7 @@ public virtual void OnPropertyChanged(string propertyName) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } - + yield break; } } From 001d9cb36d93ef0240d4b8c9bb9a3f12fff85f27 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 29 Apr 2020 23:43:21 +0800 Subject: [PATCH 36/78] better docstring for jersey2 client (#6104) --- .../AbstractOpenApiSchema.mustache | 27 ++++++++++++++++- .../jersey2-experimental/ApiResponse.mustache | 15 ++++++++++ .../jersey2-experimental/JSON.mustache | 5 ++++ .../jersey2-experimental/api.mustache | 30 +++++++++++++++---- .../apiException.mustache | 3 ++ .../jersey2-experimental/oneof_model.mustache | 4 --- .../org/openapitools/client/ApiException.java | 1 + .../org/openapitools/client/ApiResponse.java | 15 ++++++++++ .../java/org/openapitools/client/JSON.java | 5 ++++ .../client/api/AnotherFakeApi.java | 11 +++++++ .../openapitools/client/api/DefaultApi.java | 11 +++++++ .../org/openapitools/client/api/FakeApi.java | 11 +++++++ .../client/api/FakeClassnameTags123Api.java | 11 +++++++ .../org/openapitools/client/api/PetApi.java | 11 +++++++ .../org/openapitools/client/api/StoreApi.java | 11 +++++++ .../org/openapitools/client/api/UserApi.java | 11 +++++++ .../client/model/AbstractOpenApiSchema.java | 25 +++++++++++++++- 17 files changed, 195 insertions(+), 12 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache index 607c223aa266..61fddeca43bb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/AbstractOpenApiSchema.mustache @@ -7,23 +7,48 @@ import java.lang.reflect.Type; import java.util.Map; import javax.ws.rs.core.GenericType; +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}} public abstract class AbstractOpenApiSchema { + // store the actual instance of the schema/object private Object instance; - public final String schemaType; + // schema type (e.g. oneOf, anyOf) + private final String schemaType; public AbstractOpenApiSchema(String schemaType) { this.schemaType = schemaType; } + /*** + * Get the list of schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ public abstract Map<String, GenericType> getSchemas(); + /*** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ public Object getActualInstance() {return instance;} + /*** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ public void setActualInstance(Object instance) {this.instance = instance;} + /*** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ public String getSchemaType() { return schemaType; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache index a67b11f054c8..5dae9dc1fdf4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/ApiResponse.mustache @@ -44,14 +44,29 @@ public class ApiResponse<T> { this.data = data; } + /** + * Get the status code + * + * @return status code + */ public int getStatusCode() { return statusCode; } + /** + * Get the headers + * + * @return map of headers + */ public Map<String, List<String>> getHeaders() { return headers; } + /** + * Get the data + * + * @return data + */ public T getData() { return data; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache index e25b307f7d0c..dc3d9893e6d6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/JSON.mustache @@ -63,5 +63,10 @@ public class JSON implements ContextResolver<ObjectMapper> { return mapper; } + /** + * Get the object mapper + * + * @return object mapper + */ public ObjectMapper getMapper() { return mapper; } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache index a0730135f711..509ae48a50ef 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/api.mustache @@ -16,8 +16,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -{{/fullJavaUtil}} +{{/fullJavaUtil}} {{>generatedAnnotation}} {{#operations}} public class {{classname}} { @@ -31,13 +31,24 @@ public class {{classname}} { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + {{#operation}} {{^vendorExtensions.x-group-parameters}} /** @@ -170,7 +181,8 @@ public class {{classname}} { this.{{localVariablePrefix}}{{paramName}} = {{paramName}}; {{/pathParams}} } - {{#allParams}}{{^isPathParam}} + {{#allParams}} + {{^isPathParam}} /** * Set {{paramName}} @@ -181,7 +193,8 @@ public class {{classname}} { this.{{localVariablePrefix}}{{paramName}} = {{paramName}}; return this; } - {{/isPathParam}}{{/allParams}} + {{/isPathParam}} + {{/allParams}} /** * Execute {{operationId}} request @@ -216,9 +229,12 @@ public class {{classname}} { {{/responses}} </table> {{/responses.0}} - {{#isDeprecated}}* @deprecated{{/isDeprecated}} + {{#isDeprecated}} + * @deprecated{{/isDeprecated}} */ - {{#isDeprecated}}@Deprecated{{/isDeprecated}} + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} public ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); } @@ -234,7 +250,9 @@ public class {{classname}} { {{#externalDocs}}* {{description}} * @see <a href="{{url}}">{{summary}} Documentation</a>{{/externalDocs}} */ - {{#isDeprecated}}@Deprecated{{/isDeprecated}} + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) throws ApiException { return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache index e89524565917..f0079c7bbece 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/apiException.mustache @@ -9,6 +9,9 @@ import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} +/** + * API Exception + */ {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ private int code = 0; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache index 62289f9b2d72..b5d4442e6081 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/oneof_model.mustache @@ -26,10 +26,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im return {{classname}}.schemas; } - public String getSchemaType() { - return schemaType; - } - @Override public void setActualInstance(Object instance) { {{#oneOf}} diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java index 5bdd88d576ed..3c2d12abf557 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Map; +/** API Exception */ public class ApiException extends Exception { private int code = 0; private Map<String, List<String>> responseHeaders = null; diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java index fd4a259e3643..5dcb28d7a53b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java @@ -44,14 +44,29 @@ public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { this.data = data; } + /** + * Get the status code + * + * @return status code + */ public int getStatusCode() { return statusCode; } + /** + * Get the headers + * + * @return map of headers + */ public Map<String, List<String>> getHeaders() { return headers; } + /** + * Get the data + * + * @return data + */ public T getData() { return data; } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java index 9ace1af62702..51a014702690 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java @@ -43,6 +43,11 @@ public ObjectMapper getContext(Class<?> type) { return mapper; } + /** + * Get the object mapper + * + * @return object mapper + */ public ObjectMapper getMapper() { return mapper; } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 67f9b20ad791..f02739eb7728 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -23,13 +23,24 @@ public AnotherFakeApi(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * To test special tags To test special tags and operation ID starting with number * diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java index b70b363a6f27..288cccfa5168 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -23,13 +23,24 @@ public DefaultApi(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * @return InlineResponseDefault * @throws ApiException if fails to make API call diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java index ea5b240a3389..58f30d6ffe6c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java @@ -32,13 +32,24 @@ public FakeApi(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * Health check endpoint * diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 287707679a1f..ca4b0f507d52 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -23,13 +23,24 @@ public FakeClassnameTags123Api(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * To test class name in snake case To test class name in snake case * diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java index cb2abcf1bc1a..af6e041847bc 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java @@ -25,13 +25,24 @@ public PetApi(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * Add a new pet to the store * diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java index 90fdbd917a02..8bb02d79038a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java @@ -23,13 +23,24 @@ public StoreApi(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything * above 1000 or nonintegers will generate API errors diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java index 369322b43c92..dda3ad6bdf39 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java @@ -23,13 +23,24 @@ public UserApi(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Get the API cilent + * + * @return API client + */ public ApiClient getApiClient() { return apiClient; } + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** * Create user This can only be done by the logged in user. * diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index 54b31cc472b8..d7bae11f1263 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -15,26 +15,49 @@ import java.util.Map; import javax.ws.rs.core.GenericType; +/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ public abstract class AbstractOpenApiSchema { + // store the actual instance of the schema/object private Object instance; - public final String schemaType; + // schema type (e.g. oneOf, anyOf) + private final String schemaType; public AbstractOpenApiSchema(String schemaType) { this.schemaType = schemaType; } + /** + * * Get the list of schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ public abstract Map<String, GenericType> getSchemas(); + /** + * * Get the actual instance + * + * @return an instance of the actual schema/object + */ public Object getActualInstance() { return instance; } + /** + * * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ public void setActualInstance(Object instance) { this.instance = instance; } + /** + * * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ public String getSchemaType() { return schemaType; } From 8e4452e383805c70a2c41275318ce5147988a1e1 Mon Sep 17 00:00:00 2001 From: Aleksandr Nekrasov <snake_nas@mail.ru> Date: Thu, 30 Apr 2020 09:53:14 +0700 Subject: [PATCH 37/78] [scala-akka-http] fixed getOffsetDateTimeHeader and removed broken test due invalid v2 spec (#6109) --- .../scala-akka-client/requests.mustache | 3 + .../openapitools/client/core/requests.scala | 3 + .../src/test/scala/PetApiTest.scala | 121 ------------------ .../openapitools/client/core/requests.scala | 3 + 4 files changed, 9 insertions(+), 121 deletions(-) delete mode 100644 samples/client/petstore/scala-akka/src/test/scala/PetApiTest.scala diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache index 882eef50e895..70c8138eb54e 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache @@ -3,6 +3,7 @@ package {{mainPackage}}.core import java.io.File import java.net.URLEncoder +import java.time.OffsetDateTime import scala.util.Try @@ -26,6 +27,8 @@ sealed trait ApiReturnWithHeaders { def getBooleanHeader(name: String): Option[Boolean] = castedHeader(name, java.lang.Boolean.parseBoolean) + def getOffsetDateTimeHeader(name: String): Option[OffsetDateTime] = castedHeader(name, java.time.OffsetDateTime.parse) + private def castedHeader[U](name: String, conversion: String => U): Option[U] = { Try { header(name).map(conversion) diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala index 0d3549efec9a..15b09453a973 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala @@ -13,6 +13,7 @@ package org.openapitools.client.core import java.io.File import java.net.URLEncoder +import java.time.OffsetDateTime import scala.util.Try @@ -36,6 +37,8 @@ sealed trait ApiReturnWithHeaders { def getBooleanHeader(name: String): Option[Boolean] = castedHeader(name, java.lang.Boolean.parseBoolean) + def getOffsetDateTimeHeader(name: String): Option[OffsetDateTime] = castedHeader(name, java.time.OffsetDateTime.parse) + private def castedHeader[U](name: String, conversion: String => U): Option[U] = { Try { header(name).map(conversion) diff --git a/samples/client/petstore/scala-akka/src/test/scala/PetApiTest.scala b/samples/client/petstore/scala-akka/src/test/scala/PetApiTest.scala deleted file mode 100644 index 9327a6d7585d..000000000000 --- a/samples/client/petstore/scala-akka/src/test/scala/PetApiTest.scala +++ /dev/null @@ -1,121 +0,0 @@ -import akka.actor.ActorSystem -import org.junit.runner.RunWith -import org.openapitools.client._ -import org.openapitools.client.api._ -import org.openapitools.client.core.{ApiInvoker, ApiKeyValue} -import org.openapitools.client.model._ -import org.scalatest.Inspectors._ -import org.scalatest._ -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class PetApiTest extends AsyncFlatSpec with Matchers { - - private implicit val system: ActorSystem = ActorSystem() - - behavior of "PetApi" - val api: PetApi = PetApi() - val invoker: ApiInvoker = ApiInvoker(EnumsSerializers.all) - private implicit val apiKey: ApiKeyValue = ApiKeyValue("special-key") - - it should "add and fetch a pet" in { - val petId = 1000 - val createdPet = Pet( - Some(petId), - Some(Category(Some(1), Some("sold"))), - "dragon", - (for (i <- 1 to 10) yield "http://foo.com/photo/" + i).toList, - Some((for (i <- 1 to 5) yield org.openapitools.client.model.Tag(Some(i), Some("tag-" + i))).toList), - Some(PetEnums.Status.Sold) - ) - - val addPetRequest = api.addPet(createdPet) - val getPetRequest = api.getPetById(petId) - - for { - addResponse <- invoker.execute(addPetRequest) - response <- invoker.execute(getPetRequest) - } yield { - addResponse.code should be(200) - - response.code should be(200) - val pet = response.content - - pet should have( - 'id (createdPet.id), - 'status (createdPet.status), - 'category (createdPet.category), - 'name (createdPet.name) - ) - pet.tags should not be empty - pet.tags.get should contain theSameElementsInOrderAs createdPet.tags.get - pet.photoUrls should contain theSameElementsInOrderAs createdPet.photoUrls - } - } - - it should "update a pet" in { - val petId = (Math.random()*1000000000).toLong - val createdPet = Pet( - Some(petId), - Some(Category(Some(1), Some("sold"))), - "programmer", - (for (i <- 1 to 10) yield "http://foo.com/photo/" + i).toList, - Some((for (i <- 1 to 5) yield org.openapitools.client.model.Tag(Some(i), Some("tag-" + i))).toList), - Some(PetEnums.Status.Available) - ) - - for { - createdPet <- invoker.execute(api.addPet(createdPet)) - pet: core.ApiResponse[Pet] <- invoker.execute(api.getPetById(createdPet.content.id.get)) - updatedPet = pet.content.copy(status = Some(PetEnums.Status.Sold), name = "developer") - updatedPetResponse: core.ApiResponse[Pet] <- invoker.execute(api.updatePet(updatedPet)) - updatedRequested: core.ApiResponse[Pet] <- invoker.execute(api.getPetById(createdPet.content.id.get)) - } yield { - pet.content.name should be("programmer") - pet.content.status should be(Some(PetEnums.Status.Available)) - - updatedPetResponse.content.name should be("developer") - updatedPetResponse.content.status should be(Some(PetEnums.Status.Sold)) - - updatedRequested.content.name should be("developer") - updatedRequested.content.status should be(Some(PetEnums.Status.Sold)) - - } - - } - - it should "find pets by status" in { - val request = api.findPetsByStatus(List("available")) - - invoker - .execute(request) - .map { apiResponse => - apiResponse.code should be(200) - val pets = apiResponse.content - pets should not be empty - - forAll(pets) { pet => - pet.status should contain(PetEnums.Status.Available) - } - } - } - - it should "find pets by tag" in { - val request = api.findPetsByTags(List("tag1", "tag2")) - - invoker - .execute(request) - .map { apiResponse => - apiResponse.code should be(200) - - val pets = apiResponse.content - pets should not be empty - - forAll(pets) { pet => - val tagNames = pet.tags.toList.flatten.map(_.name).collect { case Some(name) => name } - tagNames should contain atLeastOneOf("tag1", "tag2") - } - } - } -} - diff --git a/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala b/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala index 0d3549efec9a..15b09453a973 100644 --- a/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala +++ b/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/core/requests.scala @@ -13,6 +13,7 @@ package org.openapitools.client.core import java.io.File import java.net.URLEncoder +import java.time.OffsetDateTime import scala.util.Try @@ -36,6 +37,8 @@ sealed trait ApiReturnWithHeaders { def getBooleanHeader(name: String): Option[Boolean] = castedHeader(name, java.lang.Boolean.parseBoolean) + def getOffsetDateTimeHeader(name: String): Option[OffsetDateTime] = castedHeader(name, java.time.OffsetDateTime.parse) + private def castedHeader[U](name: String, conversion: String => U): Option[U] = { Try { header(name).map(conversion) From 3e2c933dec3cb1ca30576500098fdb2e8a37096e Mon Sep 17 00:00:00 2001 From: Artem <reznikartem@gmail.com> Date: Thu, 30 Apr 2020 11:22:44 +0200 Subject: [PATCH 38/78] [php-symfony] Fix problem with clients, that put charset in content type header. (#6078) * Fix problem with clients, that put charset in content type header. With this fix header "Content-Type: application/json; charset=utf-8" working same as "Content-Type: application/json" for parse input data * Fix code style, add $consumes length check. * Add isContentTypeAllowed static method and tests * Fix old tests Right now serializer doesn't support anything beside json and xml. Call tests with application/json instead of form data. Co-authored-by: Yuriy Belenko <yura-bely@mail.ru> --- .../languages/PhpSymfonyServerCodegen.java | 6 + .../resources/php-symfony/Controller.mustache | 37 ++++++ .../php-symfony/api_controller.mustache | 4 +- .../testing/ControllerTest.mustache | 113 ++++++++++++++++ .../php-symfony/testing/api_test.mustache | 2 +- .../php-symfony/testing/phpunit.xml.mustache | 2 + .../Controller/Controller.php | 37 ++++++ .../Controller/PetController.php | 8 +- .../Controller/StoreController.php | 4 +- .../Controller/UserController.php | 16 +-- .../Tests/Api/PetApiInterfaceTest.php | 4 +- .../Tests/Api/StoreApiInterfaceTest.php | 2 +- .../Tests/Api/UserApiInterfaceTest.php | 8 +- .../Tests/Controller/ControllerTest.php | 123 ++++++++++++++++++ .../SymfonyBundle-php/phpunit.xml.dist | 2 + 15 files changed, 344 insertions(+), 24 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache create mode 100644 samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index d0756dacc2a1..ef09fa0caa13 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -55,6 +55,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg protected String controllerDirName = "Controller"; protected String serviceDirName = "Service"; protected String controllerPackage; + protected String controllerTestsPackage; protected String servicePackage; protected Boolean phpLegacySupport = Boolean.TRUE; @@ -301,6 +302,7 @@ public void processOpts() { additionalProperties.put("servicePackage", servicePackage); additionalProperties.put("apiTestsPackage", apiTestsPackage); additionalProperties.put("modelTestsPackage", modelTestsPackage); + additionalProperties.put("controllerTestsPackage", controllerTestsPackage); // make Symonfy-specific properties available additionalProperties.put("bundleName", bundleName); @@ -311,11 +313,13 @@ public void processOpts() { // make api and model src path available in mustache template additionalProperties.put("apiSrcPath", "." + "/" + toSrcPath(apiPackage, srcBasePath)); additionalProperties.put("modelSrcPath", "." + "/" + toSrcPath(modelPackage, srcBasePath)); + additionalProperties.put("controllerSrcPath", "." + "/" + toSrcPath(controllerPackage, srcBasePath)); additionalProperties.put("testsSrcPath", "." + "/" + toSrcPath(testsPackage, srcBasePath)); additionalProperties.put("apiTestsSrcPath", "." + "/" + toSrcPath(apiTestsPackage, srcBasePath)); additionalProperties.put("modelTestsSrcPath", "." + "/" + toSrcPath(modelTestsPackage, srcBasePath)); additionalProperties.put("apiTestPath", "." + "/" + testsDirName + "/" + apiDirName); additionalProperties.put("modelTestPath", "." + "/" + testsDirName + "/" + modelDirName); + additionalProperties.put("controllerTestPath", "." + "/" + testsDirName + "/" + controllerDirName); // make api and model doc path available in mustache template additionalProperties.put("apiDocPath", apiDocPath); @@ -346,6 +350,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("testing/phpunit.xml.mustache", "", "phpunit.xml.dist")); supportingFiles.add(new SupportingFile("testing/pom.xml", "", "pom.xml")); supportingFiles.add(new SupportingFile("testing/AppKernel.php", toSrcPath(testsPackage, srcBasePath), "AppKernel.php")); + supportingFiles.add(new SupportingFile("testing/ControllerTest.mustache", toSrcPath(controllerTestsPackage, srcBasePath), "ControllerTest.php")); supportingFiles.add(new SupportingFile("testing/test_config.yml", toSrcPath(testsPackage, srcBasePath), "test_config.yml")); supportingFiles.add(new SupportingFile("routing.mustache", configDir, "routing.yml")); @@ -540,6 +545,7 @@ public void setInvokerPackage(String invokerPackage) { apiTestsPackage = testsPackage + "\\" + apiDirName; modelTestsPackage = testsPackage + "\\" + modelDirName; controllerPackage = invokerPackage + "\\" + controllerDirName; + controllerTestsPackage = testsPackage + "\\" + controllerDirName; servicePackage = invokerPackage + "\\" + serviceDirName; } diff --git a/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache b/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache index 5922196c1861..d7b5d5feec44 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/Controller.mustache @@ -20,6 +20,7 @@ namespace {{controllerPackage}}; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use {{servicePackage}}\SerializerInterface; @@ -176,4 +177,40 @@ class Controller extends AbstractController // If we reach this point, we don't have a common ground between server and client return null; } + + /** + * Checks whether Content-Type request header presented in supported formats. + * + * @param Request $request Request instance. + * @param array $consumes Array of supported content types. + * + * @return bool Returns true if Content-Type supported otherwise false. + */ + public static function isContentTypeAllowed(Request $request, array $consumes = []) + { + if (!empty($consumes) && $consumes[0] !== '*/*') { + $currentFormat = $request->getContentType(); + foreach ($consumes as $mimeType) { + // canonize mime type + if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) { + $mimeType = trim(substr($mimeType, 0, $pos)); + } + + if (!$format = $request->getFormat($mimeType)) { + // add custom format to request + $format = $mimeType; + $request->setFormat($format, $format); + $currentFormat = $request->getContentType(); + } + + if ($format === $currentFormat) { + return true; + } + } + + return false; + } + + return true; + } } diff --git a/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache b/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache index 0a89e839938c..c0948e7c2a47 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache @@ -60,8 +60,7 @@ class {{controllerName}} extends Controller {{#bodyParams}} // Make sure that the client is providing something that we can consume $consumes = [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -146,6 +145,7 @@ class {{controllerName}} extends Controller {{#allParams}} {{^isFile}} {{#isBodyParam}} + $inputFormat = $request->getMimeType($request->getContentType()); ${{paramName}} = $this->deserialize(${{paramName}}, '{{#isContainer}}{{#items}}array<{{dataType}}>{{/items}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}', $inputFormat); {{/isBodyParam}} {{^isBodyParam}} diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache new file mode 100644 index 000000000000..382b66c9154a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache @@ -0,0 +1,113 @@ +<?php +/** + * ControllerTest + * PHP version 5 + * + * @category Class + * @package {{controllerTestsPackage}} + * @author openapi-generator contributors + * @link https://github.com/openapitools/openapi-generator + */ + +{{>partial_header}} +/** + * NOTE: This class is auto generated by the openapi generator program. + * https://github.com/openapitools/openapi-generator + * Please update the test case below to test the endpoint. + */ + +namespace {{controllerTestsPackage}}; + +use {{controllerPackage}}\Controller; +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; + +/** + * ControllerTest Class Doc Comment + * + * @category Class + * @package {{controllerTestsPackage}} + * @author openapi-generator contributors + * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \{{controllerPackage}}\Controller + */ +class ControllerTest extends TestCase +{ + + /** + * Tests isContentTypeAllowed static method. + * + * @param string $contentType + * @param array $consumes + * @param bool $expectedReturn + * + * @covers ::isContentTypeAllowed + * @dataProvider provideArgumentsForIsContentTypeAllowed + */ + public function testIsContentTypeAllowed($contentType, array $consumes, $expectedReturn) + { + $request = new Request(); + $request->headers->set('CONTENT_TYPE', $contentType, true);// last one argument overrides header + $this->assertSame( + $expectedReturn, + Controller::isContentTypeAllowed($request, $consumes), + sprintf( + 'Failed assertion that "Content-Type: %s" %s by [%s] consumes array.', + $contentType, + ($expectedReturn) ? 'is allowed' : 'is forbidden', + implode(', ', $consumes) + ) + ); + } + + public function provideArgumentsForIsContentTypeAllowed() + { + return [ + 'usual JSON content type' => [ + 'application/json', + ['application/json'], + true, + ], + 'extended content type from PR #6078' => [ + 'application/json; charset=utf-8', + ['application/json'], + true, + ], + 'more than one content types' => [ + 'application/json', + ['application/xml', 'application/json; charset=utf-8'], + true, + ], + 'empty consumes array' => [ + 'application/json', + [], + true, + ], + 'empty consumes and content type' => [ + null, + [], + true, + ], + 'consumes everything' => [ + 'application/json', + ['*/*'], + true, + ], + 'fancy custom content type' => [ + 'foobar/foobaz', + ['application/xml', 'foobar/foobaz; charset=utf-8'], + true, + ], + 'empty content type' => [ + null, + ['application/xml', 'application/json; charset=utf-8'], + false, + ], + 'content type out of consumes' => [ + 'text/html', + ['application/xml', 'application/json; charset=utf-8'], + false, + ], + ]; + } +} diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache index a279d6e61ea8..d7f3c1f76034 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache @@ -99,7 +99,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; $path = str_replace($pattern, $data, $path); {{/pathParams}} - $crawler = $client->request('{{httpMethod}}', $path); + $crawler = $client->request('{{httpMethod}}', $path{{#hasBodyParam}}, [], [], ['CONTENT_TYPE' => 'application/json']{{/hasBodyParam}}); } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache index 8a6ff770c44e..35e39a7db34d 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache @@ -9,12 +9,14 @@ <testsuite> <directory>{{apiTestPath}}</directory> <directory>{{modelTestPath}}</directory> + <directory>{{controllerTestPath}}</directory> </testsuite> </testsuites> <filter> <whitelist processUncoveredFilesFromWhitelist="true"> <directory suffix=".php">{{apiSrcPath}}</directory> <directory suffix=".php">{{modelSrcPath}}</directory> + <directory suffix=".php">{{controllerSrcPath}}</directory> </whitelist> </filter> <php> diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php index 2412b9bd264e..8f6030e3bd09 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/Controller.php @@ -30,6 +30,7 @@ namespace OpenAPI\Server\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpException; use OpenAPI\Server\Service\SerializerInterface; @@ -186,4 +187,40 @@ protected function getOutputFormat($accept, array $produced) // If we reach this point, we don't have a common ground between server and client return null; } + + /** + * Checks whether Content-Type request header presented in supported formats. + * + * @param Request $request Request instance. + * @param array $consumes Array of supported content types. + * + * @return bool Returns true if Content-Type supported otherwise false. + */ + public static function isContentTypeAllowed(Request $request, array $consumes = []) + { + if (!empty($consumes) && $consumes[0] !== '*/*') { + $currentFormat = $request->getContentType(); + foreach ($consumes as $mimeType) { + // canonize mime type + if (is_string($mimeType) && false !== $pos = strpos($mimeType, ';')) { + $mimeType = trim(substr($mimeType, 0, $pos)); + } + + if (!$format = $request->getFormat($mimeType)) { + // add custom format to request + $format = $mimeType; + $request->setFormat($format, $format); + $currentFormat = $request->getContentType(); + } + + if ($format === $currentFormat) { + return true; + } + } + + return false; + } + + return true; + } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php index 8a1c9521a6b4..5cd8e8c4899f 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php @@ -62,8 +62,7 @@ public function addPetAction(Request $request) { // Make sure that the client is providing something that we can consume $consumes = ['application/json', 'application/xml']; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -80,6 +79,7 @@ public function addPetAction(Request $request) // Deserialize the input values that needs it try { + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'OpenAPI\Server\Model\Pet', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -491,8 +491,7 @@ public function updatePetAction(Request $request) { // Make sure that the client is providing something that we can consume $consumes = ['application/json', 'application/xml']; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -509,6 +508,7 @@ public function updatePetAction(Request $request) // Deserialize the input values that needs it try { + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'OpenAPI\Server\Model\Pet', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php index a7c17cae0b4b..433213776178 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/StoreController.php @@ -284,8 +284,7 @@ public function placeOrderAction(Request $request) { // Make sure that the client is providing something that we can consume $consumes = []; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -308,6 +307,7 @@ public function placeOrderAction(Request $request) // Deserialize the input values that needs it try { + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'OpenAPI\Server\Model\Order', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php index b67fc2809823..fcb17c698915 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php @@ -61,8 +61,7 @@ public function createUserAction(Request $request) { // Make sure that the client is providing something that we can consume $consumes = []; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -76,6 +75,7 @@ public function createUserAction(Request $request) // Deserialize the input values that needs it try { + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'OpenAPI\Server\Model\User', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -138,8 +138,7 @@ public function createUsersWithArrayInputAction(Request $request) { // Make sure that the client is providing something that we can consume $consumes = []; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -153,6 +152,7 @@ public function createUsersWithArrayInputAction(Request $request) // Deserialize the input values that needs it try { + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'array<OpenAPI\Server\Model\User>', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -217,8 +217,7 @@ public function createUsersWithListInputAction(Request $request) { // Make sure that the client is providing something that we can consume $consumes = []; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -232,6 +231,7 @@ public function createUsersWithListInputAction(Request $request) // Deserialize the input values that needs it try { + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'array<OpenAPI\Server\Model\User>', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); @@ -592,8 +592,7 @@ public function updateUserAction(Request $request, $username) { // Make sure that the client is providing something that we can consume $consumes = []; - $inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0]; - if (!in_array($inputFormat, $consumes)) { + if (!static::isContentTypeAllowed($request, $consumes)) { // We can't consume the content that the client is sending us return new Response('', 415); } @@ -608,6 +607,7 @@ public function updateUserAction(Request $request, $username) // Deserialize the input values that needs it try { $username = $this->deserialize($username, 'string', 'string'); + $inputFormat = $request->getMimeType($request->getContentType()); $body = $this->deserialize($body, 'OpenAPI\Server\Model\User', $inputFormat); } catch (SerializerRuntimeException $exception) { return $this->createBadRequestResponse($exception->getMessage()); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php index 91b849f2b273..de5c77400fe2 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php @@ -85,7 +85,7 @@ public function testAddPet() $path = '/pet'; - $crawler = $client->request('POST', $path); + $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } /** @@ -166,7 +166,7 @@ public function testUpdatePet() $path = '/pet'; - $crawler = $client->request('PUT', $path); + $crawler = $client->request('PUT', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } /** diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php index 919d30cf9a1e..9d10d568921b 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php @@ -136,7 +136,7 @@ public function testPlaceOrder() $path = '/store/order'; - $crawler = $client->request('POST', $path); + $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } protected function genTestData($regexp) diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php index 6f2e3ba0b6ce..775ec6704221 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php @@ -85,7 +85,7 @@ public function testCreateUser() $path = '/user'; - $crawler = $client->request('POST', $path); + $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } /** @@ -100,7 +100,7 @@ public function testCreateUsersWithArrayInput() $path = '/user/createWithArray'; - $crawler = $client->request('POST', $path); + $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } /** @@ -115,7 +115,7 @@ public function testCreateUsersWithListInput() $path = '/user/createWithList'; - $crawler = $client->request('POST', $path); + $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } /** @@ -199,7 +199,7 @@ public function testUpdateUser() $data = $this->genTestData('[a-z0-9]+'); $path = str_replace($pattern, $data, $path); - $crawler = $client->request('PUT', $path); + $crawler = $client->request('PUT', $path, [], [], ['CONTENT_TYPE' => 'application/json']); } protected function genTestData($regexp) diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php new file mode 100644 index 000000000000..e23c4afc7ca8 --- /dev/null +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php @@ -0,0 +1,123 @@ +<?php +/** + * ControllerTest + * PHP version 5 + * + * @category Class + * @package OpenAPI\Server\Tests\Controller + * @author openapi-generator contributors + * @link https://github.com/openapitools/openapi-generator + */ + +/** + * 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 + * + */ + +/** + * NOTE: This class is auto generated by the openapi generator program. + * https://github.com/openapitools/openapi-generator + * Please update the test case below to test the endpoint. + */ + +namespace OpenAPI\Server\Tests\Controller; + +use OpenAPI\Server\Controller\Controller; +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; + +/** + * ControllerTest Class Doc Comment + * + * @category Class + * @package OpenAPI\Server\Tests\Controller + * @author openapi-generator contributors + * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Controller\Controller + */ +class ControllerTest extends TestCase +{ + + /** + * Tests isContentTypeAllowed static method. + * + * @param string $contentType + * @param array $consumes + * @param bool $expectedReturn + * + * @covers ::isContentTypeAllowed + * @dataProvider provideArgumentsForIsContentTypeAllowed + */ + public function testIsContentTypeAllowed($contentType, array $consumes, $expectedReturn) + { + $request = new Request(); + $request->headers->set('CONTENT_TYPE', $contentType, true);// last one argument overrides header + $this->assertSame( + $expectedReturn, + Controller::isContentTypeAllowed($request, $consumes), + sprintf( + 'Failed assertion that "Content-Type: %s" %s by [%s] consumes array.', + $contentType, + ($expectedReturn) ? 'is allowed' : 'is forbidden', + implode(', ', $consumes) + ) + ); + } + + public function provideArgumentsForIsContentTypeAllowed() + { + return [ + 'usual JSON content type' => [ + 'application/json', + ['application/json'], + true, + ], + 'extended content type from PR #6078' => [ + 'application/json; charset=utf-8', + ['application/json'], + true, + ], + 'more than one content types' => [ + 'application/json', + ['application/xml', 'application/json; charset=utf-8'], + true, + ], + 'empty consumes array' => [ + 'application/json', + [], + true, + ], + 'empty consumes and content type' => [ + null, + [], + true, + ], + 'consumes everything' => [ + 'application/json', + ['*/*'], + true, + ], + 'fancy custom content type' => [ + 'foobar/foobaz', + ['application/xml', 'foobar/foobaz; charset=utf-8'], + true, + ], + 'empty content type' => [ + null, + ['application/xml', 'application/json; charset=utf-8'], + false, + ], + 'content type out of consumes' => [ + 'text/html', + ['application/xml', 'application/json; charset=utf-8'], + false, + ], + ]; + } +} diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist b/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist index 6f8b5ca0f932..38a8370fec6a 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist @@ -9,12 +9,14 @@ <testsuite> <directory>./Tests/Api</directory> <directory>./Tests/Model</directory> + <directory>./Tests/Controller</directory> </testsuite> </testsuites> <filter> <whitelist processUncoveredFilesFromWhitelist="true"> <directory suffix=".php">././Api</directory> <directory suffix=".php">././Model</directory> + <directory suffix=".php">././Controller</directory> </whitelist> </filter> <php> From cc623ba4298fdac1c949e231edfdb0afb3e665f9 Mon Sep 17 00:00:00 2001 From: Jim Schubert <james.schubert@gmail.com> Date: Thu, 30 Apr 2020 08:49:07 -0400 Subject: [PATCH 39/78] [cli][build] Relax the git id plugin (#6094) * [cli][build] Relax the git id plugin * Guard against null on missing build properties --- .../openapitools/codegen/cmd/BuildInfo.java | 25 +++++++++++++------ modules/openapi-generator/pom.xml | 2 ++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/BuildInfo.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/BuildInfo.java index cfb0981d897a..7d7c72b7f2f9 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/BuildInfo.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/BuildInfo.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.InputStream; +import java.time.DateTimeException; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -23,15 +24,19 @@ public class BuildInfo { static { try (InputStream is = BuildInfo.class.getResourceAsStream("/version.properties")) { - Properties versionProps = new Properties(); - versionProps.load(is); - properties.putAll(versionProps); + if (is != null) { + Properties versionProps = new Properties(); + versionProps.load(is); + properties.putAll(versionProps); + } } catch (IOException ignored) { } try (InputStream is = BuildInfo.class.getResourceAsStream("/openapi-generator-git.properties")) { - Properties gitProps = new Properties(); - gitProps.load(is); - properties.putAll(gitProps); + if (is != null) { + Properties gitProps = new Properties(); + gitProps.load(is); + properties.putAll(gitProps); + } } catch (IOException ignored) { } } @@ -82,7 +87,13 @@ public String versionDisplayText() { StringBuilder sb = new StringBuilder(CLI_NAME); sb.append(" ").append(this.getVersion()).append(System.lineSeparator()); sb.append(" commit : ").append(this.getSha()).append(System.lineSeparator()); - sb.append(" built : ").append(this.getBuildTime().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)).append(System.lineSeparator()); + sb.append(" built : "); + try { + sb.append(this.getBuildTime().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); + } catch (DateTimeException e) { + sb.append(UNKNOWN); + } + sb.append(System.lineSeparator()); sb.append(" source : ").append(GIT_REPO).append(System.lineSeparator()); sb.append(" docs : ").append(SITE).append(System.lineSeparator()); return sb.toString(); diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 32a92e4eb360..a6a57e4426e2 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -65,6 +65,8 @@ </includeOnlyProperties> <commitIdGenerationMode>full</commitIdGenerationMode> <dotGitDirectory>${project.parent.basedir}${file.separator}.git</dotGitDirectory> + <failOnNoGitDirectory>false</failOnNoGitDirectory> + <failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo> </configuration> </plugin> <plugin> From 3bbaedd9bc086028e7b1be973a30e04870962e5d Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 30 Apr 2020 21:23:55 +0800 Subject: [PATCH 40/78] Better "Any Type" support (#6091) * better anytype support * add tests for any type * fix test with any_value * fix tests * fix case additionalProperties: {} * test with CI * remove check in map schema * Revert "remove check in map schema" This reverts commit e016c4155f1bd8753e894d87bad8e70eee29f3d5. * fix tests, comment out map schema fix * fix tests * fix tests with correct codegen model * fix tests * fix tests for map of any type * fix array of any type * fix array of any type * update samples, remove log * add typemapping to go, python --- .../codegen/CodegenParameter.java | 7 +- .../openapitools/codegen/CodegenResponse.java | 5 +- .../openapitools/codegen/DefaultCodegen.java | 182 +++++------------- .../codegen/languages/AbstractGoCodegen.java | 1 + .../languages/PythonClientCodegen.java | 1 + .../codegen/utils/ModelUtils.java | 39 ++-- .../codegen/java/JavaClientCodegenTest.java | 145 +++++++++++++- .../src/test/resources/3_0/any_type.yaml | 59 ++++++ .../src/test/resources/3_0/issue796.yaml | 11 +- .../go-experimental/go-petstore/docs/User.md | 4 +- 10 files changed, 302 insertions(+), 152 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/any_type.yaml 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 7072df85be8a..fda66803235c 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 @@ -34,7 +34,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { public String example; // example value (x-example) public String jsonSchema; public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, - isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject; + isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType; public boolean isListContainer, isMapContainer; public boolean isFile; public boolean isEnum; @@ -178,6 +178,7 @@ public CodegenParameter copy() { output.isUri = this.isUri; output.isEmail = this.isEmail; output.isFreeFormObject = this.isFreeFormObject; + output.isAnyType = this.isAnyType; output.isListContainer = this.isListContainer; output.isMapContainer = this.isMapContainer; output.isExplode = this.isExplode; @@ -188,7 +189,7 @@ public CodegenParameter copy() { @Override public int hashCode() { - return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isListContainer, isMapContainer, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), multipleOf); + return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isListContainer, isMapContainer, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), multipleOf); } @Override @@ -225,6 +226,7 @@ public boolean equals(Object o) { isUri == that.isUri && isEmail == that.isEmail && isFreeFormObject == that.isFreeFormObject && + isAnyType == that.isAnyType && isListContainer == that.isListContainer && isMapContainer == that.isMapContainer && isFile == that.isFile && @@ -312,6 +314,7 @@ public String toString() { sb.append(", isUri=").append(isUri); sb.append(", isEmail=").append(isEmail); sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isAnyType=").append(isAnyType); sb.append(", isListContainer=").append(isListContainer); sb.append(", isMapContainer=").append(isMapContainer); sb.append(", isFile=").append(isFile); 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 1edad97316f6..9e9d28958af3 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 @@ -49,6 +49,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public boolean isEmail; public boolean isModel; public boolean isFreeFormObject; + public boolean isAnyType; public boolean isDefault; public boolean simpleType; public boolean primitiveType; @@ -77,7 +78,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public int hashCode() { return Objects.hash(headers, code, message, hasMore, examples, dataType, baseType, containerType, hasHeaders, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBoolean, isDate, - isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isDefault, simpleType, primitiveType, + isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType, isMapContainer, isListContainer, isBinary, isFile, schema, jsonSchema, vendorExtensions, getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(), getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern()); @@ -105,6 +106,7 @@ public boolean equals(Object o) { isEmail == that.isEmail && isModel == that.isModel && isFreeFormObject == that.isFreeFormObject && + isAnyType == that.isAnyType && isDefault == that.isDefault && simpleType == that.simpleType && primitiveType == that.primitiveType && @@ -295,6 +297,7 @@ public String toString() { sb.append(", isEmail=").append(isEmail); sb.append(", isModel=").append(isModel); sb.append(", isFreeFormObject=").append(isFreeFormObject); + sb.append(", isAnyType=").append(isAnyType); sb.append(", isDefault=").append(isDefault); sb.append(", simpleType=").append(simpleType); sb.append(", primitiveType=").append(primitiveType); 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 d4cc25414375..2480fa24fc92 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 @@ -1122,7 +1122,7 @@ public Boolean getLegacyDiscriminatorBehavior() { return legacyDiscriminatorBehavior; } - public void setLegacyDiscriminatorBehavior(boolean val){ + public void setLegacyDiscriminatorBehavior(boolean val) { this.legacyDiscriminatorBehavior = val; } @@ -1398,6 +1398,7 @@ public DefaultCodegen() { typeMapping.put("UUID", "UUID"); typeMapping.put("URI", "URI"); typeMapping.put("BigDecimal", "BigDecimal"); + typeMapping.put("AnyType", "oas_any_type_not_mapped"); instantiationTypes = new HashMap<String, String>(); @@ -1863,9 +1864,9 @@ public String toAnyOfName(List<String> names, ComposedSchema composedSchema) { /** * Return the name of the oneOf schema. - * + * <p> * This name is used to set the value of CodegenProperty.openApiType. - * + * <p> * If the 'x-one-of-name' extension is specified in the OAS document, return that value. * Otherwise, a name is constructed by creating a comma-separated list of all the names * of the oneOf schemas. @@ -1981,6 +1982,8 @@ private String getPrimitiveType(Schema schema) { return "object"; } else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) { // having property implies it's a model return "object"; + } else if (ModelUtils.isAnyTypeSchema(schema)) { + return "AnyType"; } else if (StringUtils.isNotEmpty(schema.getType())) { LOGGER.warn("Unknown type found in the schema: " + schema.getType()); return schema.getType(); @@ -2398,8 +2401,8 @@ public CodegenModel fromModel(String name, Schema schema) { listOLists.add(m.requiredVars); listOLists.add(m.vars); listOLists.add(m.allVars); - for (List<CodegenProperty> theseVars: listOLists) { - for (CodegenProperty requiredVar: theseVars) { + for (List<CodegenProperty> theseVars : listOLists) { + for (CodegenProperty requiredVar : theseVars) { if (discPropName.equals(requiredVar.baseName)) { requiredVar.isDiscriminator = true; } @@ -2427,9 +2430,10 @@ public int compare(CodegenProperty one, CodegenProperty another) { * Recursively look in Schema sc for the discriminator discPropName * and return a CodegenProperty with the dataType and required params set * the returned CodegenProperty may not be required and it may not be of type string + * * @param composedSchemaName The name of the sc Schema - * @param sc The Schema that may contain the discriminator - * @param discPropName The String that is the discriminator propertyName in the schema + * @param sc The Schema that may contain the discriminator + * @param discPropName The String that is the discriminator propertyName in the schema */ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, String discPropName, OpenAPI openAPI) { Schema refSchema = ModelUtils.getReferencedSchema(openAPI, sc); @@ -2449,7 +2453,7 @@ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, ComposedSchema composedSchema = (ComposedSchema) refSchema; if (composedSchema.getAllOf() != null) { // If our discriminator is in one of the allOf schemas break when we find it - for (Schema allOf: composedSchema.getAllOf()) { + for (Schema allOf : composedSchema.getAllOf()) { CodegenProperty cp = discriminatorFound(composedSchemaName, allOf, discPropName, openAPI); if (cp != null) { return cp; @@ -2459,18 +2463,18 @@ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, if (composedSchema.getOneOf() != null && composedSchema.getOneOf().size() != 0) { // All oneOf definitions must contain the discriminator CodegenProperty cp = new CodegenProperty(); - for (Schema oneOf: composedSchema.getOneOf()) { + for (Schema oneOf : composedSchema.getOneOf()) { String modelName = ModelUtils.getSimpleRef(oneOf.get$ref()); CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI); if (thisCp == null) { - throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing "+discPropName); + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName); } if (cp.dataType == null) { cp = thisCp; continue; } if (cp != thisCp) { - throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different "+discPropName+" definition than the prior OneOf schema's. Make sure the "+discPropName+" type and required values are the same"); + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior OneOf schema's. Make sure the " + discPropName + " type and required values are the same"); } } return cp; @@ -2478,18 +2482,18 @@ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, if (composedSchema.getAnyOf() != null && composedSchema.getAnyOf().size() != 0) { // All anyOf definitions must contain the discriminator because a min of one must be selected CodegenProperty cp = new CodegenProperty(); - for (Schema anyOf: composedSchema.getAnyOf()) { + for (Schema anyOf : composedSchema.getAnyOf()) { String modelName = ModelUtils.getSimpleRef(anyOf.get$ref()); CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI); if (thisCp == null) { - throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing "+discPropName); + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName); } if (cp.dataType == null) { cp = thisCp; continue; } if (cp != thisCp) { - throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different "+discPropName+" definition than the prior AnyOf schema's. Make sure the "+discPropName+" type and required values are the same"); + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior AnyOf schema's. Make sure the " + discPropName + " type and required values are the same"); } } return cp; @@ -2503,6 +2507,7 @@ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc, * Recursively look in Schema sc for the discriminator and return it * Schema sc location * OpenAPI openAPI the spec where we are searching for the discriminator + * * @param sc The Schema that may contain the discriminator */ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { @@ -2519,7 +2524,7 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { ComposedSchema composedSchema = (ComposedSchema) refSchema; if (composedSchema.getAllOf() != null) { // If our discriminator is in one of the allOf schemas break when we find it - for (Schema allOf: composedSchema.getAllOf()) { + for (Schema allOf : composedSchema.getAllOf()) { foundDisc = recursiveGetDiscriminator(allOf, openAPI); if (foundDisc != null) { disc.setPropertyName(foundDisc.getPropertyName()); @@ -2532,7 +2537,7 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { // All oneOf definitions must contain the discriminator Integer hasDiscriminatorCnt = 0; Set<String> discriminatorsPropNames = new HashSet<>(); - for (Schema oneOf: composedSchema.getOneOf()) { + for (Schema oneOf : composedSchema.getOneOf()) { foundDisc = recursiveGetDiscriminator(oneOf, openAPI); if (foundDisc != null) { discriminatorsPropNames.add(foundDisc.getPropertyName()); @@ -2549,7 +2554,7 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { // All anyOf definitions must contain the discriminator because a min of one must be selected Integer hasDiscriminatorCnt = 0; Set<String> discriminatorsPropNames = new HashSet<>(); - for (Schema anyOf: composedSchema.getAnyOf()) { + for (Schema anyOf : composedSchema.getAnyOf()) { foundDisc = recursiveGetDiscriminator(anyOf, openAPI); if (foundDisc != null) { discriminatorsPropNames.add(foundDisc.getPropertyName()); @@ -2573,10 +2578,11 @@ private Discriminator recursiveGetDiscriminator(Schema sc, OpenAPI openAPI) { * the required discriminator. If they don't contain the required * discriminator or the discriminator is the wrong type then an error is * thrown + * * @param composedSchemaName The String model name of the composed schema where we are setting the discriminator map - * @param discPropName The String that is the discriminator propertyName in the schema - * @param c The ComposedSchema that contains the discriminator and oneOf/anyOf schemas - * @param openAPI The OpenAPI spec that we are using + * @param discPropName The String that is the discriminator propertyName in the schema + * @param c The ComposedSchema that contains the discriminator and oneOf/anyOf schemas + * @param openAPI The OpenAPI spec that we are using * @return the list of oneOf and anyOf MappedModel that need to be added to the discriminator map */ protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, ComposedSchema c, OpenAPI openAPI) { @@ -2584,11 +2590,11 @@ protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, listOLists.add(c.getOneOf()); listOLists.add(c.getAnyOf()); List<MappedModel> descendentSchemas = new ArrayList(); - for (List<Schema> schemaList: listOLists) { + for (List<Schema> schemaList : listOLists) { if (schemaList == null) { continue; } - for (Schema sc: schemaList) { + for (Schema sc : schemaList) { String ref = sc.get$ref(); if (ref == null) { // for schemas with no ref, it is not possible to build the discriminator map @@ -2604,20 +2610,20 @@ protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, if (df == null || !df.isString || df.required != true) { String msgSuffix = ""; if (df == null) { - msgSuffix += discPropName+" is missing from the schema, define it as required and type string"; + msgSuffix += discPropName + " is missing from the schema, define it as required and type string"; } else { if (!df.isString) { - msgSuffix += "invalid type for "+discPropName+", set it to string"; + msgSuffix += "invalid type for " + discPropName + ", set it to string"; } if (df.required != true) { String spacer = ""; if (msgSuffix.length() != 0) { spacer = ". "; } - msgSuffix += spacer+"invalid optional definition of "+discPropName+", include it in required"; + msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required"; } } - throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. "+msgSuffix); + throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix); } MappedModel mm = new MappedModel(modelName, toModelName(modelName)); descendentSchemas.add(mm); @@ -2635,7 +2641,7 @@ protected List<MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, } protected List<MappedModel> getAllOfDescendants(String thisSchemaName, OpenAPI openAPI) { - ArrayList<String> queue = new ArrayList();; + ArrayList<String> queue = new ArrayList(); List<MappedModel> descendentSchemas = new ArrayList(); Map<String, Schema> schemas = ModelUtils.getSchemas(openAPI); String currentSchemaName = thisSchemaName; @@ -2649,7 +2655,7 @@ protected List<MappedModel> getAllOfDescendants(String thisSchemaName, OpenAPI o ComposedSchema composedChild = (ComposedSchema) child; List<Schema> parents = composedChild.getAllOf(); if (parents != null) { - for (Schema parent: parents) { + for (Schema parent : parents) { String ref = parent.get$ref(); if (ref == null) { // for schemas with no ref, it is not possible to build the discriminator map @@ -2661,7 +2667,7 @@ protected List<MappedModel> getAllOfDescendants(String thisSchemaName, OpenAPI o String parentName = ModelUtils.getSimpleRef(ref); if (parentName.equals(currentSchemaName)) { if (queue.contains(childName) || descendentSchemas.contains(childName)) { - throw new RuntimeException("Stack overflow hit when looking for "+thisSchemaName+" an infinite loop starting and ending at "+childName+" was seen"); + throw new RuntimeException("Stack overflow hit when looking for " + thisSchemaName + " an infinite loop starting and ending at " + childName + " was seen"); } queue.add(childName); break; @@ -2714,7 +2720,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch if (!this.getLegacyDiscriminatorBehavior() || legacyUseCase) { // for schemas that allOf inherit from this schema, add those descendants to this discriminator map List<MappedModel> otherDescendants = getAllOfDescendants(schemaName, openAPI); - for (MappedModel otherDescendant: otherDescendants) { + for (MappedModel otherDescendant : otherDescendants) { if (!uniqueDescendants.contains(otherDescendant)) { uniqueDescendants.add(otherDescendant); } @@ -2723,7 +2729,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch // if there are composed oneOf/anyOf schemas, add them to this discriminator if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) { List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discPropName, (ComposedSchema) schema, openAPI); - for (MappedModel otherDescendant: otherDescendants) { + for (MappedModel otherDescendant : otherDescendants) { if (!uniqueDescendants.contains(otherDescendant)) { uniqueDescendants.add(otherDescendant); } @@ -2968,6 +2974,8 @@ public CodegenProperty fromProperty(String name, Schema p) { } else if (ModelUtils.isFreeFormObject(p)) { property.isFreeFormObject = true; + } else if (ModelUtils.isAnyTypeSchema(p)) { + property.isAnyType = true; } else if (ModelUtils.isArraySchema(p)) { // default to string if inner item is undefined ArraySchema arraySchema = (ArraySchema) p; @@ -3074,18 +3082,13 @@ public CodegenProperty fromProperty(String name, Schema p) { } else if (ModelUtils.isFreeFormObject(p)) { property.isFreeFormObject = true; property.baseType = getSchemaType(p); + } else if (ModelUtils.isAnyTypeSchema(p)) { + property.isAnyType = true; + property.baseType = getSchemaType(p); } else { // model - // TODO revise the logic below - //if (StringUtils.isNotBlank(p.get$ref())) { - // property.baseType = getSimpleRef(p.get$ref()); - //} - // --END of revision setNonArrayMapProperty(property, type); Schema refOrCurrent = ModelUtils.getReferencedSchema(this.openAPI, p); property.isModel = (ModelUtils.isComposedSchema(refOrCurrent) || ModelUtils.isObjectSchema(refOrCurrent)) && ModelUtils.isModel(refOrCurrent); - if (ModelUtils.isAnyTypeSchema(p)) { - property.isAnyType = true; - } } LOGGER.debug("debugging from property return: " + property); @@ -3773,6 +3776,8 @@ public CodegenResponse fromResponse(String responseCode, ApiResponse response) { r.isDateTime = true; } else if (Boolean.TRUE.equals(cp.isFreeFormObject)) { r.isFreeFormObject = true; + } else if (Boolean.TRUE.equals(cp.isAnyType)) { + r.isAnyType = true; } else { LOGGER.debug("Property type is not primitive: " + cp.dataType); } @@ -4074,91 +4079,6 @@ public CodegenParameter fromParameter(Parameter parameter, Set<String> imports) } else { LOGGER.error("ERROR! Not handling " + parameter + " as Body Parameter at the moment"); - /* TODO need to revise the logic below to handle body parameter - if (!(parameter instanceof BodyParameter)) { - LOGGER.error("Cannot use Parameter " + parameter + " as Body Parameter"); - } - - BodyParameter bp = (BodyParameter) param; - Model model = bp.getSchema(); - - if (model instanceof ModelImpl) { - ModelImpl impl = (ModelImpl) model; - CodegenModel cm = fromModel(bp.getName(), impl); - if (!cm.emptyVars) { - codegen.dataType = getTypeDeclaration(cm.classname); - imports.add(p.dataType); - } else { - Property prop = PropertyBuilder.build(impl.getType(), impl.getFormat(), null); - prop.setRequired(bp.getRequired()); - CodegenProperty cp = fromProperty("property", prop); - if (cp != null) { - p.baseType = cp.baseType; - p.dataType = cp.datatype; - p.isPrimitiveType = cp.isPrimitiveType; - p.isBinary = isDataTypeBinary(cp.datatype); - p.isFile = isDataTypeFile(cp.datatype); - if (cp.complexType != null) { - imports.add(cp.complexType); - } - } - - // set boolean flag (e.g. isString) - setParameterBooleanFlagWithCodegenProperty(p, cp); - } - } else if (model instanceof ArrayModel) { - // to use the built-in model parsing, we unwrap the ArrayModel - // and get a single property from it - ArrayModel impl = (ArrayModel) model; - // get the single property - ArrayProperty ap = new ArrayProperty().items(impl.getItems()); - ap.setRequired(param.getRequired()); - CodegenProperty cp = fromProperty("inner", ap); - if (cp.complexType != null) { - imports.add(cp.complexType); - } - imports.add(cp.baseType); - - // recursively add import - CodegenProperty innerCp = cp; - while(innerCp != null) { - if(innerCp.complexType != null) { - imports.add(innerCp.complexType); - } - innerCp = innerCp.items; - } - - p.items = cp; - p.dataType = cp.datatype; - p.baseType = cp.complexType; - p.isPrimitiveType = cp.isPrimitiveType; - p.isContainer = true; - p.isListContainer = true; - - // set boolean flag (e.g. isString) - setParameterBooleanFlagWithCodegenProperty(p, cp); - } else { - Model sub = bp.getSchema(); - if (sub instanceof RefModel) { - String name = ((RefModel) sub).getSimpleRef(); - name = getAlias(name); - if (typeMapping.containsKey(name)) { - name = typeMapping.get(name); - p.baseType = name; - } else { - name = toModelName(name); - p.baseType = name; - if (defaultIncludes.contains(name)) { - imports.add(name); - } - imports.add(name); - name = getTypeDeclaration(name); - } - p.dataType = name; - } - } - p.paramName = toParamName(bp.getName()); - */ } if (parameter instanceof QueryParameter || "query".equalsIgnoreCase(parameter.getIn())) { @@ -5128,6 +5048,8 @@ public void setParameterBooleanFlagWithCodegenProperty(CodegenParameter paramete parameter.isPrimitiveType = true; } else if (Boolean.TRUE.equals(property.isFreeFormObject)) { parameter.isFreeFormObject = true; + } else if (Boolean.TRUE.equals(property.isAnyType)) { + parameter.isAnyType = true; } else { LOGGER.debug("Property type is not primitive: " + property.dataType); } @@ -5702,7 +5624,7 @@ private void addBodyModelSchema(CodegenParameter codegenParameter, String name, codegenParameter.dataType = getTypeDeclaration(codegenModelName); codegenParameter.description = codegenProperty.getDescription(); } else { - if (ModelUtils.getAdditionalProperties(schema) != null) {// http body is map + if (ModelUtils.isMapSchema(schema)) {// http body is map LOGGER.error("Map should be supported. Please report to openapi-generator github repo about the issue."); } else if (codegenProperty != null) { String codegenModelName, codegenModelDescription; @@ -5878,7 +5800,7 @@ public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, S setParameterNullable(codegenParameter, codegenProperty); } else if (ModelUtils.isObjectSchema(schema) || ModelUtils.isComposedSchema(schema)) { - this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false); + this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, false); } else { // HTTP request body is primitive type (e.g. integer, string, etc) CodegenProperty codegenProperty = fromProperty("PRIMITIVE_REQUEST_BODY", schema); @@ -5920,8 +5842,8 @@ public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, S return codegenParameter; } - private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body){ - if(codegenParameter.jsonSchema == null) + private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) { + if (codegenParameter.jsonSchema == null) codegenParameter.jsonSchema = Json.pretty(body); } @@ -6166,8 +6088,8 @@ public void addOneOfNameExtension(ComposedSchema s, String name) { /** * Add a given ComposedSchema as an interface model to be generated, assuming it has `oneOf` defined * - * @param cs ComposedSchema object to create as interface model - * @param type name to use for the generated interface model + * @param cs ComposedSchema object to create as interface model + * @param type name to use for the generated interface model * @param openAPI OpenAPI spec that we are using */ public void addOneOfInterfaceModel(ComposedSchema cs, String type, OpenAPI openAPI) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index d4c0a8514e6e..b018d22707a6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -130,6 +130,7 @@ public AbstractGoCodegen() { // See issue #5387 for more details. typeMapping.put("object", "map[string]interface{}"); typeMapping.put("interface{}", "interface{}"); + typeMapping.put("AnyType", "interface{}"); numberTypes = new HashSet<String>( Arrays.asList( diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 077676af99b0..74796111afd9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -134,6 +134,7 @@ public PythonClientCodegen() { typeMapping.put("date", "date"); typeMapping.put("DateTime", "datetime"); typeMapping.put("object", "object"); + typeMapping.put("AnyType", "object"); typeMapping.put("file", "file"); // TODO binary should be mapped to byte array // mapped to String as a workaround 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 6dbefe36db49..7092f2961715 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 @@ -118,7 +118,7 @@ public static List<String> getAllUsedSchemas(OpenAPI openAPI) { * @return schemas a list of unused schemas */ public static List<String> getUnusedSchemas(OpenAPI openAPI) { - final Map<String, List<String>> childrenMap; + final Map<String, List<String>> childrenMap; Map<String, List<String>> tmpChildrenMap; try { tmpChildrenMap = getChildrenMap(openAPI); @@ -661,7 +661,7 @@ public static boolean isModel(Schema schema) { * Return true if the schema value can be any type, i.e. it can be * the null value, integer, number, string, object or array. * One use case is when the "type" attribute in the OAS schema is unspecified. - * + * * Examples: * * arbitraryTypeValue: @@ -675,13 +675,19 @@ public static boolean isModel(Schema schema) { * nullable: true * * @param schema the OAS schema. - * @return true if the schema value can be an arbitrary type. + * @return true if the schema value can be an arbitrary type. */ public static boolean isAnyTypeSchema(Schema schema) { if (schema == null) { once(LOGGER).error("Schema cannot be null in isAnyTypeSchema check"); return false; } + + if (isFreeFormObject(schema)) { + // make sure it's not free form object + return false; + } + if (schema.getClass().equals(Schema.class) && schema.get$ref() == null && schema.getType() == null && (schema.getProperties() == null || schema.getProperties().isEmpty()) && schema.getAdditionalProperties() == null && schema.getNot() == null && @@ -702,7 +708,7 @@ public static boolean isAnyTypeSchema(Schema schema) { * 3) additionalproperties is not defined, or additionalproperties: true, or additionalproperties: {}. * * Examples: - * + * * components: * schemas: * arbitraryObject: @@ -719,7 +725,7 @@ public static boolean isAnyTypeSchema(Schema schema) { * arbitraryTypeValue: * description: This is NOT a free-form object. * The value can be any type except the 'null' value. - * + * * @param schema potentially containing a '$ref' * @return true if it's a free-form object */ @@ -754,6 +760,11 @@ public static boolean isFreeFormObject(Schema schema) { if (objSchema.getProperties() == null || objSchema.getProperties().isEmpty()) { return true; } + } else if (addlProps instanceof Schema) { + // additionalProperties defined as {} + if (addlProps.getType() == null && (addlProps.getProperties() == null || addlProps.getProperties().isEmpty())) { + return true; + } } } } @@ -986,7 +997,7 @@ private static Schema getSchemaFromContent(Content content) { // Other content types are currently ignored by codegen. If you see this warning, // reorder the OAS spec to put the desired content type first. once(LOGGER).warn("Multiple schemas found in the OAS 'content' section, returning only the first one ({})", - entry.getKey()); + entry.getKey()); } return entry.getValue().getSchema(); } @@ -1105,9 +1116,9 @@ public static Map<String, List<String>> getChildrenMap(OpenAPI openAPI) { Map<String, Schema> allSchemas = getSchemas(openAPI); Map<String, List<Entry<String, Schema>>> groupedByParent = allSchemas.entrySet().stream() - .filter(entry -> isComposedSchema(entry.getValue())) + .filter(entry -> isComposedSchema(entry.getValue())) .filter(entry -> getParentName((ComposedSchema) entry.getValue(), allSchemas)!=null) - .collect(Collectors.groupingBy(entry -> getParentName((ComposedSchema) entry.getValue(), allSchemas))); + .collect(Collectors.groupingBy(entry -> getParentName((ComposedSchema) entry.getValue(), allSchemas))); return groupedByParent.entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue().stream().map(e -> e.getKey()).collect(Collectors.toList()))); @@ -1205,8 +1216,8 @@ public static String getParentName(ComposedSchema composedSchema, Map<String, Sc if (refedWithoutDiscriminator.size() == 1) { if (hasAmbiguousParents) { LOGGER.warn("[deprecated] inheritance without use of 'discriminator.propertyName' is deprecated " + - "and will be removed in a future release. Generating model for composed schema name: {}. Title: {}", - composedSchema.getName(), composedSchema.getTitle()); + "and will be removed in a future release. Generating model for composed schema name: {}. Title: {}", + composedSchema.getName(), composedSchema.getTitle()); } return refedWithoutDiscriminator.get(0); } @@ -1269,12 +1280,10 @@ else if (StringUtils.isNotEmpty(schema.get$ref())) { Schema s = allSchemas.get(parentName); if (s != null) { return hasOrInheritsDiscriminator(s, allSchemas); - } - else { + } else { LOGGER.error("Failed to obtain schema from {}", parentName); } - } - else if (schema instanceof ComposedSchema) { + } else if (schema instanceof ComposedSchema) { final ComposedSchema composed = (ComposedSchema) schema; final List<Schema> interfaces = getInterfaces(composed); for (Schema i : interfaces) { @@ -1376,7 +1385,7 @@ public static boolean isNullType(Schema schema) { return false; } - public static void syncValidationProperties(Schema schema, IJsonSchemaValidationProperties target){ + public static void syncValidationProperties(Schema schema, IJsonSchemaValidationProperties target) { if (schema != null && target != null) { target.setPattern(schema.getPattern()); BigDecimal minimum = schema.getMinimum(); 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 38b75b750abe..fa3f2b152487 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 @@ -505,7 +505,7 @@ public void testFreeFormObjects() { codegen.setOpenAPI(openAPI); CodegenModel cm1 = codegen.fromModel("MapTest1", test1); Assert.assertEquals(cm1.getDataType(), "Map"); - Assert.assertEquals(cm1.getParent(), "HashMap<String, Object>"); + Assert.assertEquals(cm1.getParent(), "HashMap<String, oas_any_type_not_mapped>"); Assert.assertEquals(cm1.getClassname(), "MapTest1"); Schema test2 = openAPI.getComponents().getSchemas().get("MapTest2"); @@ -631,4 +631,147 @@ public void escapeName() { assertEquals("_int", codegen.toApiVarName("int")); assertEquals("pony", codegen.toApiVarName("pony")); } + + @Test + public void testAnyType() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/any_type.yaml"); + JavaClientCodegen codegen = new JavaClientCodegen(); + + Schema test1 = openAPI.getComponents().getSchemas().get("AnyValueModel"); + codegen.setOpenAPI(openAPI); + CodegenModel cm1 = codegen.fromModel("AnyValueModel", test1); + Assert.assertEquals(cm1.getClassname(), "AnyValueModel"); + + final CodegenProperty property1 = cm1.allVars.get(0); + Assert.assertEquals(property1.baseName, "any_value"); + Assert.assertEquals(property1.dataType, "oas_any_type_not_mapped"); + Assert.assertTrue(property1.hasMore); + Assert.assertFalse(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + Assert.assertFalse(property1.isFreeFormObject); + Assert.assertTrue(property1.isAnyType); + + final CodegenProperty property2 = cm1.allVars.get(1); + Assert.assertEquals(property2.baseName, "any_value_with_desc"); + Assert.assertEquals(property2.dataType, "oas_any_type_not_mapped"); + Assert.assertTrue(property2.hasMore); + Assert.assertFalse(property2.required); + Assert.assertFalse(property2.isPrimitiveType); + Assert.assertFalse(property2.isContainer); + Assert.assertFalse(property2.isFreeFormObject); + Assert.assertTrue(property2.isAnyType); + + final CodegenProperty property3 = cm1.allVars.get(2); + Assert.assertEquals(property3.baseName, "any_value_nullable"); + Assert.assertEquals(property3.dataType, "oas_any_type_not_mapped"); + Assert.assertFalse(property3.hasMore); + Assert.assertFalse(property3.required); + Assert.assertFalse(property3.isPrimitiveType); + Assert.assertFalse(property3.isContainer); + Assert.assertFalse(property3.isFreeFormObject); + Assert.assertTrue(property3.isAnyType); + + Schema test2 = openAPI.getComponents().getSchemas().get("AnyValueModelInline"); + codegen.setOpenAPI(openAPI); + CodegenModel cm2 = codegen.fromModel("AnyValueModelInline", test2); + Assert.assertEquals(cm2.getClassname(), "AnyValueModelInline"); + + final CodegenProperty cp1 = cm2.vars.get(0); + Assert.assertEquals(cp1.baseName, "any_value"); + Assert.assertEquals(cp1.dataType, "oas_any_type_not_mapped"); + Assert.assertTrue(cp1.hasMore); + Assert.assertFalse(cp1.required); + Assert.assertFalse(cp1.isPrimitiveType); + Assert.assertFalse(cp1.isContainer); + Assert.assertFalse(cp1.isFreeFormObject); + Assert.assertTrue(cp1.isAnyType); + + final CodegenProperty cp2 = cm2.vars.get(1); + Assert.assertEquals(cp2.baseName, "any_value_with_desc"); + Assert.assertEquals(cp2.dataType, "oas_any_type_not_mapped"); + Assert.assertTrue(cp2.hasMore); + Assert.assertFalse(cp2.required); + Assert.assertFalse(cp2.isPrimitiveType); + Assert.assertFalse(cp2.isContainer); + Assert.assertFalse(cp2.isFreeFormObject); + Assert.assertTrue(cp2.isAnyType); + + final CodegenProperty cp3 = cm2.vars.get(2); + Assert.assertEquals(cp3.baseName, "any_value_nullable"); + Assert.assertEquals(cp3.dataType, "oas_any_type_not_mapped"); + Assert.assertTrue(cp3.hasMore); + Assert.assertFalse(cp3.required); + Assert.assertFalse(cp3.isPrimitiveType); + Assert.assertFalse(cp3.isContainer); + Assert.assertFalse(cp3.isFreeFormObject); + Assert.assertTrue(cp3.isAnyType); + + // map + final CodegenProperty cp4 = cm2.vars.get(3); + Assert.assertEquals(cp4.baseName, "map_any_value"); + Assert.assertEquals(cp4.dataType, "Map<String, oas_any_type_not_mapped>"); + Assert.assertTrue(cp4.hasMore); + Assert.assertFalse(cp4.required); + Assert.assertFalse(cp4.isPrimitiveType); + Assert.assertTrue(cp4.isContainer); + Assert.assertTrue(cp4.isMapContainer); + Assert.assertTrue(cp4.isFreeFormObject); + Assert.assertFalse(cp4.isAnyType); + + final CodegenProperty cp5 = cm2.vars.get(4); + Assert.assertEquals(cp5.baseName, "map_any_value_with_desc"); + Assert.assertEquals(cp5.dataType, "Map<String, oas_any_type_not_mapped>"); + Assert.assertTrue(cp5.hasMore); + Assert.assertFalse(cp5.required); + Assert.assertFalse(cp5.isPrimitiveType); + Assert.assertTrue(cp5.isContainer); + Assert.assertTrue(cp5.isMapContainer); + Assert.assertTrue(cp5.isFreeFormObject); + Assert.assertFalse(cp5.isAnyType); + + final CodegenProperty cp6 = cm2.vars.get(5); + Assert.assertEquals(cp6.baseName, "map_any_value_nullable"); + Assert.assertEquals(cp6.dataType, "Map<String, oas_any_type_not_mapped>"); + Assert.assertTrue(cp6.hasMore); + Assert.assertFalse(cp6.required); + Assert.assertFalse(cp6.isPrimitiveType); + Assert.assertTrue(cp6.isContainer); + Assert.assertTrue(cp6.isMapContainer); + Assert.assertTrue(cp6.isFreeFormObject); + Assert.assertFalse(cp6.isAnyType); + + // array + final CodegenProperty cp7 = cm2.vars.get(6); + Assert.assertEquals(cp7.baseName, "array_any_value"); + Assert.assertEquals(cp7.dataType, "List<oas_any_type_not_mapped>"); + Assert.assertTrue(cp7.hasMore); + Assert.assertFalse(cp7.required); + Assert.assertFalse(cp7.isPrimitiveType); + Assert.assertTrue(cp7.isContainer); + Assert.assertTrue(cp7.isListContainer); + Assert.assertFalse(cp7.isFreeFormObject); + Assert.assertFalse(cp7.isAnyType); + + final CodegenProperty cp8 = cm2.vars.get(7); + Assert.assertEquals(cp8.baseName, "array_any_value_with_desc"); + Assert.assertEquals(cp8.dataType, "List<oas_any_type_not_mapped>"); + Assert.assertTrue(cp8.hasMore); + Assert.assertFalse(cp8.required); + Assert.assertFalse(cp8.isPrimitiveType); + Assert.assertTrue(cp8.isContainer); + Assert.assertTrue(cp8.isListContainer); + Assert.assertFalse(cp8.isFreeFormObject); + Assert.assertFalse(cp8.isAnyType); + + final CodegenProperty cp9 = cm2.vars.get(8); + Assert.assertEquals(cp9.baseName, "array_any_value_nullable"); + Assert.assertEquals(cp9.dataType, "List<oas_any_type_not_mapped>"); + Assert.assertFalse(cp9.hasMore); + Assert.assertFalse(cp9.required); + Assert.assertFalse(cp9.isPrimitiveType); + Assert.assertTrue(cp9.isContainer); + Assert.assertTrue(cp9.isListContainer); + Assert.assertFalse(cp9.isFreeFormObject); + Assert.assertFalse(cp9.isAnyType); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/any_type.yaml b/modules/openapi-generator/src/test/resources/3_0/any_type.yaml new file mode 100644 index 000000000000..870633cce56c --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/any_type.yaml @@ -0,0 +1,59 @@ +openapi: 3.0.1 +info: + title: ping test + version: '1.0' +servers: + - url: 'http://localhost:8000/' +paths: + /ping: + get: + operationId: pingGet + responses: + '201': + description: OK +components: + schemas: + AnyValue: {} + AnyValueWithDesc: + description: Can be any value - string, number, boolean, array or object. + AnyValueNullable: + nullable: true + description: Can be any value, including `null`. + AnyValueModel: + description: test any value + type: object + properties: + any_value: + $ref: '#/components/schemas/AnyValue' + any_value_with_desc: + $ref: '#/components/schemas/AnyValueWithDesc' + any_value_nullable: + $ref: '#/components/schemas/AnyValueNullable' + AnyValueModelInline: + description: test any value inline + type: object + properties: + any_value: {} + any_value_with_desc: + description: inline any value + any_value_nullable: + nullable: true + description: inline any value nullable + map_any_value: + additionalProperties: {} + map_any_value_with_desc: + additionalProperties: + description: inline any value + map_any_value_nullable: + additionalProperties: + nullable: true + description: inline any value nullable + array_any_value: + items: {} + array_any_value_with_desc: + items: + description: inline any value + array_any_value_nullable: + items: + nullable: true + description: inline any value nullable diff --git a/modules/openapi-generator/src/test/resources/3_0/issue796.yaml b/modules/openapi-generator/src/test/resources/3_0/issue796.yaml index 6ed6f3756e75..7d8d142059c5 100644 --- a/modules/openapi-generator/src/test/resources/3_0/issue796.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/issue796.yaml @@ -34,4 +34,13 @@ components: type: object description: This type example 4 additionalProperties: false - + MapObject: + properties: + map_test1: + $ref: '#/components/schemas/MapTest1' + map_test2: + $ref: '#/components/schemas/MapTest2' + map_test3: + $ref: '#/components/schemas/MapTest3' + other_obj: + $ref: '#/components/schemas/OtherObj' \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/User.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/User.md index 4a78be2ab845..f40be495a5ab 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/User.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/User.md @@ -14,8 +14,8 @@ Name | Type | Description | Notes **UserStatus** | Pointer to **int32** | User Status | [optional] **ArbitraryObject** | Pointer to [**map[string]interface{}**](.md) | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] **ArbitraryNullableObject** | Pointer to [**map[string]interface{}**](.md) | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] -**ArbitraryTypeValue** | Pointer to **interface{}** | test code generation for any type Value can be any type - string, number, boolean, array or object. | [optional] -**ArbitraryNullableTypeValue** | Pointer to **interface{}** | test code generation for any type Value can be any type - string, number, boolean, array, object or the 'null' value. | [optional] +**ArbitraryTypeValue** | Pointer to [**interface{}**](.md) | test code generation for any type Value can be any type - string, number, boolean, array or object. | [optional] +**ArbitraryNullableTypeValue** | Pointer to [**interface{}**](.md) | test code generation for any type Value can be any type - string, number, boolean, array, object or the 'null' value. | [optional] ## Methods From 0032e045301cd741758c90dc82ec8c37fa721ecd Mon Sep 17 00:00:00 2001 From: Artem <reznikartem@gmail.com> Date: Thu, 30 Apr 2020 21:03:05 +0200 Subject: [PATCH 41/78] [php-symfony] Fix return type in model setters. (#6085) * Fix return type in model setters. Previously return type was same, as method arguments. It`s wrong, and cause errors like "Return value of Foo::setSuccess() must be of the type bool, object returned" We cant use self and current {{classname}} as return type, because that can break class inheritance. So, better remove type hint on setters, until PHP-devs dont make realization for return static * Add return self type hint for setters * Revert "Add return self type hint for setters" This reverts commit 07dd9715 --- .../src/main/resources/php-symfony/model_generic.mustache | 2 +- .../petstore/php-symfony/SymfonyBundle-php/Model/Order.php | 2 +- .../petstore/php-symfony/SymfonyBundle-php/Model/Pet.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache b/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache index 15b9cedab671..54b34b9f903d 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/model_generic.mustache @@ -35,7 +35,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}} * * @return $this */ - public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}){{#vendorExtensions.x-parameter-type}}: {{^required}}?{{/required}}{{vendorExtensions.x-parameter-type}}{{/vendorExtensions.x-parameter-type}} + public function {{setter}}({{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{name}}{{^required}} = null{{/required}}) { $this->{{name}} = ${{name}}; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php index 1dce20ccc27a..c79445f90cfd 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php @@ -197,7 +197,7 @@ public function getShipDate(): ?\DateTime * * @return $this */ - public function setShipDate(\DateTime $shipDate = null): ?\DateTime + public function setShipDate(\DateTime $shipDate = null) { $this->shipDate = $shipDate; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php index cd9d321ca4af..d97cfb942a4a 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php @@ -155,7 +155,7 @@ public function getCategory(): ?Category * * @return $this */ - public function setCategory(Category $category = null): ?Category + public function setCategory(Category $category = null) { $this->category = $category; @@ -203,7 +203,7 @@ public function getPhotoUrls(): array * * @return $this */ - public function setPhotoUrls(array $photoUrls): array + public function setPhotoUrls(array $photoUrls) { $this->photoUrls = $photoUrls; @@ -227,7 +227,7 @@ public function getTags(): ?array * * @return $this */ - public function setTags(array $tags = null): ?array + public function setTags(array $tags = null) { $this->tags = $tags; From b23c52f2caa100432d20bdaf5c5d78becdfb3970 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 1 May 2020 10:50:01 +0800 Subject: [PATCH 42/78] [Go][experimental] provide code samples in the API doc (#6115) * provide code samples in api doc * update petstore samples --- .../GoClientExperimentalCodegen.java | 169 +++++++- .../go-experimental/api_doc.mustache | 31 ++ .../go-petstore/docs/AnotherFakeApi.md | 27 ++ .../go-petstore/docs/FakeApi.md | 391 +++++++++++++++++ .../docs/FakeClassnameTags123Api.md | 27 ++ .../go-petstore/docs/PetApi.md | 242 +++++++++++ .../go-petstore/docs/StoreApi.md | 105 +++++ .../go-petstore/docs/UserApi.md | 205 +++++++++ .../go-petstore/docs/AnotherFakeApi.md | 27 ++ .../go-petstore/docs/DefaultApi.md | 26 ++ .../go-petstore/docs/FakeApi.md | 392 ++++++++++++++++++ .../docs/FakeClassnameTags123Api.md | 27 ++ .../go-petstore/docs/PetApi.md | 242 +++++++++++ .../go-petstore/docs/StoreApi.md | 105 +++++ .../go-petstore/docs/UserApi.md | 205 +++++++++ 15 files changed, 2215 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java index 89e189c8c388..0bea07e4dba7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java @@ -18,10 +18,8 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.security.SecurityScheme; -import org.openapitools.codegen.CodegenModel; -import org.openapitools.codegen.CodegenProperty; -import org.openapitools.codegen.CodegenSecurity; -import org.openapitools.codegen.SupportingFile; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.utils.ModelUtils; @@ -36,6 +34,7 @@ public class GoClientExperimentalCodegen extends GoClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(GoClientExperimentalCodegen.class); + protected String goImportAlias = "openapiclient"; public GoClientExperimentalCodegen() { super(); @@ -83,11 +82,22 @@ public void processOpts() { // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. Map<String, SecurityScheme> securitySchemeMap = openAPI != null ? - (openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null; + (openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null; List<CodegenSecurity> authMethods = fromSecurity(securitySchemeMap); if (ProcessUtils.hasHttpSignatureMethods(authMethods)) { supportingFiles.add(new SupportingFile("signing.mustache", "", "signing.go")); } + + if (additionalProperties.containsKey("goImportAlias")) { + setGoImportAlias(additionalProperties.get("goImportAlias").toString()); + } else { + additionalProperties.put("goImportAlias", goImportAlias); + } + + } + + public void setGoImportAlias(String goImportAlias) { + this.goImportAlias = goImportAlias; } @Override @@ -180,7 +190,7 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) { param.dataType = "NullableTime"; } else { param.dataType = "Nullable" + Character.toUpperCase(param.dataType.charAt(0)) - + param.dataType.substring(1); + + param.dataType.substring(1); } } } @@ -199,4 +209,151 @@ public void addImportsToOneOfInterface(List<Map<String, String>> imports) { } } } + + @Override + public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { + objs = super.postProcessOperationsWithModels(objs, allModels); + Map<String, Object> operations = (Map<String, Object>) objs.get("operations"); + HashMap<String, CodegenModel> modelMaps = new HashMap<String, CodegenModel>(); + HashMap<String, Integer> processedModelMaps = new HashMap<String, Integer>(); + + for (Object o : allModels) { + HashMap<String, Object> h = (HashMap<String, Object>) o; + CodegenModel m = (CodegenModel) h.get("model"); + modelMaps.put(m.classname, m); + } + + List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation"); + for (CodegenOperation op : operationList) { + for (CodegenParameter p : op.allParams) { + p.vendorExtensions.put("x-go-example", constructExampleCode(p, modelMaps, processedModelMaps)); + } + } + + processedModelMaps.clear(); + for (CodegenOperation operation : operationList) { + for (CodegenParameter cp : operation.allParams) { + cp.vendorExtensions.put("x-go-example", constructExampleCode(cp, modelMaps, processedModelMaps)); + } + } + + return objs; + } + + private String constructExampleCode(CodegenParameter codegenParameter, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { + if (codegenParameter.isListContainer) { // array + return codegenParameter.dataType + "{" + constructExampleCode(codegenParameter.items, modelMaps, processedModelMap) + "}"; + } else if (codegenParameter.isMapContainer) { + return "map[string]string{ \"Key\" = \"Value\" }"; + } else if (codegenParameter.isPrimitiveType) { // primitive type + if (codegenParameter.isString) { + if (StringUtils.isEmpty(codegenParameter.example)) { + return "\"" + codegenParameter.example + "\""; + } else { + return "\"" + codegenParameter.paramName + "_example\""; + } + } else if (codegenParameter.isBoolean) { // boolean + if (Boolean.parseBoolean(codegenParameter.example)) { + return "true"; + } else { + return "false"; + } + } else if (codegenParameter.isUri) { // URL + return "URL(string: \"https://example.com\")!"; + } else if (codegenParameter.isDateTime || codegenParameter.isDate) { // datetime or date + return "Get-Date"; + } else{ // numeric + if (StringUtils.isEmpty(codegenParameter.example)) { + return codegenParameter.example; + } else { + return "987"; + } + } + } else { // model + // look up the model + if (modelMaps.containsKey(codegenParameter.dataType)) { + return constructExampleCode(modelMaps.get(codegenParameter.dataType), modelMaps, processedModelMap); + } else { + //LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenParameter.dataType); + return "TODO"; + } + } + } + + private String constructExampleCode(CodegenProperty codegenProperty, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { + if (codegenProperty.isListContainer) { // array + return codegenProperty.dataType + "{" + constructExampleCode(codegenProperty.items, modelMaps, processedModelMap) + ")"; + } else if (codegenProperty.isMapContainer) { // map + return "map[string]string{ \"Key\" = \"Value\" }"; + } else if (codegenProperty.isPrimitiveType) { // primitive type + if (codegenProperty.isString) { + if (StringUtils.isEmpty(codegenProperty.example)) { + return "\"" + codegenProperty.example + "\""; + } else { + return "\"" + codegenProperty.name + "_example\""; + } + } else if (codegenProperty.isBoolean) { // boolean + if (Boolean.parseBoolean(codegenProperty.example)) { + return "true"; + } else { + return "false"; + } + } else if (codegenProperty.isUri) { // URL + return "\"https://example.com\")!"; + } else if (codegenProperty.isDateTime || codegenProperty.isDate) { // datetime or date + return "time.Now()"; + } else{ // numeric + String example; + if (StringUtils.isEmpty(codegenProperty.example)) { + example = codegenProperty.example; + } else { + example = "123"; + } + + if (codegenProperty.isLong) { + return "int64(" + example + ")"; + } else { + return example; + } + } + } else { + // look up the model + if (modelMaps.containsKey(codegenProperty.dataType)) { + return constructExampleCode(modelMaps.get(codegenProperty.dataType), modelMaps, processedModelMap); + } else { + //LOGGER.error("Error in constructing examples. Failed to look up the model " + codegenProperty.dataType); + return "\"TODO\""; + } + } + } + + private String constructExampleCode(CodegenModel codegenModel, HashMap<String, CodegenModel> modelMaps, HashMap<String, Integer> processedModelMap) { + String example; + + // break infinite recursion. Return, in case a model is already processed in the current context. + String model = codegenModel.name; + if (processedModelMap.containsKey(model)) { + int count = processedModelMap.get(model); + if (count == 1) { + processedModelMap.put(model, 2); + } else if (count == 2) { + return ""; + } else { + throw new RuntimeException("Invalid count when constructing example: " + count); + } + } else { + processedModelMap.put(model, 1); + } + + example = "" + goImportAlias + "." + codegenModel.name + "{"; + List<String> propertyExamples = new ArrayList<>(); + for (CodegenProperty codegenProperty : codegenModel.allVars) { + propertyExamples.add(codegenProperty.name + ": " + constructExampleCode(codegenProperty, modelMaps, processedModelMap)); + } + example += StringUtils.join(propertyExamples, ", "); + example += "}"; + return example; + } + + } diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache index af211afe9b7b..0ab0d27a346a 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache @@ -20,6 +20,37 @@ Method | HTTP request | Description {{{unespacedNotes}}}{{/notes}} +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + {{goImportAlias}} "./openapi" +) + +func main() { + {{#allParams}} + {{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/allParams}} + + configuration := {{goImportAlias}}.NewConfiguration() + api_client := {{goImportAlias}}.NewAPIClient(configuration) + resp, r, err := api_client.{{classname}}.{{operationId}}(context.Background(), {{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}}.{{{vendorExtensions.x-export-param-name}}}({{{paramName}}}){{/optionalParams}}.Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `{{classname}}.{{operationId}}``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + {{#returnType}} + // response from `{{operationId}}`: {{{.}}} + fmt.Fprintf(os.Stdout, "Response from `{{classname}}.{{operationId}}`: %v\n", resp) + {{/returnType}} +} +``` + ### Path Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#pathParams}}{{#-last}} diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md index 1c5c2b28dd62..669daa616b78 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md @@ -16,6 +16,33 @@ To test special tags +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.AnotherFakeApi.Call123TestSpecialTags(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AnotherFakeApi.Call123TestSpecialTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Call123TestSpecialTags`: Client + fmt.Fprintf(os.Stdout, "Response from `AnotherFakeApi.Call123TestSpecialTags`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md index c9d3b6cd6256..93be8280eb6a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md @@ -29,6 +29,31 @@ creates an XmlItem +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + xmlItem := openapiclient.XmlItem{AttributeString: "AttributeString_example", AttributeNumber: 123, AttributeInteger: 123, AttributeBoolean: true, WrappedArray: []int32{123), NameString: "NameString_example", NameNumber: 123, NameInteger: 123, NameBoolean: true, NameArray: []int32{123), NameWrappedArray: []int32{123), PrefixString: "PrefixString_example", PrefixNumber: 123, PrefixInteger: 123, PrefixBoolean: true, PrefixArray: []int32{123), PrefixWrappedArray: []int32{123), NamespaceString: "NamespaceString_example", NamespaceNumber: 123, NamespaceInteger: 123, NamespaceBoolean: true, NamespaceArray: []int32{123), NamespaceWrappedArray: []int32{123), PrefixNsString: "PrefixNsString_example", PrefixNsNumber: 123, PrefixNsInteger: 123, PrefixNsBoolean: true, PrefixNsArray: []int32{123), PrefixNsWrappedArray: []int32{123)} // XmlItem | XmlItem Body + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.CreateXmlItem(context.Background(), xmlItem).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.CreateXmlItem``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -68,6 +93,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := true // bool | Input boolean as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterBooleanSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterBooleanSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterBooleanSerialize`: bool + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterBooleanSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -107,6 +159,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.OuterComposite{MyNumber: 123, MyString: "MyString_example", MyBoolean: false} // OuterComposite | Input composite as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterCompositeSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterCompositeSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterCompositeSerialize`: OuterComposite + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterCompositeSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -146,6 +225,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := 987 // float32 | Input number as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterNumberSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterNumberSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterNumberSerialize`: float32 + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterNumberSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -185,6 +291,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := "body_example" // string | Input string as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterStringSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterStringSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterStringSerialize`: string + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterStringSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -224,6 +357,31 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.FileSchemaTestClass{File: openapiclient.File{SourceURI: "SourceURI_example"}, Files: []File{openapiclient.File{SourceURI: "SourceURI_example"})} // FileSchemaTestClass | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithFileSchema(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithFileSchema``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -261,6 +419,32 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + query := "query_example" // string | + body := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123} // User | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithQueryParams(context.Background(), query, body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithQueryParams``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -301,6 +485,33 @@ To test \"client\" model +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestClientModel(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestClientModel``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClientModel`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestClientModel`: %v\n", resp) +} +``` + ### Path Parameters @@ -340,6 +551,44 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + number := 987 // float32 | None + double := 987 // float64 | None + patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None + byte_ := 987 // string | None + integer := 987 // int32 | None (optional) + int32_ := 987 // int32 | None (optional) + int64_ := 987 // int64 | None (optional) + float := 987 // float32 | None (optional) + string_ := "string__example" // string | None (optional) + binary := 987 // *os.File | None (optional) + date := Get-Date // string | None (optional) + dateTime := Get-Date // time.Time | None (optional) + password := "password_example" // string | None (optional) + callback := "callback_example" // string | None (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEndpointParameters(context.Background(), number, double, patternWithoutDelimiter, byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEndpointParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -392,6 +641,38 @@ To test enum parameters +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + enumHeaderStringArray := []string{"EnumHeaderStringArray_example"} // []string | Header parameter enum test (string array) (optional) + enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg") + enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional) + enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg") + enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional) + enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional) + enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$") + enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg") + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEnumParameters(context.Background(), ).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEnumParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -438,6 +719,36 @@ Fake endpoint to test group parameters (optional) +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requiredStringGroup := 987 // int32 | Required String in group parameters + requiredBooleanGroup := true // bool | Required Boolean in group parameters + requiredInt64Group := 987 // int64 | Required Integer in group parameters + stringGroup := 987 // int32 | String in group parameters (optional) + booleanGroup := true // bool | Boolean in group parameters (optional) + int64Group := 987 // int64 | Integer in group parameters (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestGroupParameters(context.Background(), requiredStringGroup, requiredBooleanGroup, requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestGroupParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -480,6 +791,31 @@ No authorization required test inline additionalProperties +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + param := map[string]string{ "Key" = "Value" } // map[string]string | request body + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestInlineAdditionalProperties(context.Background(), param).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestInlineAdditionalProperties``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -517,6 +853,32 @@ No authorization required test json serialization of form data +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + param := "param_example" // string | field1 + param2 := "param2_example" // string | field2 + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestJsonFormData(context.Background(), param, param2).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestJsonFormData``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -557,6 +919,35 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pipe := []string{"Inner_example"} // []string | + ioutil := []string{"Inner_example"} // []string | + http := []string{"Inner_example"} // []string | + url := []string{"Inner_example"} // []string | + context := []string{"Inner_example"} // []string | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestQueryParameterCollectionFormat(context.Background(), pipe, ioutil, http, url, context).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestQueryParameterCollectionFormat``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md b/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md index 804712218780..3f8d0a41de3d 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md @@ -16,6 +16,33 @@ To test class name in snake case +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeClassnameTags123Api.TestClassname(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeClassnameTags123Api.TestClassname``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClassname`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeClassnameTags123Api.TestClassname`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md index 9d07d9e64fcc..c2559ac673ae 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md @@ -22,6 +22,31 @@ Method | HTTP request | Description Add a new pet to the store +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.AddPet(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.AddPet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -59,6 +84,32 @@ Name | Type | Description | Notes Deletes a pet +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | Pet id to delete + apiKey := "apiKey_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.DeletePet(context.Background(), petId).ApiKey(apiKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.DeletePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -103,6 +154,33 @@ Finds Pets by status +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + status := []string{"Status_example"} // []string | Status values that need to be considered for filter + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByStatus(context.Background(), status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByStatus`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByStatus`: %v\n", resp) +} +``` + ### Path Parameters @@ -142,6 +220,33 @@ Finds Pets by tags +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + tags := []string{"Inner_example"} // []string | Tags to filter by + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByTags(context.Background(), tags).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByTags`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByTags`: %v\n", resp) +} +``` + ### Path Parameters @@ -181,6 +286,33 @@ Find pet by ID +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to return + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.GetPetById(context.Background(), petId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.GetPetById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetPetById`: Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.GetPetById`: %v\n", resp) +} +``` + ### Path Parameters @@ -222,6 +354,31 @@ Name | Type | Description | Notes Update an existing pet +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePet(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -259,6 +416,33 @@ Name | Type | Description | Notes Updates a pet in the store with form data +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet that needs to be updated + name := "name_example" // string | Updated name of the pet (optional) + status := "status_example" // string | Updated status of the pet (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePetWithForm(context.Background(), petId).Name(name).Status(status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePetWithForm``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -302,6 +486,35 @@ Name | Type | Description | Notes uploads an image +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + file := 987 // *os.File | file to upload (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFile(context.Background(), petId).AdditionalMetadata(additionalMetadata).File(file).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFile`: %v\n", resp) +} +``` + ### Path Parameters @@ -345,6 +558,35 @@ Name | Type | Description | Notes uploads an image (required) +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + requiredFile := 987 // *os.File | file to upload + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFileWithRequiredFile(context.Background(), petId, requiredFile).AdditionalMetadata(additionalMetadata).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFileWithRequiredFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFileWithRequiredFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFileWithRequiredFile`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md index 3d75ce0a56fd..58a65c022153 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md @@ -19,6 +19,31 @@ Delete purchase order by ID +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := "orderId_example" // string | ID of the order that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.DeleteOrder(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.DeleteOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -62,6 +87,32 @@ Returns pet inventories by status +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetInventory(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetInventory``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetInventory`: map[string]int32 + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetInventory`: %v\n", resp) +} +``` + ### Path Parameters This endpoint does not need any parameter. @@ -97,6 +148,33 @@ Find purchase order by ID +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := 987 // int64 | ID of pet that needs to be fetched + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetOrderById(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetOrderById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOrderById`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetOrderById`: %v\n", resp) +} +``` + ### Path Parameters @@ -138,6 +216,33 @@ No authorization required Place an order for a pet +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.Order{Id: int64(123), PetId: int64(123), Quantity: 123, ShipDate: "TODO", Status: "Status_example", Complete: false} // Order | order placed for purchasing the pet + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.PlaceOrder(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.PlaceOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `PlaceOrder`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.PlaceOrder`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md index cee3024a24f1..761b86e84bea 100644 --- a/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md @@ -23,6 +23,31 @@ Create user +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := openapiclient.User{Id: int64(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 + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUser(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -60,6 +85,31 @@ No authorization required Creates list of users with given input array +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := []User{openapiclient.User{Id: int64(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 + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithArrayInput(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithArrayInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -97,6 +147,31 @@ No authorization required Creates list of users with given input array +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := []User{} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithListInput(context.Background(), body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithListInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -136,6 +211,31 @@ Delete user +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.DeleteUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.DeleteUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -177,6 +277,33 @@ No authorization required Get user by user name +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be fetched. Use user1 for testing. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.GetUserByName(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.GetUserByName``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserByName`: User + fmt.Fprintf(os.Stdout, "Response from `UserApi.GetUserByName`: %v\n", resp) +} +``` + ### Path Parameters @@ -218,6 +345,34 @@ No authorization required Logs user into the system +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The user name for login + password := "password_example" // string | The password for login in clear text + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LoginUser(context.Background(), username, password).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LoginUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LoginUser`: string + fmt.Fprintf(os.Stdout, "Response from `UserApi.LoginUser`: %v\n", resp) +} +``` + ### Path Parameters @@ -256,6 +411,30 @@ No authorization required Logs out current logged in user session +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LogoutUser(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LogoutUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters This endpoint does not need any parameter. @@ -291,6 +470,32 @@ Updated user +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | name that need to be deleted + body := // User | Updated user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.UpdateUser(context.Background(), username, body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UpdateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md index c4e2c2863bff..2c63feecd211 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md @@ -16,6 +16,33 @@ To test special tags +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + client := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.AnotherFakeApi.Call123TestSpecialTags(context.Background(), client).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AnotherFakeApi.Call123TestSpecialTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Call123TestSpecialTags`: Client + fmt.Fprintf(os.Stdout, "Response from `AnotherFakeApi.Call123TestSpecialTags`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md index 4dd83db2463b..7a138d8df4a9 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/DefaultApi.md @@ -14,6 +14,32 @@ Method | HTTP request | Description +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.DefaultApi.FooGet(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.FooGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FooGet`: InlineResponseDefault + fmt.Fprintf(os.Stdout, "Response from `DefaultApi.FooGet`: %v\n", resp) +} +``` + ### Path Parameters This endpoint does not need any parameter. diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md index e21a291e1340..0cb5bf8724b2 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md @@ -27,6 +27,32 @@ Method | HTTP request | Description Health check endpoint +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeHealthGet(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeHealthGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeHealthGet`: HealthCheckResult + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeHealthGet`: %v\n", resp) +} +``` + ### Path Parameters This endpoint does not need any parameter. @@ -62,6 +88,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := true // bool | Input boolean as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterBooleanSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterBooleanSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterBooleanSerialize`: bool + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterBooleanSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -101,6 +154,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + outerComposite := openapiclient.OuterComposite{MyNumber: 123, MyString: "MyString_example", MyBoolean: false} // OuterComposite | Input composite as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterCompositeSerialize(context.Background(), ).OuterComposite(outerComposite).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterCompositeSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterCompositeSerialize`: OuterComposite + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterCompositeSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -140,6 +220,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := 987 // float32 | Input number as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterNumberSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterNumberSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterNumberSerialize`: float32 + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterNumberSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -179,6 +286,33 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + body := "body_example" // string | Input string as post body (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.FakeOuterStringSerialize(context.Background(), ).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.FakeOuterStringSerialize``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FakeOuterStringSerialize`: string + fmt.Fprintf(os.Stdout, "Response from `FakeApi.FakeOuterStringSerialize`: %v\n", resp) +} +``` + ### Path Parameters @@ -218,6 +352,31 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + fileSchemaTestClass := openapiclient.FileSchemaTestClass{File: openapiclient.File{SourceURI: "SourceURI_example"}, Files: []File{openapiclient.File{SourceURI: "SourceURI_example"})} // FileSchemaTestClass | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithFileSchema(context.Background(), fileSchemaTestClass).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithFileSchema``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -255,6 +414,32 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + query := "query_example" // string | + user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestBodyWithQueryParams(context.Background(), query, user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestBodyWithQueryParams``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -295,6 +480,33 @@ To test \"client\" model +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + client := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestClientModel(context.Background(), client).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestClientModel``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClientModel`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestClientModel`: %v\n", resp) +} +``` + ### Path Parameters @@ -334,6 +546,44 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + number := 987 // float32 | None + double := 987 // float64 | None + patternWithoutDelimiter := "patternWithoutDelimiter_example" // string | None + byte_ := 987 // string | None + integer := 987 // int32 | None (optional) + int32_ := 987 // int32 | None (optional) + int64_ := 987 // int64 | None (optional) + float := 987 // float32 | None (optional) + string_ := "string__example" // string | None (optional) + binary := 987 // *os.File | None (optional) + date := Get-Date // string | None (optional) + dateTime := Get-Date // time.Time | None (optional) + password := "password_example" // string | None (optional) + callback := "callback_example" // string | None (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEndpointParameters(context.Background(), number, double, patternWithoutDelimiter, byte_).Integer(integer).Int32_(int32_).Int64_(int64_).Float(float).String_(string_).Binary(binary).Date(date).DateTime(dateTime).Password(password).Callback(callback).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEndpointParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -386,6 +636,38 @@ To test enum parameters +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + enumHeaderStringArray := []string{"EnumHeaderStringArray_example"} // []string | Header parameter enum test (string array) (optional) + enumHeaderString := "enumHeaderString_example" // string | Header parameter enum test (string) (optional) (default to "-efg") + enumQueryStringArray := []string{"EnumQueryStringArray_example"} // []string | Query parameter enum test (string array) (optional) + enumQueryString := "enumQueryString_example" // string | Query parameter enum test (string) (optional) (default to "-efg") + enumQueryInteger := 987 // int32 | Query parameter enum test (double) (optional) + enumQueryDouble := 987 // float64 | Query parameter enum test (double) (optional) + enumFormStringArray := []string{"Inner_example"} // []string | Form parameter enum test (string array) (optional) (default to "$") + enumFormString := "enumFormString_example" // string | Form parameter enum test (string) (optional) (default to "-efg") + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestEnumParameters(context.Background(), ).EnumHeaderStringArray(enumHeaderStringArray).EnumHeaderString(enumHeaderString).EnumQueryStringArray(enumQueryStringArray).EnumQueryString(enumQueryString).EnumQueryInteger(enumQueryInteger).EnumQueryDouble(enumQueryDouble).EnumFormStringArray(enumFormStringArray).EnumFormString(enumFormString).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestEnumParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -432,6 +714,36 @@ Fake endpoint to test group parameters (optional) +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requiredStringGroup := 987 // int32 | Required String in group parameters + requiredBooleanGroup := true // bool | Required Boolean in group parameters + requiredInt64Group := 987 // int64 | Required Integer in group parameters + stringGroup := 987 // int32 | String in group parameters (optional) + booleanGroup := true // bool | Boolean in group parameters (optional) + int64Group := 987 // int64 | Integer in group parameters (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestGroupParameters(context.Background(), requiredStringGroup, requiredBooleanGroup, requiredInt64Group).StringGroup(stringGroup).BooleanGroup(booleanGroup).Int64Group(int64Group).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestGroupParameters``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -474,6 +786,31 @@ Name | Type | Description | Notes test inline additionalProperties +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + requestBody := map[string]string{ "Key" = "Value" } // map[string]string | request body + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestInlineAdditionalProperties(context.Background(), requestBody).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestInlineAdditionalProperties``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -511,6 +848,32 @@ No authorization required test json serialization of form data +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + param := "param_example" // string | field1 + param2 := "param2_example" // string | field2 + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestJsonFormData(context.Background(), param, param2).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestJsonFormData``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -551,6 +914,35 @@ No authorization required +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pipe := []string{"Inner_example"} // []string | + ioutil := []string{"Inner_example"} // []string | + http := []string{"Inner_example"} // []string | + url := []string{"Inner_example"} // []string | + context := []string{"Inner_example"} // []string | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestQueryParameterCollectionFormat(context.Background(), pipe, ioutil, http, url, context).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestQueryParameterCollectionFormat``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md index 4a1ce5a56fa6..1898cc7411b6 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md @@ -16,6 +16,33 @@ To test class name in snake case +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + client := openapiclient.Client{Client: "Client_example"} // Client | client model + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeClassnameTags123Api.TestClassname(context.Background(), client).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeClassnameTags123Api.TestClassname``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestClassname`: Client + fmt.Fprintf(os.Stdout, "Response from `FakeClassnameTags123Api.TestClassname`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md index f88a802be249..6fdd89f81ba2 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/PetApi.md @@ -22,6 +22,31 @@ Method | HTTP request | Description Add a new pet to the store +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pet := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.AddPet(context.Background(), pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.AddPet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -59,6 +84,32 @@ Name | Type | Description | Notes Deletes a pet +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | Pet id to delete + apiKey := "apiKey_example" // string | (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.DeletePet(context.Background(), petId).ApiKey(apiKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.DeletePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -103,6 +154,33 @@ Finds Pets by status +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + status := []string{"Status_example"} // []string | Status values that need to be considered for filter + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByStatus(context.Background(), status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByStatus``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByStatus`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByStatus`: %v\n", resp) +} +``` + ### Path Parameters @@ -142,6 +220,33 @@ Finds Pets by tags +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + tags := []string{"Inner_example"} // []string | Tags to filter by + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.FindPetsByTags(context.Background(), tags).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.FindPetsByTags``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindPetsByTags`: []Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.FindPetsByTags`: %v\n", resp) +} +``` + ### Path Parameters @@ -181,6 +286,33 @@ Find pet by ID +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to return + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.GetPetById(context.Background(), petId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.GetPetById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetPetById`: Pet + fmt.Fprintf(os.Stdout, "Response from `PetApi.GetPetById`: %v\n", resp) +} +``` + ### Path Parameters @@ -222,6 +354,31 @@ Name | Type | Description | Notes Update an existing pet +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + pet := openapiclient.Pet{Id: int64(123), Category: openapiclient.Category{Id: int64(123), Name: "Name_example"}, Name: "Name_example", PhotoUrls: []string{"PhotoUrls_example"), Tags: []Tag{openapiclient.Tag{Id: int64(123), Name: "Name_example"}), Status: "Status_example"} // Pet | Pet object that needs to be added to the store + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePet(context.Background(), pet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -259,6 +416,33 @@ Name | Type | Description | Notes Updates a pet in the store with form data +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet that needs to be updated + name := "name_example" // string | Updated name of the pet (optional) + status := "status_example" // string | Updated status of the pet (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UpdatePetWithForm(context.Background(), petId).Name(name).Status(status).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UpdatePetWithForm``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -302,6 +486,35 @@ Name | Type | Description | Notes uploads an image +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + file := 987 // *os.File | file to upload (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFile(context.Background(), petId).AdditionalMetadata(additionalMetadata).File(file).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFile`: %v\n", resp) +} +``` + ### Path Parameters @@ -345,6 +558,35 @@ Name | Type | Description | Notes uploads an image (required) +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + petId := 987 // int64 | ID of pet to update + requiredFile := 987 // *os.File | file to upload + additionalMetadata := "additionalMetadata_example" // string | Additional data to pass to server (optional) + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.PetApi.UploadFileWithRequiredFile(context.Background(), petId, requiredFile).AdditionalMetadata(additionalMetadata).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PetApi.UploadFileWithRequiredFile``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadFileWithRequiredFile`: ApiResponse + fmt.Fprintf(os.Stdout, "Response from `PetApi.UploadFileWithRequiredFile`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md index d3ec7e487392..80617c8683bf 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/StoreApi.md @@ -19,6 +19,31 @@ Delete purchase order by ID +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := "orderId_example" // string | ID of the order that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.DeleteOrder(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.DeleteOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -62,6 +87,32 @@ Returns pet inventories by status +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetInventory(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetInventory``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetInventory`: map[string]int32 + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetInventory`: %v\n", resp) +} +``` + ### Path Parameters This endpoint does not need any parameter. @@ -97,6 +148,33 @@ Find purchase order by ID +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + orderId := 987 // int64 | ID of pet that needs to be fetched + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.GetOrderById(context.Background(), orderId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.GetOrderById``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetOrderById`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.GetOrderById`: %v\n", resp) +} +``` + ### Path Parameters @@ -138,6 +216,33 @@ No authorization required Place an order for a pet +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + order := openapiclient.Order{Id: int64(123), PetId: int64(123), Quantity: 123, ShipDate: "TODO", Status: "Status_example", Complete: false} // Order | order placed for purchasing the pet + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.StoreApi.PlaceOrder(context.Background(), order).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `StoreApi.PlaceOrder``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `PlaceOrder`: Order + fmt.Fprintf(os.Stdout, "Response from `StoreApi.PlaceOrder`: %v\n", resp) +} +``` + ### Path Parameters diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md index af86ff9b85ac..dfe5c0aadd1e 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md @@ -23,6 +23,31 @@ Create user +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | Created user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUser(context.Background(), user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -60,6 +85,31 @@ No authorization required Creates list of users with given input array +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123}} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithArrayInput(context.Background(), user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithArrayInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -97,6 +147,31 @@ No authorization required Creates list of users with given input array +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + user := []User{} // []User | List of user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.CreateUsersWithListInput(context.Background(), user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.CreateUsersWithListInput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -136,6 +211,31 @@ Delete user +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be deleted + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.DeleteUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.DeleteUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters @@ -177,6 +277,33 @@ No authorization required Get user by user name +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The name that needs to be fetched. Use user1 for testing. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.GetUserByName(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.GetUserByName``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUserByName`: User + fmt.Fprintf(os.Stdout, "Response from `UserApi.GetUserByName`: %v\n", resp) +} +``` + ### Path Parameters @@ -218,6 +345,34 @@ No authorization required Logs user into the system +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The user name for login + password := "password_example" // string | The password for login in clear text + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LoginUser(context.Background(), username, password).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LoginUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LoginUser`: string + fmt.Fprintf(os.Stdout, "Response from `UserApi.LoginUser`: %v\n", resp) +} +``` + ### Path Parameters @@ -256,6 +411,30 @@ No authorization required Logs out current logged in user session +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.LogoutUser(context.Background(), ).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.LogoutUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters This endpoint does not need any parameter. @@ -291,6 +470,32 @@ Updated user +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | name that need to be deleted + user := // User | Updated user object + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.UserApi.UpdateUser(context.Background(), username, user).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UserApi.UpdateUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + ### Path Parameters From c38b52919f629cb52c02f252ec4349d1bfe1f20f Mon Sep 17 00:00:00 2001 From: adg-mh <40580891+adg-mh@users.noreply.github.com> Date: Thu, 30 Apr 2020 22:02:45 -0500 Subject: [PATCH 43/78] [dart-dio][client] Handle x-www-form-urlencoded form data (#5597) --- .../openapi-generator/src/main/resources/dart-dio/api.mustache | 3 +++ samples/client/petstore/dart-dio/.openapi-generator/VERSION | 2 +- samples/client/petstore/dart-dio/lib/api/pet_api.dart | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) 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 112fd77f9993..48b73d914c02 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -55,6 +55,9 @@ class {{classname}} { } {{/isFile}} {{/isMultipart}} + {{^isMultipart}} + formData['{{baseName}}'] = parameterToString(_serializers, {{paramName}}); + {{/isMultipart}} {{/formParams}} bodyData = FormData.fromMap(formData); {{/hasFormParams}} diff --git a/samples/client/petstore/dart-dio/.openapi-generator/VERSION b/samples/client/petstore/dart-dio/.openapi-generator/VERSION index b5d898602c2c..9e9d3e448fb4 100644 --- a/samples/client/petstore/dart-dio/.openapi-generator/VERSION +++ b/samples/client/petstore/dart-dio/.openapi-generator/VERSION @@ -1 +1 @@ -4.3.1-SNAPSHOT \ No newline at end of file +4.3.1-SNAPSHOT diff --git a/samples/client/petstore/dart-dio/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/lib/api/pet_api.dart index 5c78e6e6204c..c5a66f32cc7a 100644 --- a/samples/client/petstore/dart-dio/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/lib/api/pet_api.dart @@ -266,6 +266,8 @@ class PetApi { List<String> contentTypes = ["application/x-www-form-urlencoded"]; Map<String, dynamic> formData = {}; + formData['name'] = parameterToString(_serializers, name); + formData['status'] = parameterToString(_serializers, status); bodyData = FormData.fromMap(formData); From f7ba9354e8526543e4bd14009b59d65cb6673d6f Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 1 May 2020 14:15:43 +0800 Subject: [PATCH 44/78] update oas3 petstore go exp sample --- .../petstore/go-experimental/go-petstore/docs/FakeApi.md | 2 +- .../petstore/go-experimental/go-petstore/docs/UserApi.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md index 0cb5bf8724b2..ba556cb8ea45 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/FakeApi.md @@ -428,7 +428,7 @@ import ( func main() { query := "query_example" // string | - user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | + user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: "TODO", ArbitraryNullableTypeValue: "TODO"} // User | configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md index dfe5c0aadd1e..43fccd38582a 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/docs/UserApi.md @@ -36,7 +36,7 @@ import ( ) func main() { - user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123} // User | Created user object + user := openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: "TODO", ArbitraryNullableTypeValue: "TODO"} // User | Created user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) @@ -98,7 +98,7 @@ import ( ) func main() { - user := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: 123, ArbitraryNullableTypeValue: 123}} // []User | List of user object + user := []User{openapiclient.User{Id: int64(123), Username: "Username_example", FirstName: "FirstName_example", LastName: "LastName_example", Email: "Email_example", Password: "Password_example", Phone: "Phone_example", UserStatus: 123, ArbitraryObject: "TODO", ArbitraryNullableObject: "TODO", ArbitraryTypeValue: "TODO", ArbitraryNullableTypeValue: "TODO"}} // []User | List of user object configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) From 6484c03518704b6d8f9d254f3c7d8dc2ca73ff0a Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 1 May 2020 16:47:38 +0800 Subject: [PATCH 45/78] Test scala akka petstore client in CI (#6118) * test scala akka in ci * fix compilation error * fix scala akka test * add tests --- bin/openapi3/scala-akka-petstore.sh | 2 +- .../languages/ScalaAkkaClientCodegen.java | 1 - .../resources/scala-akka-client/pom.mustache | 5 +- .../resources/3_0/scala-akka/petstore.yaml | 742 ++++++++++++++++++ pom.xml | 4 +- samples/client/petstore/scala-akka/pom.xml | 5 +- .../client/petstore/scala-akka/pom.xml | 5 +- .../org/openapitools/client/api/PetApi.scala | 2 + .../src/test/scala/PetApiTest.scala | 123 +++ 9 files changed, 879 insertions(+), 10 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/scala-akka/petstore.yaml create mode 100644 samples/openapi3/client/petstore/scala-akka/src/test/scala/PetApiTest.scala diff --git a/bin/openapi3/scala-akka-petstore.sh b/bin/openapi3/scala-akka-petstore.sh index 736fe0312464..5443c58f8fb7 100755 --- a/bin/openapi3/scala-akka-petstore.sh +++ b/bin/openapi3/scala-akka-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id "scala-akka-petstore-client" -t modules/openapi-generator/src/main/resources/scala-akka-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-akka -o samples/openapi3/client/petstore/scala-akka $@" +ags="generate --artifact-id "scala-akka-petstore-client" -t modules/openapi-generator/src/main/resources/scala-akka-client -i modules/openapi-generator/src/test/resources/3_0/scala-akka/petstore.yaml -g scala-akka -o samples/openapi3/client/petstore/scala-akka $@" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java index 8f1bdde8c63f..c6da992792b9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java @@ -35,7 +35,6 @@ import java.io.Writer; import java.util.*; -import static org.openapitools.codegen.languages.AbstractJavaCodegen.DATE_LIBRARY; import static org.openapitools.codegen.utils.StringUtils.camelize; public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements CodegenConfig { diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache index 9162fce7a255..5f3f0aafdad3 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/pom.mustache @@ -136,7 +136,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.20.1</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -146,6 +146,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> + <threadCount>4</threadCount> <forkMode>pertest</forkMode> </configuration> </plugin> @@ -260,4 +261,4 @@ </plugin> </plugins> </build> -</project> \ No newline at end of file +</project> diff --git a/modules/openapi-generator/src/test/resources/3_0/scala-akka/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/scala-akka/petstore.yaml new file mode 100644 index 000000000000..fe228bf44473 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/scala-akka/petstore.yaml @@ -0,0 +1,742 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + This is a sample server Petstore server. For this sample, you can use the api key + `special-key` to test the authorization filters. + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: >- + Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + '/store/order/{orderId}': + get: + tags: + - store + summary: Find purchase order by ID + description: >- + For valid response try integer IDs with value <= 5 or > 10. Other values + will generated exceptions + operationId: getOrderById + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: >- + For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + security: + - auth_cookie: [] + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + responses: + default: + description: successful operation + security: + - auth_cookie: [] + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + Set-Cookie: + description: >- + Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + type: string + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when toekn expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - auth_cookie: [] +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header + auth_cookie: + type: apiKey + name: AUTH_KEY + in: cookie + schemas: + Order: + title: Pet Order + description: An order for a pets from the pet store + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + title: Pet category + description: A category for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$' + xml: + name: Category + User: + title: a User + description: A User who is purchasing from the pet store + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + title: Pet Tag + description: A tag for a pet + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + title: a Pet + description: A pet for sale in the pet store + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + title: An uploaded response + description: Describes the result of uploading an image resource + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string diff --git a/pom.xml b/pom.xml index b9ff2c632c3d..6c02ecbf7ff5 100644 --- a/pom.xml +++ b/pom.xml @@ -1296,7 +1296,7 @@ <module>samples/openapi3/client/petstore/go-experimental</module> <module>samples/openapi3/client/petstore/go</module> <!-- test java-related projects --> - <!--<module>samples/client/petstore/scala-akka</module>--> + <module>samples/openapi3/client/petstore/scala-akka</module> <module>samples/openapi3/client/petstore/scala-sttp</module> <module>samples/client/petstore/scala-httpclient</module> <module>samples/client/petstore/scalaz</module> @@ -1392,7 +1392,7 @@ <!-- clients --> <module>samples/openapi3/client/petstore/ruby</module> <!-- test java-related projects --> - <!--<module>samples/client/petstore/scala-akka</module>--> + <module>samples/openapi3/client/petstore/scala-akka</module> <module>samples/client/petstore/dart2/petstore</module> <module>samples/client/petstore/dart-jaguar/openapi</module> <module>samples/client/petstore/dart-jaguar/flutter_petstore/openapi</module> diff --git a/samples/client/petstore/scala-akka/pom.xml b/samples/client/petstore/scala-akka/pom.xml index bd865860a90a..a88eaa5a41ef 100644 --- a/samples/client/petstore/scala-akka/pom.xml +++ b/samples/client/petstore/scala-akka/pom.xml @@ -126,7 +126,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.20.1</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -136,6 +136,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> + <threadCount>4</threadCount> <forkMode>pertest</forkMode> </configuration> </plugin> @@ -250,4 +251,4 @@ </plugin> </plugins> </build> -</project> \ No newline at end of file +</project> diff --git a/samples/openapi3/client/petstore/scala-akka/pom.xml b/samples/openapi3/client/petstore/scala-akka/pom.xml index bd865860a90a..a88eaa5a41ef 100644 --- a/samples/openapi3/client/petstore/scala-akka/pom.xml +++ b/samples/openapi3/client/petstore/scala-akka/pom.xml @@ -126,7 +126,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.20.1</version> + <version>3.0.0-M4</version> <configuration> <systemProperties> <property> @@ -136,6 +136,7 @@ </systemProperties> <argLine>-Xms512m -Xmx1500m</argLine> <parallel>methods</parallel> + <threadCount>4</threadCount> <forkMode>pertest</forkMode> </configuration> </plugin> @@ -250,4 +251,4 @@ </plugin> </plugins> </build> -</project> \ No newline at end of file +</project> diff --git a/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/PetApi.scala b/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/PetApi.scala index df82ca29fca2..c0ba5d4c6ae2 100644 --- a/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/PetApi.scala +++ b/samples/openapi3/client/petstore/scala-akka/src/main/scala/org/openapitools/client/api/PetApi.scala @@ -127,6 +127,7 @@ class PetApi(baseUrl: String) { /** * Expected answers: + * code 200 : (successful operation) * code 405 : (Invalid input) * * @param petId ID of pet that needs to be updated @@ -138,6 +139,7 @@ class PetApi(baseUrl: String) { .withFormParam("name", name) .withFormParam("status", status) .withPathParam("petId", petId) + .withSuccessResponse[Unit](200) .withErrorResponse[Unit](405) diff --git a/samples/openapi3/client/petstore/scala-akka/src/test/scala/PetApiTest.scala b/samples/openapi3/client/petstore/scala-akka/src/test/scala/PetApiTest.scala new file mode 100644 index 000000000000..e6229fb05f3a --- /dev/null +++ b/samples/openapi3/client/petstore/scala-akka/src/test/scala/PetApiTest.scala @@ -0,0 +1,123 @@ +import akka.actor.ActorSystem +import org.junit.runner.RunWith +import org.openapitools.client._ +import org.openapitools.client.api._ +import org.openapitools.client.core.{ApiInvoker, ApiKeyValue} +import org.openapitools.client.model._ +import org.scalatest.Inspectors._ +import org.scalatest._ +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +class PetApiTest extends AsyncFlatSpec with Matchers { + + private implicit val system: ActorSystem = ActorSystem() + + behavior of "PetApi" + val api: PetApi = PetApi() + val invoker: ApiInvoker = ApiInvoker(EnumsSerializers.all) + private implicit val apiKey: ApiKeyValue = ApiKeyValue("special-key") + + it should "add and fetch a pet" in { + val petId = 1000 + val createdPet = Pet( + Some(petId), + Some(Category(Some(1), Some("sold"))), + "dragon", + (for (i <- 1 to 10) yield "http://foo.com/photo/" + i).toList, + Some((for (i <- 1 to 5) yield org.openapitools.client.model.Tag(Some(i), Some("tag-" + i))).toList), + Some(PetEnums.Status.Sold) + ) + + val addPetRequest = api.addPet(createdPet) + val getPetRequest = api.getPetById(petId) + + for { + addResponse <- invoker.execute(addPetRequest) + response <- invoker.execute(getPetRequest) + } yield { + addResponse.code should be(200) + + response.code should be(200) + val pet = response.content + + pet should have( + 'id (createdPet.id), + 'status (createdPet.status), + 'category (createdPet.category), + 'name (createdPet.name) + ) + pet.tags should not be empty + pet.tags.get should contain theSameElementsInOrderAs createdPet.tags.get + pet.photoUrls should contain theSameElementsInOrderAs createdPet.photoUrls + } + } + + it should "update a pet" in { + val petId = (Math.random()*1000000000).toLong + val createdPet = Pet( + Some(petId), + Some(Category(Some(1), Some("sold"))), + "programmer", + (for (i <- 1 to 10) yield "http://foo.com/photo/" + i).toList, + Some((for (i <- 1 to 5) yield org.openapitools.client.model.Tag(Some(i), Some("tag-" + i))).toList), + Some(PetEnums.Status.Available) + ) + + for { + createdPet <- invoker.execute(api.addPet(createdPet)) + pet: core.ApiResponse[Pet] <- invoker.execute(api.getPetById(createdPet.content.id.get)) + updatedPet = pet.content.copy(status = Some(PetEnums.Status.Sold), name = "developer") + updatedPetResponse: core.ApiResponse[Pet] <- invoker.execute(api.updatePet(updatedPet)) + updatedRequested: core.ApiResponse[Pet] <- invoker.execute(api.getPetById(createdPet.content.id.get)) + } yield { + pet.content.name should be("programmer") + pet.content.status should be(Some(PetEnums.Status.Available)) + + updatedPetResponse.content.name should be("developer") + updatedPetResponse.content.status should be(Some(PetEnums.Status.Sold)) + + updatedRequested.content.name should be("developer") + updatedRequested.content.status should be(Some(PetEnums.Status.Sold)) + + } + + } + + it should "find pets by status" in { + val request = api.findPetsByStatus(List("available")) + + invoker + .execute(request) + .map { apiResponse => + apiResponse.code should be(200) + val pets = apiResponse.content + pets should not be empty + + forAll(pets) { pet => + pet.status should contain(PetEnums.Status.Available) + } + } + } + + /* + it should "find pets by tag" in { + val request = api.findPetsByTags(List("tag1", "tag2")) + + invoker + .execute(request) + .map { apiResponse => + apiResponse.code should be(200) + + val pets = apiResponse.content + pets should not be empty + + forAll(pets) { pet => + val tagNames = pet.tags.toList.flatten.map(_.name).collect { case Some(name) => name } + tagNames should contain atLeastOneOf("tag1", "tag2") + } + } + } + */ +} + From c08e80f49b806de169f133e177be08b3e2bafa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20Grammeltvedt?= <asgramme@microsoft.com> Date: Fri, 1 May 2020 16:01:01 +0200 Subject: [PATCH 46/78] Propagate deprecated property through $ref's (#6093) * Propagate deprecated property through $ref's As $ref is supposed to completely replace the definition of a property, make sure we also include the 'deprecated' property when generating the type of a $ref property. This makes a property $ref'ing a deprecated schema also become deprecated. * Clarify why we're messing around with $ref --- .../openapitools/codegen/DefaultCodegen.java | 11 ++++++ .../codegen/DefaultCodegenTest.java | 13 +++++++ .../test/resources/3_0/model-deprecated.yaml | 36 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 modules/openapi-generator/src/test/resources/3_0/model-deprecated.yaml 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 2480fa24fc92..71bb39fee086 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 @@ -2850,6 +2850,17 @@ public CodegenProperty fromProperty(String name, Schema p) { if (p.getDeprecated() != null) { property.deprecated = p.getDeprecated(); + } else if (p.get$ref() != null) { + // Since $ref should be replaced with the model it refers + // to, $ref'ing a model with 'deprecated' set should cause + // the property to reflect the model's 'deprecated' value. + String ref = ModelUtils.getSimpleRef(p.get$ref()); + if (ref != null) { + Schema referencedSchema = ModelUtils.getSchemas(this.openAPI).get(ref); + if (referencedSchema != null && referencedSchema.getDeprecated() != null) { + property.deprecated = referencedSchema.getDeprecated(); + } + } } if (p.getReadOnly() != null) { property.isReadOnly = p.getReadOnly(); 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 bebe90010f73..45b7c5298164 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 @@ -1409,6 +1409,19 @@ public void testDeprecatedProperty() { Assert.assertFalse(codegen.fromProperty("customerCode",(Schema) requestProperties.get("customerCode")).deprecated); } + @Test + public void testDeprecatedRef() { + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/model-deprecated.yaml"); + new InlineModelResolver().flatten(openAPI); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + final Map requestProperties = Collections.unmodifiableMap(openAPI.getComponents().getSchemas().get("complex").getProperties()); + + Assert.assertTrue(codegen.fromProperty("deprecated", (Schema)requestProperties.get("deprecated")).deprecated); + Assert.assertFalse(codegen.fromProperty("current", (Schema)requestProperties.get("current")).deprecated); + } + @Test public void integerSchemaPropertyAndModelTest() { OpenAPI openAPI = TestUtils.createOpenAPI(); diff --git a/modules/openapi-generator/src/test/resources/3_0/model-deprecated.yaml b/modules/openapi-generator/src/test/resources/3_0/model-deprecated.yaml new file mode 100644 index 000000000000..a3388a8d695c --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/model-deprecated.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.1 +info: + version: 1.0.0 + title: Example + license: + name: MIT +servers: + - url: http://api.example.xyz/v1 + +components: + schemas: + deprecated: + type: object + deprecated: true + properties: + customerCode: + type: string + example: '0001' + firstName: + type: string + example: 'first' + current: + type: object + properties: + customerCode: + type: string + example: '0001' + firstName: + type: string + example: 'first' + complex: + properties: + deprecated: + $ref: "#/components/schemas/deprecated" + current: + type: boolean From 7d5695e551799d214eb791ea4a721301f6c37715 Mon Sep 17 00:00:00 2001 From: Jaumard <jimmy.aumard@gmail.com> Date: Sat, 2 May 2020 15:23:52 +0200 Subject: [PATCH 47/78] dart-dio improvements (#6047) * fix runtime deserialisation * add security support for dart dio * regenerate dart dio sample * update dio pubspec.mustache deps * check response type before parsing * add default dateTime serializer * regenerate sample --- .../languages/DartDioClientCodegen.java | 6 +++ .../src/main/resources/dart-dio/api.mustache | 9 ++-- .../main/resources/dart-dio/apilib.mustache | 45 ++++++++++++++----- .../dart-dio/auth/api_key_auth.mustache | 27 +++++++++++ .../resources/dart-dio/auth/auth.mustache | 23 ++++++++++ .../dart-dio/auth/basic_auth.mustache | 31 +++++++++++++ .../resources/dart-dio/auth/oauth.mustache | 20 +++++++++ .../main/resources/dart-dio/pubspec.mustache | 10 ++--- .../resources/dart-dio/serializers.mustache | 2 + samples/client/petstore/dart-dio/lib/api.dart | 45 ++++++++++++++----- .../petstore/dart-dio/lib/api/pet_api.dart | 32 +++++++++++-- .../petstore/dart-dio/lib/api/store_api.dart | 18 ++++++-- .../petstore/dart-dio/lib/api/user_api.dart | 28 +++++++++++- .../dart-dio/lib/auth/api_key_auth.dart | 27 +++++++++++ .../petstore/dart-dio/lib/auth/auth.dart | 23 ++++++++++ .../dart-dio/lib/auth/basic_auth.dart | 31 +++++++++++++ .../petstore/dart-dio/lib/auth/oauth.dart | 20 +++++++++ .../petstore/dart-dio/lib/serializers.dart | 2 + samples/client/petstore/dart-dio/pubspec.yaml | 10 ++--- 19 files changed, 365 insertions(+), 44 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/dart-dio/auth/api_key_auth.mustache create mode 100644 modules/openapi-generator/src/main/resources/dart-dio/auth/auth.mustache create mode 100644 modules/openapi-generator/src/main/resources/dart-dio/auth/basic_auth.mustache create mode 100644 modules/openapi-generator/src/main/resources/dart-dio/auth/oauth.mustache create mode 100644 samples/client/petstore/dart-dio/lib/auth/api_key_auth.dart create mode 100644 samples/client/petstore/dart-dio/lib/auth/auth.dart create mode 100644 samples/client/petstore/dart-dio/lib/auth/basic_auth.dart create mode 100644 samples/client/petstore/dart-dio/lib/auth/oauth.dart diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index da4b41562b1b..5e7b0b77f3aa 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -240,6 +240,12 @@ public void processOpts() { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + final String authFolder = libFolder + File.separator + "auth"; + supportingFiles.add(new SupportingFile("auth/api_key_auth.mustache", authFolder, "api_key_auth.dart")); + supportingFiles.add(new SupportingFile("auth/basic_auth.mustache", authFolder, "basic_auth.dart")); + supportingFiles.add(new SupportingFile("auth/oauth.mustache", authFolder, "oauth.dart")); + supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart")); + if ("core".equals(dateLibrary)) { additionalProperties.put("core", "true"); typeMapping.put("Date", "DateTime"); 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 48b73d914c02..7877238c19fa 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -81,6 +81,9 @@ class {{classname}} { options: Options( method: '{{httpMethod}}'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [{{#authMethods}} {"type": "{{type}}", "name": "{{name}}"{{#isApiKey}}, "keyName": "{{keyParamName}}", "where": "{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}"{{/isApiKey}} }{{#hasMore}}, {{/hasMore}}{{/authMethods}}], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -88,12 +91,12 @@ class {{classname}} { {{#isListContainer}} final FullType type = const FullType(BuiltList, const [const FullType({{returnBaseType}})]); - BuiltList<{{returnBaseType}}> dataList = _serializers.deserialize(response.data, specifiedType: type); + BuiltList<{{returnBaseType}}> dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); var data = dataList.toList(); {{/isListContainer}} {{^isListContainer}} var serializer = _serializers.serializerForType({{{returnType}}}); - var data = _serializers.deserializeWith<{{{returnType}}}>(serializer, response.data); + var data = _serializers.deserializeWith<{{{returnType}}}>(serializer, response.data is String ? jsonDecode(response.data) : response.data); {{/isListContainer}} return Response<{{{returnType}}}>( @@ -109,4 +112,4 @@ class {{classname}} { } {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/apilib.mustache b/modules/openapi-generator/src/main/resources/dart-dio/apilib.mustache index 77029c39948e..685e63ef3be9 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/apilib.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/apilib.mustache @@ -3,27 +3,50 @@ library {{pubName}}.api; import 'package:dio/dio.dart'; import 'package:built_value/serializer.dart'; import 'package:{{pubName}}/serializers.dart'; +import 'package:{{pubName}}/auth/api_key_auth.dart'; +import 'package:{{pubName}}/auth/basic_auth.dart'; +import 'package:{{pubName}}/auth/oauth.dart'; {{#apiInfo}}{{#apis}}import 'package:{{pubName}}/api/{{classFilename}}.dart'; {{/apis}}{{/apiInfo}} +final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; + class {{clientName}} { Dio dio; Serializers serializers; String basePath = "{{{basePath}}}"; - {{clientName}}({this.dio, Serializers serializers}) { - if (dio == null) { - BaseOptions options = new BaseOptions( - baseUrl: basePath, - connectTimeout: 5000, - receiveTimeout: 3000, - ); - this.dio = new Dio(options); + {{clientName}}({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) { + if (dio == null) { + BaseOptions options = new BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: 5000, + receiveTimeout: 3000, + ); + this.dio = new Dio(options); + } + + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } + + this.serializers = serializers ?? standardSerializers; } - this.serializers = serializers ?? standardSerializers; -} + void setOAuthToken(String name, String token) { + (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor, orElse: null) as OAuthInterceptor)?.tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (this.dio.interceptors.firstWhere((element) => element is BasicAuthInterceptor, orElse: null) as BasicAuthInterceptor)?.authInfo[name] = BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor, orElse: null) as ApiKeyAuthInterceptor)?.apiKeys[name] = apiKey; + } {{#apiInfo}}{{#apis}} /** @@ -35,4 +58,4 @@ class {{clientName}} { } {{/apis}}{{/apiInfo}} -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart-dio/auth/api_key_auth.mustache new file mode 100644 index 000000000000..dac23a9fcbc4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-dio/auth/api_key_auth.mustache @@ -0,0 +1,27 @@ +import 'dart:async'; +import 'package:{{pubName}}/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map<String, String> apiKeys = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + break; + } + } + return super.onRequest(options); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/auth/auth.mustache b/modules/openapi-generator/src/main/resources/dart-dio/auth/auth.mustache new file mode 100644 index 000000000000..703127c762bc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-dio/auth/auth.mustache @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List<Map<String, dynamic>> getAuthInfo(RequestOptions route, String type) { + if (route.extra.containsKey("secure")) { + final auth = route.extra["secure"]; + List<Map<String, dynamic>> results = []; + for (var info in auth) { + if(info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/auth/basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart-dio/auth/basic_auth.mustache new file mode 100644 index 000000000000..bcf4b50f59e5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-dio/auth/basic_auth.mustache @@ -0,0 +1,31 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:{{pubName}}/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map<String, BasicAuthInfo> authInfo = {}; + + @override + Future onRequest(RequestOptions options) { + final metadataAuthInfo = getAuthInfo(options, 'basic'); + for (var info in metadataAuthInfo) { + final authName = info['name']; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + String basicAuth = 'Basic ' + base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}')); + options.headers['Authorization'] = basicAuth; + break; + } + } + + return super.onRequest(options); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart-dio/auth/oauth.mustache new file mode 100644 index 000000000000..282428297a8e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-dio/auth/oauth.mustache @@ -0,0 +1,20 @@ +import 'dart:async'; +import 'package:{{pubName}}/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map<String, String> tokens = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + options.headers["Authorization"] = "Bearer ${token}"; + break; + } + } + return super.onRequest(options); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-dio/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart-dio/pubspec.mustache index 90b1b532962d..fe1bfa2d5451 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/pubspec.mustache @@ -4,13 +4,13 @@ description: {{pubDescription}} environment: sdk: ">=2.3.0 <3.0.0" dependencies: - dio: ^3.0.4 - built_value: ^6.8.2 - built_collection: ^4.2.2 + dio: ^3.0.9 + built_value: ^7.1.0 + built_collection: ^4.3.2 {{#timeMachine}} time_machine: ^0.9.12 {{/timeMachine}} dev_dependencies: - built_value_generator: ^6.8.2 + built_value_generator: ^7.1.0 build_runner: ^1.7.1 - test: 1.6.5 + diff --git a/modules/openapi-generator/src/main/resources/dart-dio/serializers.mustache b/modules/openapi-generator/src/main/resources/dart-dio/serializers.mustache index 76ebd4a0dc6f..16998d739db0 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/serializers.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/serializers.mustache @@ -1,5 +1,6 @@ library serializers; +import 'package:built_value/iso_8601_date_time_serializer.dart'; import 'package:built_value/serializer.dart'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/json_object.dart'; @@ -22,6 +23,7 @@ Serializers serializers = (_$serializers.toBuilder() const FullType(BuiltList, const [const FullType({{classname}})]), () => new ListBuilder<{{classname}}>()) {{/model}}{{/models}} +..add(Iso8601DateTimeSerializer()) ).build(); Serializers standardSerializers = diff --git a/samples/client/petstore/dart-dio/lib/api.dart b/samples/client/petstore/dart-dio/lib/api.dart index 5206fb1d36ab..5cca5eafdc62 100644 --- a/samples/client/petstore/dart-dio/lib/api.dart +++ b/samples/client/petstore/dart-dio/lib/api.dart @@ -3,29 +3,52 @@ library openapi.api; import 'package:dio/dio.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/serializers.dart'; +import 'package:openapi/auth/api_key_auth.dart'; +import 'package:openapi/auth/basic_auth.dart'; +import 'package:openapi/auth/oauth.dart'; import 'package:openapi/api/pet_api.dart'; import 'package:openapi/api/store_api.dart'; import 'package:openapi/api/user_api.dart'; +final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; + class Openapi { Dio dio; Serializers serializers; String basePath = "http://petstore.swagger.io/v2"; - Openapi({this.dio, Serializers serializers}) { - if (dio == null) { - BaseOptions options = new BaseOptions( - baseUrl: basePath, - connectTimeout: 5000, - receiveTimeout: 3000, - ); - this.dio = new Dio(options); + Openapi({this.dio, Serializers serializers, String basePathOverride, List<Interceptor> interceptors}) { + if (dio == null) { + BaseOptions options = new BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: 5000, + receiveTimeout: 3000, + ); + this.dio = new Dio(options); + } + + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } + + this.serializers = serializers ?? standardSerializers; } - this.serializers = serializers ?? standardSerializers; -} + void setOAuthToken(String name, String token) { + (this.dio.interceptors.firstWhere((element) => element is OAuthInterceptor, orElse: null) as OAuthInterceptor)?.tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (this.dio.interceptors.firstWhere((element) => element is BasicAuthInterceptor, orElse: null) as BasicAuthInterceptor)?.authInfo[name] = BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor, orElse: null) as ApiKeyAuthInterceptor)?.apiKeys[name] = apiKey; + } /** @@ -55,4 +78,4 @@ class Openapi { } -} \ No newline at end of file +} diff --git a/samples/client/petstore/dart-dio/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/lib/api/pet_api.dart index c5a66f32cc7a..f7d784576d53 100644 --- a/samples/client/petstore/dart-dio/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/lib/api/pet_api.dart @@ -44,6 +44,9 @@ class PetApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -75,6 +78,9 @@ class PetApi { options: Options( method: 'delete'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -106,13 +112,16 @@ class PetApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - BuiltList<Pet> dataList = _serializers.deserialize(response.data, specifiedType: type); + BuiltList<Pet> dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); var data = dataList.toList(); return Response<List<Pet>>( @@ -152,13 +161,16 @@ class PetApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); - BuiltList<Pet> dataList = _serializers.deserialize(response.data, specifiedType: type); + BuiltList<Pet> dataList = _serializers.deserialize(response.data is String ? jsonDecode(response.data) : response.data, specifiedType: type); var data = dataList.toList(); return Response<List<Pet>>( @@ -197,13 +209,16 @@ class PetApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(Pet); - var data = _serializers.deserializeWith<Pet>(serializer, response.data); + var data = _serializers.deserializeWith<Pet>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<Pet>( data: data, @@ -244,6 +259,9 @@ class PetApi { options: Options( method: 'put'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -278,6 +296,9 @@ class PetApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -316,13 +337,16 @@ class PetApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "oauth2", "name": "petstore_auth" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(ApiResponse); - var data = _serializers.deserializeWith<ApiResponse>(serializer, response.data); + var data = _serializers.deserializeWith<ApiResponse>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<ApiResponse>( data: data, diff --git a/samples/client/petstore/dart-dio/lib/api/store_api.dart b/samples/client/petstore/dart-dio/lib/api/store_api.dart index 92e4a1394fd1..9ecb7f2846f0 100644 --- a/samples/client/petstore/dart-dio/lib/api/store_api.dart +++ b/samples/client/petstore/dart-dio/lib/api/store_api.dart @@ -38,6 +38,9 @@ class StoreApi { options: Options( method: 'delete'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -68,13 +71,16 @@ class StoreApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(Map<String, int>); - var data = _serializers.deserializeWith<Map<String, int>>(serializer, response.data); + var data = _serializers.deserializeWith<Map<String, int>>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<Map<String, int>>( data: data, @@ -112,13 +118,16 @@ class StoreApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(Order); - var data = _serializers.deserializeWith<Order>(serializer, response.data); + var data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<Order>( data: data, @@ -159,13 +168,16 @@ class StoreApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(Order); - var data = _serializers.deserializeWith<Order>(serializer, response.data); + var data = _serializers.deserializeWith<Order>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<Order>( data: data, diff --git a/samples/client/petstore/dart-dio/lib/api/user_api.dart b/samples/client/petstore/dart-dio/lib/api/user_api.dart index 2e127ec8d7e1..ed522810979d 100644 --- a/samples/client/petstore/dart-dio/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/lib/api/user_api.dart @@ -41,6 +41,9 @@ class UserApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -75,6 +78,9 @@ class UserApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -109,6 +115,9 @@ class UserApi { options: Options( method: 'post'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -139,6 +148,9 @@ class UserApi { options: Options( method: 'delete'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -169,13 +181,16 @@ class UserApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(User); - var data = _serializers.deserializeWith<User>(serializer, response.data); + var data = _serializers.deserializeWith<User>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<User>( data: data, @@ -215,13 +230,16 @@ class UserApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, ).then((response) { var serializer = _serializers.serializerForType(String); - var data = _serializers.deserializeWith<String>(serializer, response.data); + var data = _serializers.deserializeWith<String>(serializer, response.data is String ? jsonDecode(response.data) : response.data); return Response<String>( data: data, @@ -259,6 +277,9 @@ class UserApi { options: Options( method: 'get'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, @@ -292,6 +313,9 @@ class UserApi { options: Options( method: 'put'.toUpperCase(), headers: headerParams, + extra: { + 'secure': [], + }, contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", ), cancelToken: cancelToken, diff --git a/samples/client/petstore/dart-dio/lib/auth/api_key_auth.dart b/samples/client/petstore/dart-dio/lib/auth/api_key_auth.dart new file mode 100644 index 000000000000..6cde089a9a18 --- /dev/null +++ b/samples/client/petstore/dart-dio/lib/auth/api_key_auth.dart @@ -0,0 +1,27 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map<String, String> apiKeys = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + break; + } + } + return super.onRequest(options); + } +} diff --git a/samples/client/petstore/dart-dio/lib/auth/auth.dart b/samples/client/petstore/dart-dio/lib/auth/auth.dart new file mode 100644 index 000000000000..703127c762bc --- /dev/null +++ b/samples/client/petstore/dart-dio/lib/auth/auth.dart @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List<Map<String, dynamic>> getAuthInfo(RequestOptions route, String type) { + if (route.extra.containsKey("secure")) { + final auth = route.extra["secure"]; + List<Map<String, dynamic>> results = []; + for (var info in auth) { + if(info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/samples/client/petstore/dart-dio/lib/auth/basic_auth.dart b/samples/client/petstore/dart-dio/lib/auth/basic_auth.dart new file mode 100644 index 000000000000..14334a2d2880 --- /dev/null +++ b/samples/client/petstore/dart-dio/lib/auth/basic_auth.dart @@ -0,0 +1,31 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map<String, BasicAuthInfo> authInfo = {}; + + @override + Future onRequest(RequestOptions options) { + final metadataAuthInfo = getAuthInfo(options, 'basic'); + for (var info in metadataAuthInfo) { + final authName = info['name']; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + String basicAuth = 'Basic ' + base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}')); + options.headers['Authorization'] = basicAuth; + break; + } + } + + return super.onRequest(options); + } +} diff --git a/samples/client/petstore/dart-dio/lib/auth/oauth.dart b/samples/client/petstore/dart-dio/lib/auth/oauth.dart new file mode 100644 index 000000000000..3fb06b580b97 --- /dev/null +++ b/samples/client/petstore/dart-dio/lib/auth/oauth.dart @@ -0,0 +1,20 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:dio/dio.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map<String, String> tokens = {}; + + @override + Future onRequest(RequestOptions options) { + final authInfo = getAuthInfo(options, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + options.headers["Authorization"] = "Bearer ${token}"; + break; + } + } + return super.onRequest(options); + } +} diff --git a/samples/client/petstore/dart-dio/lib/serializers.dart b/samples/client/petstore/dart-dio/lib/serializers.dart index 155e4069d2e1..5db183b7438d 100644 --- a/samples/client/petstore/dart-dio/lib/serializers.dart +++ b/samples/client/petstore/dart-dio/lib/serializers.dart @@ -1,5 +1,6 @@ library serializers; +import 'package:built_value/iso_8601_date_time_serializer.dart'; import 'package:built_value/serializer.dart'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/json_object.dart'; @@ -46,6 +47,7 @@ const FullType(BuiltList, const [const FullType(Tag)]), const FullType(BuiltList, const [const FullType(User)]), () => new ListBuilder<User>()) +..add(Iso8601DateTimeSerializer()) ).build(); Serializers standardSerializers = diff --git a/samples/client/petstore/dart-dio/pubspec.yaml b/samples/client/petstore/dart-dio/pubspec.yaml index 2b2b55e1f948..92cbb8255c5a 100644 --- a/samples/client/petstore/dart-dio/pubspec.yaml +++ b/samples/client/petstore/dart-dio/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client environment: sdk: ">=2.3.0 <3.0.0" dependencies: - dio: ^3.0.4 - built_value: ^6.8.2 - built_collection: ^4.2.2 + dio: ^3.0.9 + built_value: ^7.1.0 + built_collection: ^4.3.2 dev_dependencies: - built_value_generator: ^6.8.2 + built_value_generator: ^7.1.0 build_runner: ^1.7.1 - test: 1.6.5 + From 6439990463f0410504111be01855c4baefeca64c Mon Sep 17 00:00:00 2001 From: "https://gitlab.com/selankon" <selankon@selankon.xyz> Date: Sat, 2 May 2020 08:27:27 -0500 Subject: [PATCH 48/78] Add listFromJson method to fix #4887 (#5355) --- .../openapi-generator/src/main/resources/dart2/enum.mustache | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache index 87bbed91767f..24ce94f04351 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -16,6 +16,10 @@ class {{classname}} { static {{classname}} fromJson({{dataType}} value) { return new {{classname}}TypeTransformer().decode(value); } + + static List<{{classname}}> listFromJson(List<dynamic> json) { + return json == null ? new List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList(); + } } class {{classname}}TypeTransformer { From 973258912c097d7fb7b362eca148dc3cfe3da410 Mon Sep 17 00:00:00 2001 From: Tatsuro Shibamura <me@shibayan.jp> Date: Sat, 2 May 2020 22:39:24 +0900 Subject: [PATCH 49/78] [csharp-netcore] Fixed handling of nullable enum values (#6112) * [csharp-netcore] Fixed handling of nullable enum values * Update sample code * Remove unnecessary method calls --- .../languages/AbstractCSharpCodegen.java | 54 +++++++++ .../languages/CSharpNetCoreClientCodegen.java | 12 -- .../resources/csharp-netcore/api.mustache | 108 +++++++++-------- .../src/Org.OpenAPITools/Api/FakeApi.cs | 112 +++++------------- .../src/Org.OpenAPITools/Api/PetApi.cs | 34 ++---- .../src/Org.OpenAPITools/Api/StoreApi.cs | 6 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 38 ++---- .../src/Org.OpenAPITools/Api/FakeApi.cs | 112 +++++------------- .../src/Org.OpenAPITools/Api/PetApi.cs | 34 ++---- .../src/Org.OpenAPITools/Api/StoreApi.cs | 6 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 38 ++---- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 + .../src/Org.OpenAPITools/Model/FormatTest.cs | 16 ++- .../src/Org.OpenAPITools/Api/FakeApi.cs | 2 +- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 + .../Org.OpenAPITools.sln | 10 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 2 +- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 2 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 2 +- .../src/Org.OpenAPITools/Client/ApiClient.cs | 1 + .../src/Org.OpenAPITools/Model/FormatTest.cs | 16 ++- 23 files changed, 264 insertions(+), 345 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index a3411f68a2a4..66af4e39a872 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -417,6 +417,7 @@ public Map<String, Object> postProcessAllModels(Map<String, Object> objs) { final Map<String, Object> processed = super.postProcessAllModels(objs); postProcessEnumRefs(processed); updateValueTypeProperty(processed); + updateNullableTypeProperty(processed); return processed; } @@ -603,6 +604,25 @@ protected void updateValueTypeProperty(Map<String, Object> models) { } } + /** + * Update property if it is a C# nullable type + * + * @param models list of all models + */ + protected void updateNullableTypeProperty(Map<String, Object> models) { + for (Map.Entry<String, Object> entry : models.entrySet()) { + String openAPIName = entry.getKey(); + CodegenModel model = ModelUtils.getModelByName(openAPIName, models); + if (model != null) { + for (CodegenProperty var : model.vars) { + if (!var.isContainer && (nullableType.contains(var.dataType) || var.isEnum)) { + var.vendorExtensions.put("x-csharp-value-type", true); + } + } + } + } + } + @Override public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) { super.postProcessOperationsWithModels(objs, allModels); @@ -678,6 +698,9 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o } } } + } else { + // Effectively mark enum models as enums + updateCodegenParametersEnum(operation.allParams, allModels); } processOperation(operation); @@ -692,6 +715,37 @@ protected void processOperation(CodegenOperation operation) { // default noop } + private void updateCodegenParametersEnum(List<CodegenParameter> parameters, List<Object> allModels) { + for (CodegenParameter parameter : parameters) { + CodegenModel model = null; + for (Object modelHashMap : allModels) { + CodegenModel codegenModel = ((HashMap<String, CodegenModel>) modelHashMap).get("model"); + if (codegenModel.getClassname().equals(parameter.dataType)) { + model = codegenModel; + break; + } + } + + if (model != null) { + // Effectively mark enum models as enums and non-nullable + if (model.isEnum) { + parameter.isEnum = true; + parameter.allowableValues = model.allowableValues; + parameter.isPrimitiveType = true; + parameter.vendorExtensions.put("x-csharp-value-type", true); + } + } + + if (!parameter.isContainer && nullableType.contains(parameter.dataType)) { + parameter.vendorExtensions.put("x-csharp-value-type", true); + } + + if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional + parameter.dataType = parameter.dataType + "?"; + } + } + } + @Override public String apiFileFolder() { return outputFolder + File.separator + sourceFolder + File.separator + packageName + File.separator + apiPackage(); 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 22e5597fbec5..a74472ea123b 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 @@ -423,10 +423,6 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert postProcessEmitDefaultValue(property.vendorExtensions); super.postProcessModelProperty(model, property); - - if (!property.isContainer && (nullableType.contains(property.dataType) || property.isEnum)) { - property.vendorExtensions.put("x-csharp-value-type", true); - } } @Override @@ -461,14 +457,6 @@ public void postProcessParameter(CodegenParameter parameter) { postProcessPattern(parameter.pattern, parameter.vendorExtensions); postProcessEmitDefaultValue(parameter.vendorExtensions); super.postProcessParameter(parameter); - - if (nullableType.contains(parameter.dataType)) { - if (!parameter.required) { //optional - parameter.dataType = parameter.dataType + "?"; - } else { - parameter.vendorExtensions.put("x-csharp-value-type", true); - } - } } /* diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache index af912e73577f..acb38af063a4 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache @@ -256,36 +256,48 @@ namespace {{packageName}}.{{apiPackage}} if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); {{#pathParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter + {{/required}} + {{^required}} if ({{paramName}} != null) + { localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter - {{/vendorExtensions.x-csharp-value-type}} + } + {{/required}} {{/pathParams}} {{#queryParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); + {{/required}} + {{^required}} if ({{paramName}} != null) { localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); } - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); - {{/vendorExtensions.x-csharp-value-type}} + {{/required}} {{/queryParams}} {{#headerParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter + {{/required}} + {{^required}} if ({{paramName}} != null) + { localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter - {{/vendorExtensions.x-csharp-value-type}} + } + {{/required}} {{/headerParams}} {{#formParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + {{#isFile}} + localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}}); + {{/isFile}} + {{^isFile}} + localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter + {{/isFile}} + {{/required}} + {{^required}} if ({{paramName}} != null) { {{#isFile}} @@ -295,15 +307,7 @@ namespace {{packageName}}.{{apiPackage}} localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter {{/isFile}} } - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - {{#isFile}} - localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}}); - {{/isFile}} - {{^isFile}} - localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter - {{/isFile}} - {{/vendorExtensions.x-csharp-value-type}} + {{/required}} {{/formParams}} {{#bodyParam}} localVarRequestOptions.Data = {{paramName}}; @@ -415,36 +419,48 @@ namespace {{packageName}}.{{apiPackage}} localVarRequestOptions.HeaderParameters.Add("Accept", _accept); {{#pathParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter + {{/required}} + {{^required}} if ({{paramName}} != null) + { localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - localVarRequestOptions.PathParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // path parameter - {{/vendorExtensions.x-csharp-value-type}} + } + {{/required}} {{/pathParams}} {{#queryParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); + {{/required}} + {{^required}} if ({{paramName}} != null) { localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); } - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}})); - {{/vendorExtensions.x-csharp-value-type}} + {{/required}} {{/queryParams}} {{#headerParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter + {{/required}} + {{^required}} if ({{paramName}} != null) + { localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - localVarRequestOptions.HeaderParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // header parameter - {{/vendorExtensions.x-csharp-value-type}} + } + {{/required}} {{/headerParams}} {{#formParams}} - {{^vendorExtensions.x-csharp-value-type}} + {{#required}} + {{#isFile}} + localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}}); + {{/isFile}} + {{^isFile}} + localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter + {{/isFile}} + {{/required}} + {{^required}} if ({{paramName}} != null) { {{#isFile}} @@ -454,15 +470,7 @@ namespace {{packageName}}.{{apiPackage}} localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter {{/isFile}} } - {{/vendorExtensions.x-csharp-value-type}} - {{#vendorExtensions.x-csharp-value-type}} - {{#isFile}} - localVarRequestOptions.FileParameters.Add("{{baseName}}", {{paramName}}); - {{/isFile}} - {{^isFile}} - localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}})); // form parameter - {{/isFile}} - {{/vendorExtensions.x-csharp-value-type}} + {{/required}} {{/formParams}} {{#bodyParam}} localVarRequestOptions.Data = {{paramName}}; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs index a4ab49f4424d..df3d3f146703 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1565,10 +1565,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> TestBodyWithQueryParamsWithHt var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (query != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); localVarRequestOptions.Data = body; @@ -1631,10 +1628,7 @@ public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync (string qu foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (query != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); localVarRequestOptions.Data = body; @@ -1857,14 +1851,8 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode { localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_string)); // form parameter } - if (patternWithoutDelimiter != null) - { - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - } - if (_byte != null) - { - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter - } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter if (binary != null) { localVarRequestOptions.FileParameters.Add("binary", binary); @@ -1998,14 +1986,8 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode { localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_string)); // form parameter } - if (patternWithoutDelimiter != null) - { - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - } - if (_byte != null) - { - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter - } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter if (binary != null) { localVarRequestOptions.FileParameters.Add("binary", binary); @@ -2113,9 +2095,13 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); } if (enumHeaderStringArray != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } if (enumHeaderString != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } if (enumFormStringArray != null) { localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter @@ -2206,9 +2192,13 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); } if (enumHeaderStringArray != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } if (enumHeaderString != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } if (enumFormStringArray != null) { localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter @@ -2288,7 +2278,9 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode } localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter if (booleanGroup != null) + { localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } // make the HTTP request @@ -2361,7 +2353,9 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode } localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter if (booleanGroup != null) + { localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } // make the HTTP request @@ -2533,14 +2527,8 @@ public Org.OpenAPITools.Client.ApiResponse<Object> TestJsonFormDataWithHttpInfo var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (param != null) - { - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - } - if (param2 != null) - { - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - } + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter // make the HTTP request @@ -2602,14 +2590,8 @@ public async System.Threading.Tasks.Task TestJsonFormDataAsync (string param, st foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (param != null) - { - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - } - if (param2 != null) - { - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - } + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter // make the HTTP request @@ -2687,26 +2669,11 @@ public Org.OpenAPITools.Client.ApiResponse<Object> TestQueryParameterCollectionF var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (pipe != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); - } - if (ioutil != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - } - if (http != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); - } - if (url != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - } - if (context != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); // make the HTTP request @@ -2785,26 +2752,11 @@ public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (pipe != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); - } - if (ioutil != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - } - if (http != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); - } - if (url != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - } - if (context != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); // make the HTTP request diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs index 0fe84290ce2b..502c7f252689 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs @@ -725,7 +725,9 @@ public async System.Threading.Tasks.Task AddPetAsync (Pet body) 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 @@ -786,7 +788,9 @@ public async System.Threading.Tasks.Task AddPetAsync (Pet body) 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 @@ -849,10 +853,7 @@ public Org.OpenAPITools.Client.ApiResponse< List<Pet> > FindPetsByStatusWithHttp var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (status != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); // authentication (petstore_auth) required // oauth required @@ -916,10 +917,7 @@ public async System.Threading.Tasks.Task<List<Pet>> FindPetsByStatusAsync (List< foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (status != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); // authentication (petstore_auth) required // oauth required @@ -982,10 +980,7 @@ public Org.OpenAPITools.Client.ApiResponse< List<Pet> > FindPetsByTagsWithHttpIn var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (tags != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); // authentication (petstore_auth) required // oauth required @@ -1049,10 +1044,7 @@ public async System.Threading.Tasks.Task<List<Pet>> FindPetsByTagsAsync (List<st foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (tags != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); // authentication (petstore_auth) required // oauth required @@ -1648,10 +1640,7 @@ public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) { localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter } - if (requiredFile != null) - { - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); // authentication (petstore_auth) required // oauth required @@ -1724,10 +1713,7 @@ public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) { localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter } - if (requiredFile != null) - { - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); // authentication (petstore_auth) required // oauth required diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs index bba650881173..40f9fb0fab30 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs @@ -358,8 +358,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> DeleteOrderWithHttpInfo (stri var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (orderId != null) - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter // make the HTTP request @@ -414,8 +413,7 @@ public async System.Threading.Tasks.Task DeleteOrderAsync (string orderId) foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (orderId != null) - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter // make the HTTP request diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs index 57e4e369cc58..e20098ed6547 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/UserApi.cs @@ -861,8 +861,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> DeleteUserWithHttpInfo (strin var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -917,8 +916,7 @@ public async System.Threading.Tasks.Task DeleteUserAsync (string username) foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -975,8 +973,7 @@ public Org.OpenAPITools.Client.ApiResponse< User > GetUserByNameWithHttpInfo (st var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -1034,8 +1031,7 @@ public async System.Threading.Tasks.Task<User> GetUserByNameAsync (string userna foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -1098,14 +1094,8 @@ public Org.OpenAPITools.Client.ApiResponse< string > LoginUserWithHttpInfo (stri var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - } - if (password != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); // make the HTTP request @@ -1169,14 +1159,8 @@ public async System.Threading.Tasks.Task<string> LoginUserAsync (string username foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - } - if (password != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); // make the HTTP request @@ -1331,8 +1315,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> UpdateUserWithHttpInfo (strin var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter localVarRequestOptions.Data = body; @@ -1394,8 +1377,7 @@ public async System.Threading.Tasks.Task UpdateUserAsync (string username, User foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter localVarRequestOptions.Data = body; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs index a4ab49f4424d..df3d3f146703 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1565,10 +1565,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> TestBodyWithQueryParamsWithHt var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (query != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); localVarRequestOptions.Data = body; @@ -1631,10 +1628,7 @@ public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync (string qu foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (query != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); localVarRequestOptions.Data = body; @@ -1857,14 +1851,8 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode { localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_string)); // form parameter } - if (patternWithoutDelimiter != null) - { - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - } - if (_byte != null) - { - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter - } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter if (binary != null) { localVarRequestOptions.FileParameters.Add("binary", binary); @@ -1998,14 +1986,8 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode { localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_string)); // form parameter } - if (patternWithoutDelimiter != null) - { - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - } - if (_byte != null) - { - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter - } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(_byte)); // form parameter if (binary != null) { localVarRequestOptions.FileParameters.Add("binary", binary); @@ -2113,9 +2095,13 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); } if (enumHeaderStringArray != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } if (enumHeaderString != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } if (enumFormStringArray != null) { localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter @@ -2206,9 +2192,13 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); } if (enumHeaderStringArray != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } if (enumHeaderString != null) + { localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } if (enumFormStringArray != null) { localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray)); // form parameter @@ -2288,7 +2278,9 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode } localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter if (booleanGroup != null) + { localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } // make the HTTP request @@ -2361,7 +2353,9 @@ public async System.Threading.Tasks.Task<ModelClient> TestClientModelAsync (Mode } localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter if (booleanGroup != null) + { localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } // make the HTTP request @@ -2533,14 +2527,8 @@ public Org.OpenAPITools.Client.ApiResponse<Object> TestJsonFormDataWithHttpInfo var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (param != null) - { - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - } - if (param2 != null) - { - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - } + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter // make the HTTP request @@ -2602,14 +2590,8 @@ public async System.Threading.Tasks.Task TestJsonFormDataAsync (string param, st foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (param != null) - { - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - } - if (param2 != null) - { - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - } + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter // make the HTTP request @@ -2687,26 +2669,11 @@ public Org.OpenAPITools.Client.ApiResponse<Object> TestQueryParameterCollectionF var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (pipe != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); - } - if (ioutil != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - } - if (http != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); - } - if (url != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - } - if (context != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); // make the HTTP request @@ -2785,26 +2752,11 @@ public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (pipe != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); - } - if (ioutil != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - } - if (http != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); - } - if (url != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - } - if (context != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("space", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); // make the HTTP request diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs index 0fe84290ce2b..502c7f252689 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs @@ -725,7 +725,9 @@ public async System.Threading.Tasks.Task AddPetAsync (Pet body) 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 @@ -786,7 +788,9 @@ public async System.Threading.Tasks.Task AddPetAsync (Pet body) 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 @@ -849,10 +853,7 @@ public Org.OpenAPITools.Client.ApiResponse< List<Pet> > FindPetsByStatusWithHttp var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (status != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); // authentication (petstore_auth) required // oauth required @@ -916,10 +917,7 @@ public async System.Threading.Tasks.Task<List<Pet>> FindPetsByStatusAsync (List< foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (status != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); // authentication (petstore_auth) required // oauth required @@ -982,10 +980,7 @@ public Org.OpenAPITools.Client.ApiResponse< List<Pet> > FindPetsByTagsWithHttpIn var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (tags != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); // authentication (petstore_auth) required // oauth required @@ -1049,10 +1044,7 @@ public async System.Threading.Tasks.Task<List<Pet>> FindPetsByTagsAsync (List<st foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (tags != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); // authentication (petstore_auth) required // oauth required @@ -1648,10 +1640,7 @@ public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) { localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter } - if (requiredFile != null) - { - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); // authentication (petstore_auth) required // oauth required @@ -1724,10 +1713,7 @@ public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) { localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter } - if (requiredFile != null) - { - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); // authentication (petstore_auth) required // oauth required diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs index bba650881173..40f9fb0fab30 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -358,8 +358,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> DeleteOrderWithHttpInfo (stri var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (orderId != null) - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter // make the HTTP request @@ -414,8 +413,7 @@ public async System.Threading.Tasks.Task DeleteOrderAsync (string orderId) foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (orderId != null) - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter // make the HTTP request diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs index 57e4e369cc58..e20098ed6547 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/UserApi.cs @@ -861,8 +861,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> DeleteUserWithHttpInfo (strin var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -917,8 +916,7 @@ public async System.Threading.Tasks.Task DeleteUserAsync (string username) foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -975,8 +973,7 @@ public Org.OpenAPITools.Client.ApiResponse< User > GetUserByNameWithHttpInfo (st var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -1034,8 +1031,7 @@ public async System.Threading.Tasks.Task<User> GetUserByNameAsync (string userna foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter // make the HTTP request @@ -1098,14 +1094,8 @@ public Org.OpenAPITools.Client.ApiResponse< string > LoginUserWithHttpInfo (stri var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - } - if (password != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); // make the HTTP request @@ -1169,14 +1159,8 @@ public async System.Threading.Tasks.Task<string> LoginUserAsync (string username foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - } - if (password != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - } + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); // make the HTTP request @@ -1331,8 +1315,7 @@ public Org.OpenAPITools.Client.ApiResponse<Object> UpdateUserWithHttpInfo (strin var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter localVarRequestOptions.Data = body; @@ -1394,8 +1377,7 @@ public async System.Threading.Tasks.Task UpdateUserAsync (string username, User foreach (var _accept in _accepts) localVarRequestOptions.HeaderParameters.Add("Accept", _accept); - if (username != null) - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter localVarRequestOptions.Data = body; diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs index 0d0e5fad12f5..8c65f55887b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Client/ApiClient.cs @@ -473,6 +473,7 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> + /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs index 0d0e5fad12f5..8c65f55887b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Client/ApiClient.cs @@ -473,6 +473,7 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> + /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs index becce06e2006..0346d447e435 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FormatTest.cs @@ -367,6 +367,8 @@ public override int GetHashCode() /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { + + // Integer (int) maximum if(this.Integer > (int)100) { @@ -379,6 +381,8 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } + + // Int32 (int) maximum if(this.Int32 > (int)200) { @@ -391,6 +395,8 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } + + // Number (decimal) maximum if(this.Number > (decimal)543.2) { @@ -403,6 +409,8 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); } + + // Float (float) maximum if(this.Float > (float)987.6) { @@ -415,6 +423,8 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); } + + // Double (double) maximum if(this.Double > (double)123.4) { @@ -427,6 +437,8 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); } + + // String (string) pattern Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) @@ -434,6 +446,8 @@ public override int GetHashCode() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); } + + // Password (string) maxLength if(this.Password != null && this.Password.Length > 64) { @@ -445,7 +459,7 @@ public override int GetHashCode() { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } - + yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs index 42d7e6b373c0..e0b9c8bbe2f9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Api/FakeApi.cs @@ -2403,7 +2403,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod if (enumQueryDouble != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_double", enumQueryDouble)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", this.Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", this.Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter + if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.Serialize(enumFormStringArray)); // form parameter if (enumFormString != null) localVarFormParams.Add("enum_form_string", this.Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter diff --git a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs index 4b8e41dc2a13..83f3b0a7b66d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetCoreProject/src/Org.OpenAPITools/Client/ApiClient.cs @@ -505,6 +505,7 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> + /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/Org.OpenAPITools.sln b/samples/client/petstore/csharp/OpenAPIClientNetStandard/Org.OpenAPITools.sln index 8d85f5b71f0b..4f3b7e0fdef6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/Org.OpenAPITools.sln +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/Org.OpenAPITools.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3AB1F259-1769-484B-9411-84505FCCBD55}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,10 +10,10 @@ Global 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 + {3AB1F259-1769-484B-9411-84505FCCBD55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AB1F259-1769-484B-9411-84505FCCBD55}.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 diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs index 42d7e6b373c0..e0b9c8bbe2f9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs @@ -2403,7 +2403,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod if (enumQueryDouble != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_double", enumQueryDouble)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", this.Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", this.Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter + if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.Serialize(enumFormStringArray)); // form parameter if (enumFormString != null) localVarFormParams.Add("enum_form_string", this.Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs index 4b8e41dc2a13..83f3b0a7b66d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Client/ApiClient.cs @@ -505,6 +505,7 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> + /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 7c827a81c332..0b8a73d6143f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -12,7 +12,7 @@ The version of the OpenAPI document: 1.0.0 <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{321C8C3F-0156-40C1-AE42-D59761FB9B6C}</ProjectGuid> + <ProjectGuid>{3AB1F259-1769-484B-9411-84505FCCBD55}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Org.OpenAPITools</RootNamespace> diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs index 3749f51f3f9e..d739d62f0a98 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs @@ -2403,7 +2403,7 @@ public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClientMod if (enumQueryDouble != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_double", enumQueryDouble)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", this.Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", this.Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter + if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", this.Configuration.ApiClient.Serialize(enumFormStringArray)); // form parameter if (enumFormString != null) localVarFormParams.Add("enum_form_string", this.Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs index 4d536076615e..9ccb39dfeedd 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Client/ApiClient.cs @@ -500,6 +500,7 @@ public static string SanitizeFilename(string filename) /// Convert params to key/value pairs. /// Use collectionFormat to properly format lists and collections. /// </summary> + /// <param name="collectionFormat">Collection format.</param> /// <param name="name">Key name.</param> /// <param name="value">Value object.</param> /// <returns>A list of KeyValuePairs</returns> diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs index d8452eb07cb6..b3ebc9f373b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FormatTest.cs @@ -390,6 +390,8 @@ public virtual void OnPropertyChanged(string propertyName) /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { + + // Integer (int) maximum if(this.Integer > (int)100) { @@ -402,6 +404,8 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } + + // Int32 (int) maximum if(this.Int32 > (int)200) { @@ -414,6 +418,8 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } + + // Number (decimal) maximum if(this.Number > (decimal)543.2) { @@ -426,6 +432,8 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); } + + // Float (float) maximum if(this.Float > (float)987.6) { @@ -438,6 +446,8 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); } + + // Double (double) maximum if(this.Double > (double)123.4) { @@ -450,6 +460,8 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); } + + // String (string) pattern Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) @@ -457,6 +469,8 @@ public virtual void OnPropertyChanged(string propertyName) yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); } + + // Password (string) maxLength if(this.Password != null && this.Password.Length > 64) { @@ -468,7 +482,7 @@ public virtual void OnPropertyChanged(string propertyName) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } - + yield break; } } From 03c3c64d2347532801bce5b9219edc445c915703 Mon Sep 17 00:00:00 2001 From: Aleksandr Nekrasov <snake_nas@mail.ru> Date: Sat, 2 May 2020 20:49:34 +0700 Subject: [PATCH 50/78] [scala][akka-http] fix non-default packages for api, model and invoker (#6129) * [scala][akka-http] fix non-default packages for api, model and invoker * remove default invoker additionalProperty * fix invoker package for scala-akka and sttp * fix invoker package and settings for scala-akka * fix tests compatible with windows paths * test output * test output * fix base output path for test * fix output path for test * fix sttp invoker package --- .../languages/AbstractScalaCodegen.java | 4 ++ .../languages/ScalaAkkaClientCodegen.java | 23 ++++--- .../resources/scala-akka-client/api.mustache | 6 +- .../scala-akka-client/apiInvoker.mustache | 6 +- .../scala-akka-client/apiRequest.mustache | 2 +- .../scala-akka-client/apiSettings.mustache | 4 +- .../scala-akka-client/model.mustache | 2 +- .../scala-akka-client/requests.mustache | 2 +- .../main/resources/scala-sttp/api.mustache | 2 +- .../resources/scala-sttp/apiInvoker.mustache | 2 +- .../main/resources/scala-sttp/model.mustache | 2 +- .../resources/scala-sttp/requests.mustache | 2 +- .../scalaakka/ScalaAkkaClientCodegenTest.java | 63 +++++++++++++++++++ 13 files changed, 97 insertions(+), 23 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java index 5d1a0c59087b..af24ba9c21a7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java @@ -563,4 +563,8 @@ public String toOperationId(String operationId) { return operationId; } + public void setInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java index c6da992792b9..299a8e79e57d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java @@ -99,7 +99,6 @@ public ScalaAkkaClientCodegen() { "trait", "try", "true", "type", "val", "var", "while", "with", "yield") ); - additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); additionalProperties.put(CodegenConstants.GROUP_ID, groupId); additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); @@ -112,7 +111,6 @@ public ScalaAkkaClientCodegen() { additionalProperties.put("fnCapitalize", new CapitalizeLambda()); additionalProperties.put("fnCamelize", new CamelizeLambda(false)); additionalProperties.put("fnEnumEntry", new EnumEntryLambda()); - additionalProperties.put("mainPackage", mainPackage); importMapping.remove("Seq"); importMapping.remove("List"); @@ -146,16 +144,25 @@ public ScalaAkkaClientCodegen() { @Override public void processOpts() { super.processOpts(); + if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + } if (additionalProperties.containsKey("mainPackage")) { setMainPackage((String) additionalProperties.get("mainPackage")); additionalProperties.replace("configKeyPath", this.configKeyPath); - apiPackage = mainPackage + ".api"; - modelPackage = mainPackage + ".model"; - invokerPackage = mainPackage + ".core"; - additionalProperties.put("apiPackage", apiPackage); - additionalProperties.put("modelPackage", modelPackage); - additionalProperties.put("invokerPackage", invokerPackage); + if (!additionalProperties.containsKey(CodegenConstants.API_PACKAGE)){ + apiPackage = mainPackage + ".api"; + additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); + } + if (!additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)){ + modelPackage = mainPackage + ".model"; + additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage); + } + if (!additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)){ + invokerPackage = mainPackage + ".core"; + } } + additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache index 677d91b14ae2..5a6638148264 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache @@ -4,9 +4,9 @@ package {{package}} {{#imports}} import {{import}} {{/imports}} -import {{mainPackage}}.core._ -import {{mainPackage}}.core.CollectionFormats._ -import {{mainPackage}}.core.ApiKeyLocations._ +import {{invokerPackage}}._ +import {{invokerPackage}}.CollectionFormats._ +import {{invokerPackage}}.ApiKeyLocations._ {{#operations}} object {{classname}} { diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache index 83957a81896b..5999fe098214 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/apiInvoker.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -package {{{mainPackage}}}.core +package {{invokerPackage}} import java.io.File @@ -72,8 +72,8 @@ trait UnitJSONSupport { class ApiInvoker(formats: Formats)(implicit system: ActorSystem) extends CustomContentTypes with Json4sSupport { - import {{{mainPackage}}}.core.ApiInvoker._ - import {{{mainPackage}}}.core.ParametersMap._ + import {{{invokerPackage}}}.ApiInvoker._ + import {{{invokerPackage}}}.ParametersMap._ implicit val ec: ExecutionContextExecutor = system.dispatcher implicit val jsonFormats: Formats = formats diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/apiRequest.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/apiRequest.mustache index deb0845fe9aa..fd2ba29ea0bd 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/apiRequest.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/apiRequest.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -package {{{mainPackage}}}.core +package {{invokerPackage}} sealed trait ResponseState diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/apiSettings.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/apiSettings.mustache index d07e17bbe6d4..d5856ccc17d1 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/apiSettings.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/apiSettings.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -package {{{mainPackage}}}.core +package {{invokerPackage}} import java.util.concurrent.TimeUnit @@ -14,7 +14,7 @@ import scala.concurrent.duration.FiniteDuration class ApiSettings(config: Config) extends Extension { def this(system: ExtendedActorSystem) = this(system.settings.config) - private def cfg = config.getConfig("{{{mainPackage}}}.apiRequest") + private def cfg = config.getConfig("{{configKeyPath}}.{{configKey}}") val alwaysTrustCertificates: Boolean = cfg.getBoolean("trust-certificates") val defaultHeaders: List[RawHeader] = cfg.getConfig("default-headers").entrySet.asScala.toList.map(c => RawHeader(c.getKey, c.getValue.render)) diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache index d5e9b9d3876b..c2dcea153f7c 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache @@ -4,7 +4,7 @@ package {{package}} {{#imports}} import {{import}} {{/imports}} -import {{mainPackage}}.core.ApiModel +import {{invokerPackage}}.ApiModel {{#models}} {{#model}} diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache index 70c8138eb54e..6dd3ab7d9773 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/requests.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -package {{mainPackage}}.core +package {{invokerPackage}} import java.io.File import java.net.URLEncoder diff --git a/modules/openapi-generator/src/main/resources/scala-sttp/api.mustache b/modules/openapi-generator/src/main/resources/scala-sttp/api.mustache index 412bfca507d4..196a51a96f0d 100644 --- a/modules/openapi-generator/src/main/resources/scala-sttp/api.mustache +++ b/modules/openapi-generator/src/main/resources/scala-sttp/api.mustache @@ -4,7 +4,7 @@ package {{package}} {{#imports}} import {{import}} {{/imports}} -import {{mainPackage}}.core._ +import {{invokerPackage}}._ import alias._ import sttp.client._ import sttp.model.Method diff --git a/modules/openapi-generator/src/main/resources/scala-sttp/apiInvoker.mustache b/modules/openapi-generator/src/main/resources/scala-sttp/apiInvoker.mustache index 3d468d61b59a..af26ef8f2bb6 100644 --- a/modules/openapi-generator/src/main/resources/scala-sttp/apiInvoker.mustache +++ b/modules/openapi-generator/src/main/resources/scala-sttp/apiInvoker.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -package {{{mainPackage}}}.core +package {{invokerPackage}} import org.json4s._ import sttp.client._ diff --git a/modules/openapi-generator/src/main/resources/scala-sttp/model.mustache b/modules/openapi-generator/src/main/resources/scala-sttp/model.mustache index 941266f3306e..1f4da5283e32 100644 --- a/modules/openapi-generator/src/main/resources/scala-sttp/model.mustache +++ b/modules/openapi-generator/src/main/resources/scala-sttp/model.mustache @@ -4,7 +4,7 @@ package {{package}} {{#imports}} import {{import}} {{/imports}} -import {{mainPackage}}.core.ApiModel +import {{invokerPackage}}.ApiModel {{#models}} {{#model}} diff --git a/modules/openapi-generator/src/main/resources/scala-sttp/requests.mustache b/modules/openapi-generator/src/main/resources/scala-sttp/requests.mustache index 31158fd67cbf..a39706e43f4b 100644 --- a/modules/openapi-generator/src/main/resources/scala-sttp/requests.mustache +++ b/modules/openapi-generator/src/main/resources/scala-sttp/requests.mustache @@ -1,5 +1,5 @@ {{>licenseInfo}} -package {{mainPackage}}.core +package {{invokerPackage}} import sttp.client.{Identity, RequestT, ResponseError} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientCodegenTest.java index 34e536bdf906..e01425cac1c1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/scalaakka/ScalaAkkaClientCodegenTest.java @@ -419,4 +419,67 @@ public void stripModelNameTest() throws Exception { Assert.assertEquals(cm.classFilename, "NonStrippedModelName"); } + + @Test(description = "override only mainPackage") + public void mainPackageTest() throws Exception { + Map<String, Object> properties = new HashMap<>(); + properties.put("mainPackage", "hello.world"); + + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final DefaultCodegen codegen = new ScalaAkkaClientCodegen(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(codegen.getName()) + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/scala_reserved_words.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + MockDefaultGenerator generator = new MockDefaultGenerator(); + Generator gen = generator.opts(clientOptInput); + gen.generate(); + + Map<String, String> generatedFiles = generator.getFiles(); + Assert.assertEquals(generatedFiles.size(), 14); + + String outputPath = output.getAbsolutePath().replace("\\", "/"); + + Assert.assertTrue(generatedFiles.containsKey(outputPath + "/src/main/scala/hello/world/model/SomeObj.scala")); + Assert.assertTrue(generatedFiles.containsKey(outputPath + "/src/main/scala/hello/world/core/ApiSettings.scala")); + Assert.assertTrue(generatedFiles.containsKey(outputPath + "/src/main/scala/hello/world/api/PingApi.scala")); + } + + @Test(description = "override api packages") + public void overridePackagesTest() throws Exception { + Map<String, Object> properties = new HashMap<>(); + properties.put("mainPackage", "hello.world"); + properties.put("apiPackage", "hello.world.api.package"); + properties.put("modelPackage", "hello.world.model.package"); + properties.put("invokerPackage", "hello.world.package.invoker"); + + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final DefaultCodegen codegen = new ScalaAkkaClientCodegen(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(codegen.getName()) + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/scala_reserved_words.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + MockDefaultGenerator generator = new MockDefaultGenerator(); + Generator gen = generator.opts(clientOptInput); + gen.generate(); + + Map<String, String> generatedFiles = generator.getFiles(); + Assert.assertEquals(generatedFiles.size(), 14); + + String outputPath = output.getAbsolutePath().replace("\\", "/"); + + Assert.assertTrue(generatedFiles.containsKey(outputPath + "/src/main/scala/hello/world/model/package/SomeObj.scala"), "Model package is correct"); + Assert.assertTrue(generatedFiles.containsKey(outputPath + "/src/main/scala/hello/world/package/invoker/ApiSettings.scala"), "Invoker package is correct"); + Assert.assertTrue(generatedFiles.containsKey(outputPath + "/src/main/scala/hello/world/api/package/PingApi.scala"), "Api package is correct"); + } } From 77d6c04b2423ef2a4702ab8640d02e1f04a70d61 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Sat, 2 May 2020 08:31:45 -0700 Subject: [PATCH 51/78] [Java] Enhancements for HTTP message signature (#6090) * Add code comments * Change 'setup' method to setPrivateKey * Add support for configuring digest algorithm * run script in bin directory * format generated code * Revert "format generated code" This reverts commit 3b527784375bcf86cacf75bd0142f63b91c96ff8. --- .../auth/HttpSignatureAuth.mustache | 99 +- .../org/openapitools/client/ApiClient.java | 496 +++---- .../org/openapitools/client/ApiException.java | 158 +-- .../org/openapitools/client/ApiResponse.java | 91 +- .../openapitools/client/Configuration.java | 42 +- .../client/CustomInstantDeserializer.java | 276 ++-- .../java/org/openapitools/client/JSON.java | 12 +- .../java/org/openapitools/client/Pair.java | 66 +- .../client/RFC3339DateFormat.java | 7 +- .../client/ServerConfiguration.java | 91 +- .../openapitools/client/ServerVariable.java | 31 +- .../org/openapitools/client/StringUtil.java | 13 +- .../client/api/AnotherFakeApi.java | 78 +- .../openapitools/client/api/DefaultApi.java | 77 +- .../org/openapitools/client/api/FakeApi.java | 1252 +++++++---------- .../client/api/FakeClassnameTags123Api.java | 78 +- .../org/openapitools/client/api/PetApi.java | 638 ++++----- .../org/openapitools/client/api/StoreApi.java | 293 ++-- .../org/openapitools/client/api/UserApi.java | 544 ++++--- .../openapitools/client/auth/ApiKeyAuth.java | 20 +- .../client/auth/Authentication.java | 34 +- .../client/auth/HttpBasicAuth.java | 27 +- .../client/auth/HttpBearerAuth.java | 31 +- .../client/auth/HttpSignatureAuth.java | 140 +- .../org/openapitools/client/auth/OAuth.java | 20 +- .../openapitools/client/auth/OAuthFlow.java | 8 +- .../client/model/AbstractOpenApiSchema.java | 80 +- .../model/AdditionalPropertiesClass.java | 52 +- .../org/openapitools/client/model/Animal.java | 59 +- .../model/ArrayOfArrayOfNumberOnly.java | 37 +- .../client/model/ArrayOfNumberOnly.java | 37 +- .../openapitools/client/model/ArrayTest.java | 64 +- .../client/model/Capitalization.java | 100 +- .../org/openapitools/client/model/Cat.java | 42 +- .../openapitools/client/model/CatAllOf.java | 37 +- .../openapitools/client/model/Category.java | 51 +- .../openapitools/client/model/ClassModel.java | 36 +- .../org/openapitools/client/model/Client.java | 37 +- .../org/openapitools/client/model/Dog.java | 42 +- .../openapitools/client/model/DogAllOf.java | 37 +- .../openapitools/client/model/EnumArrays.java | 64 +- .../openapitools/client/model/EnumClass.java | 16 +- .../openapitools/client/model/EnumTest.java | 186 +-- .../client/model/FileSchemaTestClass.java | 47 +- .../org/openapitools/client/model/Foo.java | 37 +- .../openapitools/client/model/FormatTest.java | 256 ++-- .../client/model/HasOnlyReadOnly.java | 50 +- .../client/model/HealthCheckResult.java | 46 +- .../client/model/InlineObject.java | 52 +- .../client/model/InlineObject1.java | 47 +- .../client/model/InlineObject2.java | 65 +- .../client/model/InlineObject3.java | 231 +-- .../client/model/InlineObject4.java | 52 +- .../client/model/InlineObject5.java | 47 +- .../client/model/InlineResponseDefault.java | 38 +- .../openapitools/client/model/MapTest.java | 78 +- ...ropertiesAndAdditionalPropertiesClass.java | 64 +- .../client/model/Model200Response.java | 46 +- .../client/model/ModelApiResponse.java | 59 +- .../client/model/ModelReturn.java | 36 +- .../org/openapitools/client/model/Name.java | 68 +- .../client/model/NullableClass.java | 277 ++-- .../openapitools/client/model/NumberOnly.java | 37 +- .../org/openapitools/client/model/Order.java | 103 +- .../client/model/OuterComposite.java | 59 +- .../openapitools/client/model/OuterEnum.java | 16 +- .../client/model/OuterEnumDefaultValue.java | 16 +- .../client/model/OuterEnumInteger.java | 16 +- .../model/OuterEnumIntegerDefaultValue.java | 16 +- .../org/openapitools/client/model/Pet.java | 105 +- .../client/model/ReadOnlyFirst.java | 51 +- .../client/model/SpecialModelName.java | 41 +- .../org/openapitools/client/model/Tag.java | 51 +- .../org/openapitools/client/model/User.java | 119 +- .../openapitools/client/api/FakeApiTest.java | 2 +- 75 files changed, 4203 insertions(+), 3624 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache index 3a856e3bc3c5..e56e0d229106 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2-experimental/auth/HttpSignatureAuth.mustache @@ -19,42 +19,110 @@ import java.util.List; import org.tomitribe.auth.signatures.*; +/** + * A Configuration object for the HTTP message signature security scheme. + */ public class HttpSignatureAuth implements Authentication { private Signer signer; - private String name; + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + // The HTTP signature algorithm. private Algorithm algorithm; + // The list of HTTP headers that should be included in the HTTP signature. private List<String> headers; - public HttpSignatureAuth(String name, Algorithm algorithm, List<String> headers) { - this.name = name; + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param algorithm The signature algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, Algorithm algorithm, List<String> headers) { + this.keyId = keyId; this.algorithm = algorithm; this.headers = headers; + this.digestAlgorithm = "SHA-256"; } - public String getName() { - return name; + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; } - public void setName(String name) { - this.name = name; + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; } + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ public Algorithm getAlgorithm() { return algorithm; } + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ public void setAlgorithm(Algorithm algorithm) { this.algorithm = algorithm; } + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ public List<String> getHeaders() { return headers; } + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ public void setHeaders(List<String> headers) { this.headers = headers; } @@ -67,12 +135,17 @@ public class HttpSignatureAuth implements Authentication { this.signer = signer; } - public void setup(Key key) throws ApiException { + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + */ + public void setPrivateKey(Key key) throws ApiException { if (key == null) { - throw new ApiException("key (java.security.Key) cannot be null"); + throw new ApiException("Private key (java.security.Key) cannot be null"); } - signer = new Signer(key, new Signature(name, algorithm, null, headers)); + signer = new Signer(key, new Signature(keyId, algorithm, null, headers)); } @Override @@ -88,11 +161,13 @@ public class HttpSignatureAuth implements Authentication { } if (headers.contains("digest")) { - headerParams.put("digest", "SHA-256=" + new String(Base64.getEncoder().encode(MessageDigest.getInstance("SHA-256").digest(payload.getBytes())))); + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); } if (signer == null) { - throw new ApiException("Signer cannot be null. Please run the method `setup` to set it up correctly"); + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); } // construct the path with the URL query string diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java index fdbba2916ec9..ea977a7db5f6 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiClient.java @@ -1,26 +1,5 @@ package org.openapitools.client; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; @@ -31,97 +10,135 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; + import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.HttpUrlConnectorProvider; import org.glassfish.jersey.jackson.JacksonFeature; -import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.media.multipart.FormDataBodyPart; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.MultiPart; import org.glassfish.jersey.media.multipart.MultiPartFeature; -import org.openapitools.client.auth.ApiKeyAuth; + +import java.io.IOException; +import java.io.InputStream; + +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import org.glassfish.jersey.logging.LoggingFeature; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Date; +import java.util.TimeZone; + +import java.net.URLEncoder; + +import java.io.File; +import java.io.UnsupportedEncodingException; + +import java.text.DateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; import org.openapitools.client.auth.HttpSignatureAuth; -import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.model.AbstractOpenApiSchema; +import org.openapitools.client.auth.OAuth; + + public class ApiClient { protected Map<String, String> defaultHeaderMap = new HashMap<String, String>(); protected Map<String, String> defaultCookieMap = new HashMap<String, String>(); protected String basePath = "http://petstore.swagger.io:80/v2"; - protected List<ServerConfiguration> servers = - new ArrayList<ServerConfiguration>( - Arrays.asList( - new ServerConfiguration( - "http://{server}.swagger.io:{port}/v2", - "petstore server", - new HashMap<String, ServerVariable>() { - { - put( - "server", - new ServerVariable( - "No description provided", - "petstore", - new HashSet<String>( - Arrays.asList("petstore", "qa-petstore", "dev-petstore")))); - put( - "port", - new ServerVariable( - "No description provided", - "80", - new HashSet<String>(Arrays.asList("80", "8080")))); - } - }), - new ServerConfiguration( - "https://localhost:8080/{version}", - "The local server", - new HashMap<String, ServerVariable>() { - { - put( - "version", - new ServerVariable( - "No description provided", - "v2", - new HashSet<String>(Arrays.asList("v1", "v2")))); - } - }))); + protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList( + new ServerConfiguration( + "http://{server}.swagger.io:{port}/v2", + "petstore server", + new HashMap<String, ServerVariable>() {{ + put("server", new ServerVariable( + "No description provided", + "petstore", + new HashSet<String>( + Arrays.asList( + "petstore", + "qa-petstore", + "dev-petstore" + ) + ) + )); + put("port", new ServerVariable( + "No description provided", + "80", + new HashSet<String>( + Arrays.asList( + "80", + "8080" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://localhost:8080/{version}", + "The local server", + new HashMap<String, ServerVariable>() {{ + put("version", new ServerVariable( + "No description provided", + "v2", + new HashSet<String>( + Arrays.asList( + "v1", + "v2" + ) + ) + )); + }} + ) + )); protected Integer serverIndex = 0; protected Map<String, String> serverVariables = null; - protected Map<String, List<ServerConfiguration>> operationServers = - new HashMap<String, List<ServerConfiguration>>() { - { - put( - "PetApi.addPet", - new ArrayList<ServerConfiguration>( - Arrays.asList( - new ServerConfiguration( - "http://petstore.swagger.io/v2", - "No description provided", - new HashMap<String, ServerVariable>()), - new ServerConfiguration( - "http://path-server-test.petstore.local/v2", - "No description provided", - new HashMap<String, ServerVariable>())))); - put( - "PetApi.updatePet", - new ArrayList<ServerConfiguration>( - Arrays.asList( - new ServerConfiguration( - "http://petstore.swagger.io/v2", - "No description provided", - new HashMap<String, ServerVariable>()), - new ServerConfiguration( - "http://path-server-test.petstore.local/v2", - "No description provided", - new HashMap<String, ServerVariable>())))); - } - }; + protected Map<String, List<ServerConfiguration>> operationServers = new HashMap<String, List<ServerConfiguration>>() {{ + put("PetApi.addPet", new ArrayList<ServerConfiguration>(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap<String, ServerVariable>() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap<String, ServerVariable>() + ) + ))); + put("PetApi.updatePet", new ArrayList<ServerConfiguration>(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap<String, ServerVariable>() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap<String, ServerVariable>() + ) + ))); + }}; protected Map<String, Integer> operationServerIndex = new HashMap<String, Integer>(); - protected Map<String, Map<String, String>> operationServerVariables = - new HashMap<String, Map<String, String>>(); + protected Map<String, Map<String, String>> operationServerVariables = new HashMap<String, Map<String, String>>(); protected boolean debugging = false; protected int connectionTimeout = 0; private int readTimeout = 0; @@ -150,8 +167,7 @@ public ApiClient() { authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put( - "http_signature_test", new HttpSignatureAuth("http_signature_test", null, null)); + authentications.put("http_signature_test", new HttpSignatureAuth("http_signature_test", null, null)); authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -162,7 +178,6 @@ public ApiClient() { /** * Gets the JSON instance to do JSON serialization and deserialization. - * * @return JSON */ public JSON getJSON() { @@ -216,7 +231,6 @@ public ApiClient setServerVariables(Map<String, String> serverVariables) { /** * Get authentications (key: authentication name, value: authentication). - * * @return Map of authentication object */ public Map<String, Authentication> getAuthentications() { @@ -235,7 +249,6 @@ public Authentication getAuthentication(String authName) { /** * Helper method to set username for the first HTTP basic authentication. - * * @param username Username */ public void setUsername(String username) { @@ -250,7 +263,6 @@ public void setUsername(String username) { /** * Helper method to set password for the first HTTP basic authentication. - * * @param password Password */ public void setPassword(String password) { @@ -265,7 +277,6 @@ public void setPassword(String password) { /** * Helper method to set API key value for the first API key authentication. - * * @param apiKey API key */ public void setApiKey(String apiKey) { @@ -299,7 +310,6 @@ public void configureApiKeys(HashMap<String, String> secrets) { /** * Helper method to set API key prefix for the first API key authentication. - * * @param apiKeyPrefix API key prefix */ public void setApiKeyPrefix(String apiKeyPrefix) { @@ -314,7 +324,6 @@ public void setApiKeyPrefix(String apiKeyPrefix) { /** * Helper method to set bearer token for the first Bearer authentication. - * * @param bearerToken Bearer token */ public void setBearerToken(String bearerToken) { @@ -329,7 +338,6 @@ public void setBearerToken(String bearerToken) { /** * Helper method to set access token for the first OAuth2 authentication. - * * @param accessToken Access token */ public void setAccessToken(String accessToken) { @@ -344,7 +352,6 @@ public void setAccessToken(String accessToken) { /** * Set the User-Agent header's value (by adding to the default header map). - * * @param userAgent Http user agent * @return API client */ @@ -379,7 +386,6 @@ public ApiClient addDefaultCookie(String key, String value) { /** * Check that whether debugging is enabled for this API client. - * * @return True if debugging is switched on */ public boolean isDebugging() { @@ -400,8 +406,9 @@ public ApiClient setDebugging(boolean debugging) { } /** - * The path of temporary folder used to store downloaded files from endpoints with file response. - * The default value is <code>null</code>, i.e. using the system's default tempopary folder. + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is <code>null</code>, i.e. using + * the system's default tempopary folder. * * @return Temp folder path */ @@ -411,7 +418,6 @@ public String getTempFolderPath() { /** * Set temp folder path - * * @param tempFolderPath Temp folder path * @return API client */ @@ -422,7 +428,6 @@ public ApiClient setTempFolderPath(String tempFolderPath) { /** * Connect timeout (in milliseconds). - * * @return Connection timeout */ public int getConnectTimeout() { @@ -430,9 +435,9 @@ public int getConnectTimeout() { } /** - * Set the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link Integer#MAX_VALUE}. - * + * Set the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. * @param connectionTimeout Connection timeout in milliseconds * @return API client */ @@ -444,7 +449,6 @@ public ApiClient setConnectTimeout(int connectionTimeout) { /** * read timeout (in milliseconds). - * * @return Read timeout */ public int getReadTimeout() { @@ -452,9 +456,9 @@ public int getReadTimeout() { } /** - * Set the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must be - * between 1 and {@link Integer#MAX_VALUE}. - * + * Set the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. * @param readTimeout Read timeout in milliseconds * @return API client */ @@ -466,7 +470,6 @@ public ApiClient setReadTimeout(int readTimeout) { /** * Get the date format used to parse/format date parameters. - * * @return Date format */ public DateFormat getDateFormat() { @@ -475,7 +478,6 @@ public DateFormat getDateFormat() { /** * Set the date format used to parse/format date parameters. - * * @param dateFormat Date format * @return API client */ @@ -488,7 +490,6 @@ public ApiClient setDateFormat(DateFormat dateFormat) { /** * Parse the given string into Date object. - * * @param str String * @return Date */ @@ -502,7 +503,6 @@ public Date parseDate(String str) { /** * Format the given Date object into string. - * * @param date Date * @return Date in string format */ @@ -512,7 +512,6 @@ public String formatDate(Date date) { /** * Format the given parameter object into string. - * * @param param Object * @return Object in string format */ @@ -523,8 +522,8 @@ public String parameterToString(Object param) { return formatDate((Date) param); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { + for(Object o : (Collection)param) { + if(b.length() > 0) { b.append(','); } b.append(String.valueOf(o)); @@ -542,7 +541,7 @@ public String parameterToString(Object param) { * @param value Value * @return List of pairs */ - public List<Pair> parameterToPairs(String collectionFormat, String name, Object value) { + public List<Pair> parameterToPairs(String collectionFormat, String name, Object value){ List<Pair> params = new ArrayList<Pair>(); // preconditions @@ -556,13 +555,12 @@ public List<Pair> parameterToPairs(String collectionFormat, String name, Object return params; } - if (valueCollection.isEmpty()) { + if (valueCollection.isEmpty()){ return params; } // get the collection format (default: csv) - String format = - (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // create the params based on the collection format if ("multi".equals(format)) { @@ -585,7 +583,7 @@ public List<Pair> parameterToPairs(String collectionFormat, String name, Object delimiter = "|"; } - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder() ; for (Object item : valueCollection) { sb.append(delimiter); sb.append(parameterToString(item)); @@ -597,9 +595,13 @@ public List<Pair> parameterToPairs(String collectionFormat, String name, Object } /** - * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; - * charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON - * + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON * @param mime MIME * @return True if the MIME type is JSON */ @@ -609,12 +611,13 @@ public boolean isJsonMime(String mime) { } /** - * 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) + * 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) * * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, null will be returned (not to - * set the Accept header explicitly). + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { if (accepts.length == 0) { @@ -629,11 +632,13 @@ public String selectHeaderAccept(String[] accepts) { } /** - * Select the Content-Type header's value from the given array: if JSON exists in the given array, - * use it; otherwise use the first one of the array. + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. * * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, JSON will be used. + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0) { @@ -649,7 +654,6 @@ public String selectHeaderContentType(String[] contentTypes) { /** * Escape the given string to be used as URL query value. - * * @param str String * @return Escaped string */ @@ -662,41 +666,33 @@ public String escapeString(String str) { } /** - * Serialize the given Java object into string entity according the given Content-Type (only JSON - * is supported for now). - * + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). * @param obj Object * @param formParams Form parameters * @param contentType Context type * @return Entity * @throws ApiException API exception */ - public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) - throws ApiException { + public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType) throws ApiException { Entity<?> entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); - for (Entry<String, Object> param : formParams.entrySet()) { + for (Entry<String, Object> param: formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); - FormDataContentDisposition contentDisp = - FormDataContentDisposition.name(param.getKey()) - .fileName(file.getName()) - .size(file.length()) - .build(); - multiPart.bodyPart( - new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) + .fileName(file.getName()).size(file.length()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); } else { - FormDataContentDisposition contentDisp = - FormDataContentDisposition.name(param.getKey()).build(); - multiPart.bodyPart( - new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); + FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); + multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); } } entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); } else if (contentType.startsWith("application/x-www-form-urlencoded")) { Form form = new Form(); - for (Entry<String, Object> param : formParams.entrySet()) { + for (Entry<String, Object> param: formParams.entrySet()) { form.param(param.getKey(), parameterToString(param.getValue())); } entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); @@ -708,29 +704,22 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co } /** - * Serialize the given Java object into string according the given Content-Type (only JSON, HTTP - * form is supported for now). - * + * Serialize the given Java object into string according the given + * Content-Type (only JSON, HTTP form is supported for now). * @param obj Object * @param formParams Form parameters * @param contentType Context type * @return String * @throws ApiException API exception */ - public String serializeToString(Object obj, Map<String, Object> formParams, String contentType) - throws ApiException { + public String serializeToString(Object obj, Map<String, Object> formParams, String contentType) throws ApiException { try { if (contentType.startsWith("multipart/form-data")) { - throw new ApiException( - "multipart/form-data not yet supported for serializeToString (http signature authentication)"); + throw new ApiException("multipart/form-data not yet supported for serializeToString (http signature authentication)"); } else if (contentType.startsWith("application/x-www-form-urlencoded")) { String formString = ""; for (Entry<String, Object> param : formParams.entrySet()) { - formString = - param.getKey() - + "=" - + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") - + "&"; + formString = param.getKey() + "=" + URLEncoder.encode(parameterToString(param.getValue()), "UTF-8") + "&"; } if (formString.length() == 0) { // empty string @@ -746,8 +735,7 @@ public String serializeToString(Object obj, Map<String, Object> formParams, Stri } } - public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) - throws ApiException { + public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenApiSchema schema) throws ApiException{ Object result = null; int matchCounter = 0; @@ -769,44 +757,35 @@ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenA } else if ("oneOf".equals(schema.getSchemaType())) { matchSchemas.add(schemaName); } else { - throw new ApiException( - "Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); + throw new ApiException("Unknowe type found while expecting anyOf/oneOf:" + schema.getSchemaType()); } } else { - // failed to deserialize the response in the schema provided, proceed to the next one if - // any + // failed to deserialize the response in the schema provided, proceed to the next one if any } } catch (Exception ex) { // failed to deserialize, do nothing and try next one (schema) } - } else { // unknown type - throw new ApiException( - schemaType.getClass() - + " is not a GenericType and cannot be handled properly in deserialization."); + } else {// unknown type + throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); } + } - if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) { // more than 1 match for oneOf - throw new ApiException( - "Response body is invalid as it matches more than one schema (" - + String.join(", ", matchSchemas) - + ") defined in the oneOf model: " - + schema.getClass().getName()); + if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf + throw new ApiException("Response body is invalid as it matches more than one schema (" + String.join(", ", matchSchemas) + ") defined in the oneOf model: " + schema.getClass().getName()); } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas - throw new ApiException( - "Response body is invalid as it doens't match any schemas (" - + String.join(", ", schema.getSchemas().keySet()) - + ") defined in the oneOf/anyOf model: " - + schema.getClass().getName()); + throw new ApiException("Response body is invalid as it doens't match any schemas (" + String.join(", ", schema.getSchemas().keySet()) + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); } else { // only one matched schema.setActualInstance(result); return schema; } + } + + /** * Deserialize response body to Java object according to the Content-Type. - * * @param <T> Type * @param response Response * @param returnType Return type @@ -841,7 +820,6 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap /** * Download file from the given response. - * * @param response Response * @return File * @throws ApiException If fail to read file content from response and write to disk @@ -849,10 +827,7 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap public File downloadFileFromResponse(Response response) throws ApiException { try { File file = prepareDownloadFile(response); - Files.copy( - response.readEntity(InputStream.class), - file.toPath(), - StandardCopyOption.REPLACE_EXISTING); + Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING); return file; } catch (IOException e) { throw new ApiException(e); @@ -866,7 +841,8 @@ public File prepareDownloadFile(Response response) throws IOException { // Get filename from the Content-Disposition header. Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) filename = matcher.group(1); + if (matcher.find()) + filename = matcher.group(1); } String prefix; @@ -883,11 +859,14 @@ public File prepareDownloadFile(Response response) throws IOException { suffix = filename.substring(pos); } // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) prefix = "download-"; + if (prefix.length() < 3) + prefix = "download-"; } - if (tempFolderPath == null) return File.createTempFile(prefix, suffix); - else return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); } /** @@ -910,21 +889,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @return The response body in type of string * @throws ApiException API exception */ - public <T> ApiResponse<T> invokeAPI( - String operation, - String path, - String method, - List<Pair> queryParams, - Object body, - Map<String, String> headerParams, - Map<String, String> cookieParams, - Map<String, Object> formParams, - String accept, - String contentType, - String[] authNames, - GenericType<T> returnType, - AbstractOpenApiSchema schema) - throws ApiException { + public <T> ApiResponse<T> invokeAPI(String operation, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { // Not using `.target(targetURL).path(path)` below, // to support (constant) query string in `path`, e.g. "/posts?draft=1" @@ -944,10 +909,9 @@ public <T> ApiResponse<T> invokeAPI( serverConfigurations = servers; } if (index < 0 || index >= serverConfigurations.size()) { - throw new ArrayIndexOutOfBoundsException( - String.format( - "Invalid index %d when selecting the host settings. Must be less than %d", - index, serverConfigurations.size())); + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", index, serverConfigurations.size() + )); } targetURL = serverConfigurations.get(index).URL(variables) + path; } else { @@ -1002,16 +966,9 @@ public <T> ApiResponse<T> invokeAPI( Map<String, String> allHeaderParams = new HashMap<>(); allHeaderParams.putAll(defaultHeaderMap); allHeaderParams.putAll(headerParams); - + // update different parameters (e.g. headers) for authentication - updateParamsForAuth( - authNames, - queryParams, - allHeaderParams, - cookieParams, - serializeToString(body, formParams, contentType), - method, - target.getUri()); + updateParamsForAuth(authNames, queryParams, allHeaderParams, cookieParams, serializeToString(body, formParams, contentType), method, target.getUri()); Response response = null; @@ -1042,13 +999,14 @@ public <T> ApiResponse<T> invokeAPI( if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { return new ApiResponse<>(statusCode, responseHeaders); } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { - if (returnType == null) return new ApiResponse<>(statusCode, responseHeaders); - else if (schema == null) { - return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); - } else { // oneOf/anyOf - return new ApiResponse<>( - statusCode, responseHeaders, (T) deserializeSchemas(response, schema)); - } + if (returnType == null) + return new ApiResponse<>(statusCode, responseHeaders); + else + if (schema == null) { + return new ApiResponse<>(statusCode, responseHeaders, deserialize(response, returnType)); + } else { // oneOf/anyOf + return new ApiResponse<>(statusCode, responseHeaders, (T)deserializeSchemas(response, schema)); + } } else { String message = "error"; String respBody = null; @@ -1061,53 +1019,30 @@ else if (schema == null) { } } throw new ApiException( - response.getStatus(), message, buildResponseHeaders(response), respBody); + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); } } finally { try { response.close(); } catch (Exception e) { - // it's not critical, since the response object is local in method invokeAPI; that's fine, - // just continue + // it's not critical, since the response object is local in method invokeAPI; that's fine, just continue } } } - /** @deprecated Add qualified name of the operation as a first parameter. */ + /** + * @deprecated Add qualified name of the operation as a first parameter. + */ @Deprecated - public <T> ApiResponse<T> invokeAPI( - String path, - String method, - List<Pair> queryParams, - Object body, - Map<String, String> headerParams, - Map<String, String> cookieParams, - Map<String, Object> formParams, - String accept, - String contentType, - String[] authNames, - GenericType<T> returnType, - AbstractOpenApiSchema schema) - throws ApiException { - return invokeAPI( - null, - path, - method, - queryParams, - body, - headerParams, - cookieParams, - formParams, - accept, - contentType, - authNames, - returnType, - schema); + public <T> ApiResponse<T> invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType, AbstractOpenApiSchema schema) throws ApiException { + return invokeAPI(null, path, method, queryParams, body, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType, schema); } /** * Build the Client used to make HTTP requests. - * * @param debugging Debug setting * @return Client */ @@ -1120,21 +1055,13 @@ protected Client buildHttpClient(boolean debugging) { // turn off compliance validation to be able to send payloads with DELETE calls clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true); if (debugging) { - 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); + 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); + java.util.logging.Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME).setLevel(java.util.logging.Level.ALL); } else { // suppress warnings for payloads with DELETE calls: - java.util.logging.Logger.getLogger("org.glassfish.jersey.client") - .setLevel(java.util.logging.Level.SEVERE); + java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE); } performAdditionalClientConfiguration(clientConfig); return ClientBuilder.newClient(clientConfig); @@ -1146,7 +1073,7 @@ protected void performAdditionalClientConfiguration(ClientConfig clientConfig) { protected Map<String, List<String>> buildResponseHeaders(Response response) { Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>(); - for (Entry<String, List<Object>> entry : response.getHeaders().entrySet()) { + for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) { List<Object> values = entry.getValue(); List<String> headers = new ArrayList<String>(); for (Object o : values) { @@ -1167,15 +1094,8 @@ protected Map<String, List<String>> buildResponseHeaders(Response response) { * @param method HTTP method (e.g. POST) * @param uri HTTP URI */ - protected void updateParamsForAuth( - String[] authNames, - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, + Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java index 3c2d12abf557..3612265bc619 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiException.java @@ -3,96 +3,92 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client; -import java.util.List; import java.util.Map; +import java.util.List; + +/** + * API Exception + */ -/** API Exception */ public class ApiException extends Exception { - private int code = 0; - private Map<String, List<String>> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException( - String message, - Throwable throwable, - int code, - Map<String, List<String>> responseHeaders, - String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException( - String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException( - String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException( - int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map<String, List<String>> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } + private int code = 0; + private Map<String, List<String>> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map<String, List<String>> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java index 5dcb28d7a53b..5f3daf26600c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ApiResponse.java @@ -3,13 +3,14 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client; import java.util.List; @@ -21,53 +22,53 @@ * @param <T> The type of data that is deserialized from response body */ public class ApiResponse<T> { - private final int statusCode; - private final Map<String, List<String>> headers; - private final T data; + private final int statusCode; + private final Map<String, List<String>> headers; + private final T data; - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map<String, List<String>> headers) { - this(statusCode, headers, null); - } + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers) { + this(statusCode, headers, null); + } - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map<String, List<String>> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } - /** - * Get the status code - * - * @return status code - */ - public int getStatusCode() { - return statusCode; - } + /** + * Get the status code + * + * @return status code + */ + public int getStatusCode() { + return statusCode; + } - /** - * Get the headers - * - * @return map of headers - */ - public Map<String, List<String>> getHeaders() { - return headers; - } + /** + * Get the headers + * + * @return map of headers + */ + public Map<String, List<String>> getHeaders() { + return headers; + } - /** - * Get the data - * - * @return data - */ - public T getData() { - return data; - } + /** + * Get the data + * + * @return data + */ + public T getData() { + return data; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java index 107ad039b0b6..acbecda489dd 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Configuration.java @@ -3,35 +3,37 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client; + public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); + private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API instances without providing - * an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API instances without providing - * an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java index 12541a8636a4..83d4514b071b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/CustomInstantDeserializer.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; import com.fasterxml.jackson.datatype.threetenbp.function.Function; -import java.io.IOException; -import java.math.BigDecimal; import org.threeten.bp.DateTimeException; import org.threeten.bp.DateTimeUtils; import org.threeten.bp.Instant; @@ -21,10 +19,12 @@ import org.threeten.bp.temporal.Temporal; import org.threeten.bp.temporal.TemporalAccessor; +import java.io.IOException; +import java.math.BigDecimal; + /** - * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link - * ZonedDateTime}s. Adapted from the jackson threetenbp InstantDeserializer to add support for - * deserializing rfc822 format. + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. * * @author Nick Williams */ @@ -32,89 +32,84 @@ public class CustomInstantDeserializer<T extends Temporal> extends ThreeTenDateTimeDeserializerBase<T> { private static final long serialVersionUID = 1L; - public static final CustomInstantDeserializer<Instant> INSTANT = - new CustomInstantDeserializer<Instant>( - Instant.class, - DateTimeFormatter.ISO_INSTANT, - new Function<TemporalAccessor, Instant>() { - @Override - public Instant apply(TemporalAccessor temporalAccessor) { - return Instant.from(temporalAccessor); - } - }, - new Function<FromIntegerArguments, Instant>() { - @Override - public Instant apply(FromIntegerArguments a) { - return Instant.ofEpochMilli(a.value); - } - }, - new Function<FromDecimalArguments, Instant>() { - @Override - public Instant apply(FromDecimalArguments a) { - return Instant.ofEpochSecond(a.integer, a.fraction); - } - }, - null); - - public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = - new CustomInstantDeserializer<OffsetDateTime>( - OffsetDateTime.class, - DateTimeFormatter.ISO_OFFSET_DATE_TIME, - new Function<TemporalAccessor, OffsetDateTime>() { - @Override - public OffsetDateTime apply(TemporalAccessor temporalAccessor) { - return OffsetDateTime.from(temporalAccessor); - } - }, - new Function<FromIntegerArguments, OffsetDateTime>() { - @Override - public OffsetDateTime apply(FromIntegerArguments a) { - return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function<FromDecimalArguments, OffsetDateTime>() { - @Override - public OffsetDateTime apply(FromDecimalArguments a) { - return OffsetDateTime.ofInstant( - Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() { - @Override - public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { - return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); - } - }); - - public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = - new CustomInstantDeserializer<ZonedDateTime>( - ZonedDateTime.class, - DateTimeFormatter.ISO_ZONED_DATE_TIME, - new Function<TemporalAccessor, ZonedDateTime>() { - @Override - public ZonedDateTime apply(TemporalAccessor temporalAccessor) { - return ZonedDateTime.from(temporalAccessor); - } - }, - new Function<FromIntegerArguments, ZonedDateTime>() { - @Override - public ZonedDateTime apply(FromIntegerArguments a) { - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); - } - }, - new Function<FromDecimalArguments, ZonedDateTime>() { - @Override - public ZonedDateTime apply(FromDecimalArguments a) { - return ZonedDateTime.ofInstant( - Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); - } - }, - new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() { - @Override - public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { - return zonedDateTime.withZoneSameInstant(zoneId); - } - }); + public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function<TemporalAccessor, Instant>() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, Instant>() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function<FromDecimalArguments, Instant>() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function<TemporalAccessor, OffsetDateTime>() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, OffsetDateTime>() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function<FromDecimalArguments, OffsetDateTime>() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function<TemporalAccessor, ZonedDateTime>() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function<FromIntegerArguments, ZonedDateTime>() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function<FromDecimalArguments, ZonedDateTime>() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); protected final Function<FromIntegerArguments, T> fromMilliseconds; @@ -124,26 +119,22 @@ public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { protected final BiFunction<T, ZoneId, T> adjust; - protected CustomInstantDeserializer( - Class<T> supportedType, - DateTimeFormatter parser, - Function<TemporalAccessor, T> parsedToValue, - Function<FromIntegerArguments, T> fromMilliseconds, - Function<FromDecimalArguments, T> fromNanoseconds, - BiFunction<T, ZoneId, T> adjust) { + protected CustomInstantDeserializer(Class<T> supportedType, + DateTimeFormatter parser, + Function<TemporalAccessor, T> parsedToValue, + Function<FromIntegerArguments, T> fromMilliseconds, + Function<FromDecimalArguments, T> fromNanoseconds, + BiFunction<T, ZoneId, T> adjust) { super(supportedType, parser); this.parsedToValue = parsedToValue; this.fromMilliseconds = fromMilliseconds; this.fromNanoseconds = fromNanoseconds; - this.adjust = - adjust == null - ? new BiFunction<T, ZoneId, T>() { - @Override - public T apply(T t, ZoneId zoneId) { - return t; - } - } - : adjust; + this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; } @SuppressWarnings("unchecked") @@ -165,50 +156,49 @@ protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) { @Override public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { - // NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only - // string values have to be adjusted to the configured TZ. + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. switch (parser.getCurrentTokenId()) { - case JsonTokenId.ID_NUMBER_FLOAT: - { - BigDecimal value = parser.getDecimalValue(); - long seconds = value.longValue(); - int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); - return fromNanoseconds.apply( - new FromDecimalArguments(seconds, nanoseconds, getZone(context))); + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); } - - case JsonTokenId.ID_NUMBER_INT: - { - long timestamp = parser.getLongValue(); - if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { - return this.fromNanoseconds.apply( - new FromDecimalArguments(timestamp, 0, this.getZone(context))); - } - return this.fromMilliseconds.apply( - new FromIntegerArguments(timestamp, this.getZone(context))); + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; } - - case JsonTokenId.ID_STRING: - { - String string = parser.getText().trim(); - if (string.length() == 0) { - return null; - } - if (string.endsWith("+0000")) { - string = string.substring(0, string.length() - 5) + "Z"; - } - T value; - try { - TemporalAccessor acc = _formatter.parse(string); - value = parsedToValue.apply(acc); - if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { - return adjust.apply(value, this.getZone(context)); - } - } catch (DateTimeException e) { - throw _peelDTE(e); + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); } - return value; + } catch (DateTimeException e) { + throw _peelDTE(e); } + return value; + } } throw context.mappingException("Expected type float, integer, or string."); } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java index 51a014702690..1887d6c8851a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/JSON.java @@ -1,12 +1,15 @@ package org.openapitools.client; +import org.threeten.bp.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; + import java.text.DateFormat; + import javax.ws.rs.ext.ContextResolver; -import org.openapitools.jackson.nullable.JsonNullableModule; -import org.threeten.bp.*; + public class JSON implements ContextResolver<ObjectMapper> { private ObjectMapper mapper; @@ -31,7 +34,6 @@ public JSON() { /** * Set the date format for JSON (de)serialization with Date properties. - * * @param dateFormat Date format */ public void setDateFormat(DateFormat dateFormat) { @@ -48,7 +50,5 @@ public ObjectMapper getContext(Class<?> type) { * * @return object mapper */ - public ObjectMapper getMapper() { - return mapper; - } + public ObjectMapper getMapper() { return mapper; } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java index ce6aa2ef976f..ae89aa614543 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/Pair.java @@ -3,57 +3,59 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client; -public class Pair { - private String name = ""; - private String value = ""; - public Pair(String name, String value) { - setName(name); - setValue(value); - } +public class Pair { + private String name = ""; + private String value = ""; - private void setName(String name) { - if (!isValidString(name)) { - return; + public Pair (String name, String value) { + setName(name); + setValue(value); } - this.name = name; - } + private void setName(String name) { + if (!isValidString(name)) { + return; + } - private void setValue(String value) { - if (!isValidString(value)) { - return; + this.name = name; } - this.value = value; - } - - public String getName() { - return this.name; - } + private void setValue(String value) { + if (!isValidString(value)) { + return; + } - public String getValue() { - return this.value; - } + this.value = value; + } - private boolean isValidString(String arg) { - if (arg == null) { - return false; + public String getName() { + return this.name; } - if (arg.trim().isEmpty()) { - return false; + public String getValue() { + return this.value; } - return true; - } + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java index 8b88105c7629..9509fd089812 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -3,7 +3,7 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,9 +14,11 @@ import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import com.fasterxml.jackson.databind.util.ISO8601Utils; + import java.text.FieldPosition; import java.util.Date; + public class RFC3339DateFormat extends ISO8601DateFormat { // Same as ISO8601DateFormat but serializing milliseconds. @@ -26,4 +28,5 @@ public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fie toAppendTo.append(value); return toAppendTo; } -} + +} \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java index b307b65c571e..a1107a8690e4 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -2,58 +2,57 @@ import java.util.Map; -/** Representing a Server configuration. */ +/** + * Representing a Server configuration. + */ public class ServerConfiguration { - public String URL; - public String description; - public Map<String, ServerVariable> variables; + public String URL; + public String description; + public Map<String, ServerVariable> variables; - /** - * @param URL A URL to the target host. - * @param description A describtion of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for - * substitution in the server's URL template. - */ - public ServerConfiguration( - String URL, String description, Map<String, ServerVariable> variables) { - this.URL = URL; - this.description = description; - this.variables = variables; - } + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } - /** - * Format URL template using given variables. - * - * @param variables A map between a variable name and its value. - * @return Formatted URL. - */ - public String URL(Map<String, String> variables) { - String url = this.URL; + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map<String, String> variables) { + String url = this.URL; - // go through variables and replace placeholders - for (Map.Entry<String, ServerVariable> variable : this.variables.entrySet()) { - String name = variable.getKey(); - ServerVariable serverVariable = variable.getValue(); - String value = serverVariable.defaultValue; + // go through variables and replace placeholders + for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; - if (variables != null && variables.containsKey(name)) { - value = variables.get(name); - if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException( - "The variable " + name + " in the server URL has invalid value " + value + "."); + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); } - } - url = url.replaceAll("\\{" + name + "\\}", value); + return url; } - return url; - } - /** - * Format URL template using default server variables. - * - * @return Formatted URL. - */ - public String URL() { - return URL(null); - } + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java index f5a0c96ed055..c2f13e216662 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/ServerVariable.java @@ -2,21 +2,22 @@ import java.util.HashSet; -/** Representing a Server Variable for server URL template substitution. */ +/** + * Representing a Server Variable for server URL template substitution. + */ public class ServerVariable { - public String description; - public String defaultValue; - public HashSet<String> enumValues = null; + public String description; + public String defaultValue; + public HashSet<String> enumValues = null; - /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are - * from a limited set. - */ - public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { - this.description = description; - this.defaultValue = defaultValue; - this.enumValues = enumValues; - } + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java index 70cd91e3b294..266c26be3a50 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/StringUtil.java @@ -3,15 +3,17 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client; + public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). @@ -34,11 +36,12 @@ public static boolean containsIgnoreCase(String[] array, String value) { /** * Join an array of strings with the given separator. + * <p> + * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + * </p> * - * <p>Note: This might be replaced by utility method from commons-lang or guava someday if one of - * those libraries is added as dependency. - * - * @param array The array of strings + * @param array The array of strings * @param separator The separator * @return the resulting string */ diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index f02739eb7728..4d808ec6f5f1 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -1,17 +1,21 @@ package org.openapitools.client.api; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + import org.openapitools.client.model.Client; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + public class AnotherFakeApi { private ApiClient apiClient; @@ -42,42 +46,41 @@ public void setApiClient(ApiClient apiClient) { } /** - * To test special tags To test special tags and operation ID starting with number - * + * To test special tags + * To test special tags and operation ID starting with number * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public Client call123testSpecialTags(Client client) throws ApiException { return call123testSpecialTagsWithHttpInfo(client).getData(); } /** - * To test special tags To test special tags and operation ID starting with number - * + * To test special tags + * To test special tags and operation ID starting with number * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client client) throws ApiException { Object localVarPostBody = client; - + // verify the required parameter 'client' is set if (client == null) { - throw new ApiException( - 400, "Missing the required parameter 'client' when calling call123testSpecialTags"); + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); } - + // create path and map variables String localVarPath = "/another-fake/dummy"; @@ -87,29 +90,26 @@ public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client client) thr Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/json"}; + + + + + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<Client> localVarReturnType = new GenericType<Client>() {}; - return apiClient.invokeAPI( - "AnotherFakeApi.call123testSpecialTags", - localVarPath, - "PATCH", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("AnotherFakeApi.call123testSpecialTags", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java index 288cccfa5168..eb269e49f800 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -1,17 +1,21 @@ package org.openapitools.client.api; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + import org.openapitools.client.model.InlineResponseDefault; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + public class DefaultApi { private ApiClient apiClient; @@ -42,30 +46,34 @@ public void setApiClient(ApiClient apiClient) { } /** + * + * * @return InlineResponseDefault * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> response </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> response </td><td> - </td></tr> + </table> */ public InlineResponseDefault fooGet() throws ApiException { return fooGetWithHttpInfo().getData(); } /** + * + * * @return ApiResponse<InlineResponseDefault> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> response </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> response </td><td> - </td></tr> + </table> */ public ApiResponse<InlineResponseDefault> fooGetWithHttpInfo() throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/foo"; @@ -75,31 +83,26 @@ public ApiResponse<InlineResponseDefault> fooGetWithHttpInfo() throws ApiExcepti Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - GenericType<InlineResponseDefault> localVarReturnType = - new GenericType<InlineResponseDefault>() {}; - - return apiClient.invokeAPI( - "DefaultApi.fooGet", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + String[] localVarAuthNames = new String[] { }; + + GenericType<InlineResponseDefault> localVarReturnType = new GenericType<InlineResponseDefault>() {}; + + return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java index 58f30d6ffe6c..54e90816eca3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeApi.java @@ -1,25 +1,29 @@ package org.openapitools.client.api; -import java.io.File; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.math.BigDecimal; import org.openapitools.client.model.Client; +import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; import org.openapitools.client.model.OuterComposite; import org.openapitools.client.model.Pet; import org.openapitools.client.model.User; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class FakeApi { private ApiClient apiClient; @@ -52,14 +56,14 @@ public void setApiClient(ApiClient apiClient) { /** * Health check endpoint - * + * * @return HealthCheckResult * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + </table> */ public HealthCheckResult fakeHealthGet() throws ApiException { return fakeHealthGetWithHttpInfo().getData(); @@ -67,18 +71,18 @@ public HealthCheckResult fakeHealthGet() throws ApiException { /** * Health check endpoint - * + * * @return ApiResponse<HealthCheckResult> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + </table> */ public ApiResponse<HealthCheckResult> fakeHealthGetWithHttpInfo() throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/fake/health"; @@ -88,44 +92,40 @@ public ApiResponse<HealthCheckResult> fakeHealthGetWithHttpInfo() throws ApiExce Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<HealthCheckResult> localVarReturnType = new GenericType<HealthCheckResult>() {}; - return apiClient.invokeAPI( - "FakeApi.fakeHealthGet", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeApi.fakeHealthGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** * test http signature authentication - * + * * @param pet Pet object that needs to be added to the store (required) * @param query1 query parameter (optional) * @param header1 header parameter (optional) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + </table> */ public void fakeHttpSignatureTest(Pet pet, String query1, String header1) throws ApiException { fakeHttpSignatureTestWithHttpInfo(pet, query1, header1); @@ -133,28 +133,26 @@ public void fakeHttpSignatureTest(Pet pet, String query1, String header1) throws /** * test http signature authentication - * + * * @param pet Pet object that needs to be added to the store (required) * @param query1 query parameter (optional) * @param header1 header parameter (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> The instance started successfully </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, String query1, String header1) - throws ApiException { + public ApiResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, String query1, String header1) throws ApiException { Object localVarPostBody = pet; - + // verify the required parameter 'pet' is set if (pet == null) { - throw new ApiException( - 400, "Missing the required parameter 'pet' when calling fakeHttpSignatureTest"); + throw new ApiException(400, "Missing the required parameter 'pet' when calling fakeHttpSignatureTest"); } - + // create path and map variables String localVarPath = "/fake/http-signature-test"; @@ -166,64 +164,58 @@ public ApiResponse<Void> fakeHttpSignatureTestWithHttpInfo(Pet pet, String query localVarQueryParams.addAll(apiClient.parameterToPairs("", "query_1", query1)); - if (header1 != null) localVarHeaderParams.put("header_1", apiClient.parameterToString(header1)); - - final String[] localVarAccepts = {}; + if (header1 != null) + localVarHeaderParams.put("header_1", apiClient.parameterToString(header1)); + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json", "application/xml"}; + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"http_signature_test"}; - - return apiClient.invokeAPI( - "FakeApi.fakeHttpSignatureTest", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "http_signature_test" }; + + return apiClient.invokeAPI("FakeApi.fakeHttpSignatureTest", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** + * * Test serialization of outer boolean types - * * @param body Input boolean as post body (optional) * @return Boolean * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> + </table> */ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); } /** + * * Test serialization of outer boolean types - * * @param body Input boolean as post body (optional) * @return ApiResponse<Boolean> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output boolean </td><td> - </td></tr> + </table> */ - public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) - throws ApiException { + public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { Object localVarPostBody = body; - + // create path and map variables String localVarPath = "/fake/outer/boolean"; @@ -233,64 +225,59 @@ public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body) Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"*/*"}; + + + + + final String[] localVarAccepts = { + "*/*" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<Boolean> localVarReturnType = new GenericType<Boolean>() {}; - return apiClient.invokeAPI( - "FakeApi.fakeOuterBooleanSerialize", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeApi.fakeOuterBooleanSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** + * * Test serialization of object with outer number type - * * @param outerComposite Input composite as post body (optional) * @return OuterComposite * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> + </table> */ - public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) - throws ApiException { + public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) throws ApiException { return fakeOuterCompositeSerializeWithHttpInfo(outerComposite).getData(); } /** + * * Test serialization of object with outer number type - * * @param outerComposite Input composite as post body (optional) * @return ApiResponse<OuterComposite> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output composite </td><td> - </td></tr> + </table> */ - public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo( - OuterComposite outerComposite) throws ApiException { + public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite) throws ApiException { Object localVarPostBody = outerComposite; - + // create path and map variables String localVarPath = "/fake/outer/composite"; @@ -300,63 +287,59 @@ public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"*/*"}; + + + + + final String[] localVarAccepts = { + "*/*" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<OuterComposite> localVarReturnType = new GenericType<OuterComposite>() {}; - return apiClient.invokeAPI( - "FakeApi.fakeOuterCompositeSerialize", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeApi.fakeOuterCompositeSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** + * * Test serialization of outer number types - * * @param body Input number as post body (optional) * @return BigDecimal * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output number </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output number </td><td> - </td></tr> + </table> */ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { return fakeOuterNumberSerializeWithHttpInfo(body).getData(); } /** + * * Test serialization of outer number types - * * @param body Input number as post body (optional) * @return ApiResponse<BigDecimal> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output number </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output number </td><td> - </td></tr> + </table> */ - public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) - throws ApiException { + public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { Object localVarPostBody = body; - + // create path and map variables String localVarPath = "/fake/outer/number"; @@ -366,62 +349,59 @@ public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal b Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"*/*"}; + + + + + final String[] localVarAccepts = { + "*/*" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<BigDecimal> localVarReturnType = new GenericType<BigDecimal>() {}; - return apiClient.invokeAPI( - "FakeApi.fakeOuterNumberSerialize", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeApi.fakeOuterNumberSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** + * * Test serialization of outer string types - * * @param body Input string as post body (optional) * @return String * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output string </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output string </td><td> - </td></tr> + </table> */ public String fakeOuterStringSerialize(String body) throws ApiException { return fakeOuterStringSerializeWithHttpInfo(body).getData(); } /** + * * Test serialization of outer string types - * * @param body Input string as post body (optional) * @return ApiResponse<String> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Output string </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Output string </td><td> - </td></tr> + </table> */ public ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { Object localVarPostBody = body; - + // create path and map variables String localVarPath = "/fake/outer/string"; @@ -431,69 +411,63 @@ public ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body) thr Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"*/*"}; + + + + + final String[] localVarAccepts = { + "*/*" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<String> localVarReturnType = new GenericType<String>() {}; - return apiClient.invokeAPI( - "FakeApi.fakeOuterStringSerialize", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeApi.fakeOuterStringSerialize", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** + * * For this test, the body for this request much reference a schema named `File`. - * - * @param fileSchemaTestClass (required) + * @param fileSchemaTestClass (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Success </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> */ public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws ApiException { testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); } /** + * * For this test, the body for this request much reference a schema named `File`. - * - * @param fileSchemaTestClass (required) + * @param fileSchemaTestClass (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Success </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo( - FileSchemaTestClass fileSchemaTestClass) throws ApiException { + public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) throws ApiException { Object localVarPostBody = fileSchemaTestClass; - + // verify the required parameter 'fileSchemaTestClass' is set if (fileSchemaTestClass == null) { - throw new ApiException( - 400, - "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); } - + // create path and map variables String localVarPath = "/fake/body-with-file-schema"; @@ -503,71 +477,68 @@ public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "FakeApi.testBodyWithFileSchema", - localVarPath, - "PUT", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithFileSchema", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * @param query (required) - * @param user (required) + * + * + * @param query (required) + * @param user (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Success </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> */ public void testBodyWithQueryParams(String query, User user) throws ApiException { testBodyWithQueryParamsWithHttpInfo(query, user); } /** - * @param query (required) - * @param user (required) + * + * + * @param query (required) + * @param user (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Success </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User user) - throws ApiException { + public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User user) throws ApiException { Object localVarPostBody = user; - + // verify the required parameter 'query' is set if (query == null) { - throw new ApiException( - 400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); } - + // verify the required parameter 'user' is set if (user == null) { - throw new ApiException( - 400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); } - + // create path and map variables String localVarPath = "/fake/body-with-query-params"; @@ -579,67 +550,61 @@ public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User localVarQueryParams.addAll(apiClient.parameterToPairs("", "query", query)); - final String[] localVarAccepts = {}; - + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "FakeApi.testBodyWithQueryParams", - localVarPath, - "PUT", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testBodyWithQueryParams", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * To test \"client\" model To test \"client\" model - * + * To test \"client\" model + * To test \"client\" model * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public Client testClientModel(Client client) throws ApiException { return testClientModelWithHttpInfo(client).getData(); } /** - * To test \"client\" model To test \"client\" model - * + * To test \"client\" model + * To test \"client\" model * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public ApiResponse<Client> testClientModelWithHttpInfo(Client client) throws ApiException { Object localVarPostBody = client; - + // verify the required parameter 'client' is set if (client == null) { - throw new ApiException( - 400, "Missing the required parameter 'client' when calling testClientModel"); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); } - + // create path and map variables String localVarPath = "/fake"; @@ -649,35 +614,31 @@ public ApiResponse<Client> testClientModelWithHttpInfo(Client client) throws Api Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/json"}; + + + + + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<Client> localVarReturnType = new GenericType<Client>() {}; - return apiClient.invokeAPI( - "FakeApi.testClientModel", - localVarPath, - "PATCH", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeApi.testClientModel", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing - * various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param number None (required) * @param _double None (required) * @param patternWithoutDelimiter None (required) @@ -694,49 +655,19 @@ public ApiResponse<Client> testClientModelWithHttpInfo(Client client) throws Api * @param paramCallback None (optional) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ - public void testEndpointParameters( - BigDecimal number, - Double _double, - String patternWithoutDelimiter, - byte[] _byte, - Integer integer, - Integer int32, - Long int64, - Float _float, - String string, - File binary, - LocalDate date, - OffsetDateTime dateTime, - String password, - String paramCallback) - throws ApiException { - testEndpointParametersWithHttpInfo( - number, - _double, - patternWithoutDelimiter, - _byte, - integer, - int32, - int64, - _float, - string, - binary, - date, - dateTime, - password, - paramCallback); + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing - * various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param number None (required) * @param _double None (required) * @param patternWithoutDelimiter None (required) @@ -754,55 +685,35 @@ public void testEndpointParameters( * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testEndpointParametersWithHttpInfo( - BigDecimal number, - Double _double, - String patternWithoutDelimiter, - byte[] _byte, - Integer integer, - Integer int32, - Long int64, - Float _float, - String string, - File binary, - LocalDate date, - OffsetDateTime dateTime, - String password, - String paramCallback) - throws ApiException { + public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'number' is set if (number == null) { - throw new ApiException( - 400, "Missing the required parameter 'number' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); } - + // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException( - 400, "Missing the required parameter '_double' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); } - + // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException( - 400, - "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } - + // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException( - 400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); } - + // create path and map variables String localVarPath = "/fake"; @@ -812,54 +723,60 @@ public ApiResponse<Void> testEndpointParametersWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - if (integer != null) localVarFormParams.put("integer", integer); - if (int32 != null) localVarFormParams.put("int32", int32); - if (int64 != null) localVarFormParams.put("int64", int64); - if (number != null) localVarFormParams.put("number", number); - if (_float != null) localVarFormParams.put("float", _float); - if (_double != null) localVarFormParams.put("double", _double); - if (string != null) localVarFormParams.put("string", string); - if (patternWithoutDelimiter != null) - localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); - if (_byte != null) localVarFormParams.put("byte", _byte); - if (binary != null) localVarFormParams.put("binary", binary); - if (date != null) localVarFormParams.put("date", date); - if (dateTime != null) localVarFormParams.put("dateTime", dateTime); - if (password != null) localVarFormParams.put("password", password); - if (paramCallback != null) localVarFormParams.put("callback", paramCallback); - - final String[] localVarAccepts = {}; + + + if (integer != null) + localVarFormParams.put("integer", integer); +if (int32 != null) + localVarFormParams.put("int32", int32); +if (int64 != null) + localVarFormParams.put("int64", int64); +if (number != null) + localVarFormParams.put("number", number); +if (_float != null) + localVarFormParams.put("float", _float); +if (_double != null) + localVarFormParams.put("double", _double); +if (string != null) + localVarFormParams.put("string", string); +if (patternWithoutDelimiter != null) + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); +if (_byte != null) + localVarFormParams.put("byte", _byte); +if (binary != null) + localVarFormParams.put("binary", binary); +if (date != null) + localVarFormParams.put("date", date); +if (dateTime != null) + localVarFormParams.put("dateTime", dateTime); +if (password != null) + localVarFormParams.put("password", password); +if (paramCallback != null) + localVarFormParams.put("callback", paramCallback); + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"http_basic_test"}; - - return apiClient.invokeAPI( - "FakeApi.testEndpointParameters", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "http_basic_test" }; + + return apiClient.invokeAPI("FakeApi.testEndpointParameters", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * To test enum parameters To test enum parameters - * - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to - * new ArrayList<String>()) + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new - * ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) @@ -867,41 +784,22 @@ public ApiResponse<Void> testEndpointParametersWithHttpInfo( * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> - * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> + <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + </table> */ - public void testEnumParameters( - List<String> enumHeaderStringArray, - String enumHeaderString, - List<String> enumQueryStringArray, - String enumQueryString, - Integer enumQueryInteger, - Double enumQueryDouble, - List<String> enumFormStringArray, - String enumFormString) - throws ApiException { - testEnumParametersWithHttpInfo( - enumHeaderStringArray, - enumHeaderString, - enumQueryStringArray, - enumQueryString, - enumQueryInteger, - enumQueryDouble, - enumFormStringArray, - enumFormString); + public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { + testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } /** - * To test enum parameters To test enum parameters - * - * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to - * new ArrayList<String>()) + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional, default to new ArrayList<String>()) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new - * ArrayList<String>()) + * @param enumQueryStringArray Query parameter enum test (string array) (optional, default to new ArrayList<String>()) * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) @@ -910,24 +808,15 @@ public void testEnumParameters( * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> - * <tr><td> 404 </td><td> Not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid request </td><td> - </td></tr> + <tr><td> 404 </td><td> Not found </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testEnumParametersWithHttpInfo( - List<String> enumHeaderStringArray, - String enumHeaderString, - List<String> enumQueryStringArray, - String enumQueryString, - Integer enumQueryInteger, - Double enumQueryDouble, - List<String> enumFormStringArray, - String enumFormString) - throws ApiException { + public ApiResponse<Void> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/fake"; @@ -937,81 +826,57 @@ public ApiResponse<Void> testEnumParametersWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - localVarQueryParams.addAll( - apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); if (enumHeaderStringArray != null) - localVarHeaderParams.put( - "enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); - if (enumHeaderString != null) + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); +if (enumHeaderString != null) localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + if (enumFormStringArray != null) localVarFormParams.put("enum_form_string_array", enumFormStringArray); - if (enumFormString != null) localVarFormParams.put("enum_form_string", enumFormString); - - final String[] localVarAccepts = {}; +if (enumFormString != null) + localVarFormParams.put("enum_form_string", enumFormString); + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "FakeApi.testEnumParameters", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testEnumParameters", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } - private ApiResponse<Void> testGroupParametersWithHttpInfo( - Integer requiredStringGroup, - Boolean requiredBooleanGroup, - Long requiredInt64Group, - Integer stringGroup, - Boolean booleanGroup, - Long int64Group) - throws ApiException { +private ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException( - 400, - "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); } - + // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException( - 400, - "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); } - + // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException( - 400, - "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); } - + // create path and map variables String localVarPath = "/fake"; @@ -1021,43 +886,33 @@ private ApiResponse<Void> testGroupParametersWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_string_group", requiredStringGroup)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "required_int64_group", requiredInt64Group)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "string_group", stringGroup)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "int64_group", int64Group)); if (requiredBooleanGroup != null) - localVarHeaderParams.put( - "required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); - if (booleanGroup != null) + localVarHeaderParams.put("required_boolean_group", apiClient.parameterToString(requiredBooleanGroup)); +if (booleanGroup != null) localVarHeaderParams.put("boolean_group", apiClient.parameterToString(booleanGroup)); - final String[] localVarAccepts = {}; - + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"bearer_test"}; - - return apiClient.invokeAPI( - "FakeApi.testGroupParameters", - localVarPath, - "DELETE", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "bearer_test" }; + + return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } public class APItestGroupParametersRequest { @@ -1068,11 +923,11 @@ public class APItestGroupParametersRequest { private Boolean booleanGroup; private Long int64Group; - private APItestGroupParametersRequest() {} + private APItestGroupParametersRequest() { + } /** * Set requiredStringGroup - * * @param requiredStringGroup Required String in group parameters (required) * @return APItestGroupParametersRequest */ @@ -1083,7 +938,6 @@ public APItestGroupParametersRequest requiredStringGroup(Integer requiredStringG /** * Set requiredBooleanGroup - * * @param requiredBooleanGroup Required Boolean in group parameters (required) * @return APItestGroupParametersRequest */ @@ -1094,7 +948,6 @@ public APItestGroupParametersRequest requiredBooleanGroup(Boolean requiredBoolea /** * Set requiredInt64Group - * * @param requiredInt64Group Required Integer in group parameters (required) * @return APItestGroupParametersRequest */ @@ -1105,7 +958,6 @@ public APItestGroupParametersRequest requiredInt64Group(Long requiredInt64Group) /** * Set stringGroup - * * @param stringGroup String in group parameters (optional) * @return APItestGroupParametersRequest */ @@ -1116,7 +968,6 @@ public APItestGroupParametersRequest stringGroup(Integer stringGroup) { /** * Set booleanGroup - * * @param booleanGroup Boolean in group parameters (optional) * @return APItestGroupParametersRequest */ @@ -1127,7 +978,6 @@ public APItestGroupParametersRequest booleanGroup(Boolean booleanGroup) { /** * Set int64Group - * * @param int64Group Integer in group parameters (optional) * @return APItestGroupParametersRequest */ @@ -1138,60 +988,57 @@ public APItestGroupParametersRequest int64Group(Long int64Group) { /** * Execute testGroupParameters request - * + * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> + </table> + */ + public void execute() throws ApiException { this.executeWithHttpInfo().getData(); } /** * Execute testGroupParameters request with HTTP info returned - * * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Someting wrong </td><td> - </td></tr> + </table> + */ public ApiResponse<Void> executeWithHttpInfo() throws ApiException { - return testGroupParametersWithHttpInfo( - requiredStringGroup, - requiredBooleanGroup, - requiredInt64Group, - stringGroup, - booleanGroup, - int64Group); + return testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } } /** - * Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters - * (optional) - * + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) * @return testGroupParametersRequest * @throws ApiException if fails to make API call + + */ public APItestGroupParametersRequest testGroupParameters() throws ApiException { return new APItestGroupParametersRequest(); } /** * test inline additionalProperties - * + * * @param requestBody request body (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public void testInlineAdditionalProperties(Map<String, String> requestBody) throws ApiException { testInlineAdditionalPropertiesWithHttpInfo(requestBody); @@ -1199,27 +1046,24 @@ public void testInlineAdditionalProperties(Map<String, String> requestBody) thro /** * test inline additionalProperties - * + * * @param requestBody request body (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo( - Map<String, String> requestBody) throws ApiException { + public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> requestBody) throws ApiException { Object localVarPostBody = requestBody; - + // verify the required parameter 'requestBody' is set if (requestBody == null) { - throw new ApiException( - 400, - "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); } - + // create path and map variables String localVarPath = "/fake/inline-additionalProperties"; @@ -1229,41 +1073,37 @@ public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "FakeApi.testInlineAdditionalProperties", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testInlineAdditionalProperties", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * test json serialization of form data - * + * * @param param field1 (required) * @param param2 field2 (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public void testJsonFormData(String param, String param2) throws ApiException { testJsonFormDataWithHttpInfo(param, param2); @@ -1271,33 +1111,30 @@ public void testJsonFormData(String param, String param2) throws ApiException { /** * test json serialization of form data - * + * * @param param field1 (required) * @param param2 field2 (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) - throws ApiException { + public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'param' is set if (param == null) { - throw new ApiException( - 400, "Missing the required parameter 'param' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); } - + // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException( - 400, "Missing the required parameter 'param2' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); } - + // create path and map variables String localVarPath = "/fake/jsonFormData"; @@ -1307,118 +1144,93 @@ public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - if (param != null) localVarFormParams.put("param", param); - if (param2 != null) localVarFormParams.put("param2", param2); - final String[] localVarAccepts = {}; + + + if (param != null) + localVarFormParams.put("param", param); +if (param2 != null) + localVarFormParams.put("param2", param2); + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "FakeApi.testJsonFormData", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testJsonFormData", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** + * * To test the collection format in query parameters - * - * @param pipe (required) - * @param ioutil (required) - * @param http (required) - * @param url (required) - * @param context (required) + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Success </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> */ - public void testQueryParameterCollectionFormat( - List<String> pipe, - List<String> ioutil, - List<String> http, - List<String> url, - List<String> context) - throws ApiException { + public void testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); } /** + * * To test the collection format in query parameters - * - * @param pipe (required) - * @param ioutil (required) - * @param http (required) - * @param url (required) - * @param context (required) + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> Success </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> Success </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo( - List<String> pipe, - List<String> ioutil, - List<String> http, - List<String> url, - List<String> context) - throws ApiException { + public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException( - 400, - "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException( - 400, - "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'http' is set if (http == null) { - throw new ApiException( - 400, - "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'url' is set if (url == null) { - throw new ApiException( - 400, - "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); } - + // verify the required parameter 'context' is set if (context == null) { - throw new ApiException( - 400, - "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); } - + // create path and map variables String localVarPath = "/fake/test-query-paramters"; @@ -1434,29 +1246,23 @@ public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo( localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "context", context)); - final String[] localVarAccepts = {}; - + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "FakeApi.testQueryParameterCollectionFormat", - localVarPath, - "PUT", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("FakeApi.testQueryParameterCollectionFormat", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index ca4b0f507d52..339851556a57 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -1,17 +1,21 @@ package org.openapitools.client.api; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + import org.openapitools.client.model.Client; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + public class FakeClassnameTags123Api { private ApiClient apiClient; @@ -42,42 +46,41 @@ public void setApiClient(ApiClient apiClient) { } /** - * To test class name in snake case To test class name in snake case - * + * To test class name in snake case + * To test class name in snake case * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public Client testClassname(Client client) throws ApiException { return testClassnameWithHttpInfo(client).getData(); } /** - * To test class name in snake case To test class name in snake case - * + * To test class name in snake case + * To test class name in snake case * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public ApiResponse<Client> testClassnameWithHttpInfo(Client client) throws ApiException { Object localVarPostBody = client; - + // verify the required parameter 'client' is set if (client == null) { - throw new ApiException( - 400, "Missing the required parameter 'client' when calling testClassname"); + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); } - + // create path and map variables String localVarPath = "/fake_classname_test"; @@ -87,29 +90,26 @@ public ApiResponse<Client> testClassnameWithHttpInfo(Client client) throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/json"}; + + + + + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"api_key_query"}; + String[] localVarAuthNames = new String[] { "api_key_query" }; GenericType<Client> localVarReturnType = new GenericType<Client>() {}; - return apiClient.invokeAPI( - "FakeClassnameTags123Api.testClassname", - localVarPath, - "PATCH", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("FakeClassnameTags123Api.testClassname", localVarPath, "PATCH", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java index af6e041847bc..84447c1f19b9 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/PetApi.java @@ -1,19 +1,23 @@ package org.openapitools.client.api; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + public class PetApi { private ApiClient apiClient; @@ -45,14 +49,14 @@ public void setApiClient(ApiClient apiClient) { /** * Add a new pet to the store - * + * * @param pet Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> */ public void addPet(Pet pet) throws ApiException { addPetWithHttpInfo(pet); @@ -60,24 +64,24 @@ public void addPet(Pet pet) throws ApiException { /** * Add a new pet to the store - * + * * @param pet Pet object that needs to be added to the store (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> */ public ApiResponse<Void> addPetWithHttpInfo(Pet pet) throws ApiException { Object localVarPostBody = pet; - + // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); } - + // create path and map variables String localVarPath = "/pet"; @@ -87,41 +91,37 @@ public ApiResponse<Void> addPetWithHttpInfo(Pet pet) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json", "application/xml"}; + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; - - return apiClient.invokeAPI( - "PetApi.addPet", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * Deletes a pet - * + * * @param petId Pet id to delete (required) - * @param apiKey (optional) + * @param apiKey (optional) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> + </table> */ public void deletePet(Long petId, String apiKey) throws ApiException { deletePetWithHttpInfo(petId, apiKey); @@ -129,29 +129,28 @@ public void deletePet(Long petId, String apiKey) throws ApiException { /** * Deletes a pet - * + * * @param petId Pet id to delete (required) - * @param apiKey (optional) + * @param apiKey (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid pet value </td><td> - </td></tr> + </table> */ public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); } - + // create path and map variables - String localVarPath = - "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -159,73 +158,66 @@ public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - if (apiKey != null) localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); - final String[] localVarAccepts = {}; + if (apiKey != null) + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; - - return apiClient.invokeAPI( - "PetApi.deletePet", - localVarPath, - "DELETE", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.deletePet", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * Finds Pets by status Multiple status values can be provided with comma separated strings - * + * 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 (required) * @return List<Pet> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> + </table> */ public List<Pet> findPetsByStatus(List<String> status) throws ApiException { return findPetsByStatusWithHttpInfo(status).getData(); } /** - * Finds Pets by status Multiple status values can be provided with comma separated strings - * + * 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 (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid status value </td><td> - </td></tr> + </table> */ - public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) - throws ApiException { + public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'status' is set if (status == null) { - throw new ApiException( - 400, "Missing the required parameter 'status' when calling findPetsByStatus"); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); } - + // create path and map variables String localVarPath = "/pet/findByStatus"; @@ -237,46 +229,39 @@ public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); - final String[] localVarAccepts = {"application/xml", "application/json"}; + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; + String[] localVarAuthNames = new String[] { "petstore_auth" }; GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; - return apiClient.invokeAPI( - "PetApi.findPetsByStatus", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("PetApi.findPetsByStatus", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** - * Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, - * tag3 for testing. - * + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) * @return List<Pet> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> - * </table> - * + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> + </table> * @deprecated */ @Deprecated @@ -285,31 +270,28 @@ public List<Pet> findPetsByTags(List<String> tags) throws ApiException { } /** - * Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, - * tag3 for testing. - * + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> - * </table> - * + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid tag value </td><td> - </td></tr> + </table> * @deprecated */ @Deprecated public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException( - 400, "Missing the required parameter 'tags' when calling findPetsByTags"); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); } - + // create path and map variables String localVarPath = "/pet/findByTags"; @@ -321,76 +303,70 @@ public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) thro localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); - final String[] localVarAccepts = {"application/xml", "application/json"}; + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; + String[] localVarAuthNames = new String[] { "petstore_auth" }; GenericType<List<Pet>> localVarReturnType = new GenericType<List<Pet>>() {}; - return apiClient.invokeAPI( - "PetApi.findPetsByTags", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** - * Find pet by ID Returns a single pet - * + * Find pet by ID + * Returns a single pet * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + </table> */ public Pet getPetById(Long petId) throws ApiException { return getPetByIdWithHttpInfo(petId).getData(); } /** - * Find pet by ID Returns a single pet - * + * Find pet by ID + * Returns a single pet * @param petId ID of pet to return (required) * @return ApiResponse<Pet> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + </table> */ public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); } - + // create path and map variables - String localVarPath = - "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -398,44 +374,40 @@ public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/xml", "application/json"}; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"api_key"}; + String[] localVarAuthNames = new String[] { "api_key" }; GenericType<Pet> localVarReturnType = new GenericType<Pet>() {}; - return apiClient.invokeAPI( - "PetApi.getPetById", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("PetApi.getPetById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** * Update an existing pet - * + * * @param pet Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - * <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> + </table> */ public void updatePet(Pet pet) throws ApiException { updatePetWithHttpInfo(pet); @@ -443,26 +415,26 @@ public void updatePet(Pet pet) throws ApiException { /** * Update an existing pet - * + * * @param pet Pet object that needs to be added to the store (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> - * <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Pet not found </td><td> - </td></tr> + <tr><td> 405 </td><td> Validation exception </td><td> - </td></tr> + </table> */ public ApiResponse<Void> updatePetWithHttpInfo(Pet pet) throws ApiException { Object localVarPostBody = pet; - + // verify the required parameter 'pet' is set if (pet == null) { throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); } - + // create path and map variables String localVarPath = "/pet"; @@ -472,42 +444,38 @@ public ApiResponse<Void> updatePetWithHttpInfo(Pet pet) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json", "application/xml"}; + final String[] localVarContentTypes = { + "application/json", "application/xml" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; - - return apiClient.invokeAPI( - "PetApi.updatePet", - localVarPath, - "PUT", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * Updates a pet in the store with form data - * + * * @param petId ID of pet that needs to be updated (required) * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { updatePetWithFormWithHttpInfo(petId, name, status); @@ -515,32 +483,29 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api /** * Updates a pet in the store with form data - * + * * @param petId ID of pet that needs to be updated (required) * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 405 </td><td> Invalid input </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) - throws ApiException { + public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException( - 400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); } - + // create path and map variables - String localVarPath = - "/pet/{petId}" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = "/pet/{petId}" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -548,79 +513,73 @@ public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - if (name != null) localVarFormParams.put("name", name); - if (status != null) localVarFormParams.put("status", status); - final String[] localVarAccepts = {}; + + + if (name != null) + localVarFormParams.put("name", name); +if (status != null) + localVarFormParams.put("status", status); + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/x-www-form-urlencoded"}; + final String[] localVarContentTypes = { + "application/x-www-form-urlencoded" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; - - return apiClient.invokeAPI( - "PetApi.updatePetWithForm", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { "petstore_auth" }; + + return apiClient.invokeAPI("PetApi.updatePetWithForm", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * uploads an image - * + * * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) - throws ApiException { + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); } /** * uploads an image - * + * * @param petId ID of pet to update (required) * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo( - Long petId, String additionalMetadata, File file) throws ApiException { + public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); } - + // create path and map variables - String localVarPath = - "/pet/{petId}/uploadImage" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = "/pet/{petId}/uploadImage" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -628,90 +587,80 @@ public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); - if (file != null) localVarFormParams.put("file", file); +if (file != null) + localVarFormParams.put("file", file); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"multipart/form-data"}; + final String[] localVarContentTypes = { + "multipart/form-data" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; + String[] localVarAuthNames = new String[] { "petstore_auth" }; GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; - return apiClient.invokeAPI( - "PetApi.uploadFile", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("PetApi.uploadFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** * uploads an image (required) - * + * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ModelApiResponse uploadFileWithRequiredFile( - Long petId, File requiredFile, String additionalMetadata) throws ApiException { - return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata) - .getData(); + public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); } /** * uploads an image (required) - * + * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo( - Long petId, File requiredFile, String additionalMetadata) throws ApiException { + public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException( - 400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); } - + // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException( - 400, - "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); } - + // create path and map variables - String localVarPath = - "/fake/{petId}/uploadImageWithRequiredFile" - .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replaceAll("\\{" + "petId" + "\\}", apiClient.escapeString(petId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -719,33 +668,30 @@ public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo( Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); + + + if (additionalMetadata != null) localVarFormParams.put("additionalMetadata", additionalMetadata); - if (requiredFile != null) localVarFormParams.put("requiredFile", requiredFile); +if (requiredFile != null) + localVarFormParams.put("requiredFile", requiredFile); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"multipart/form-data"}; + final String[] localVarContentTypes = { + "multipart/form-data" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"petstore_auth"}; + String[] localVarAuthNames = new String[] { "petstore_auth" }; GenericType<ModelApiResponse> localVarReturnType = new GenericType<ModelApiResponse>() {}; - return apiClient.invokeAPI( - "PetApi.uploadFileWithRequiredFile", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("PetApi.uploadFileWithRequiredFile", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java index 8bb02d79038a..0e29deb7564f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/StoreApi.java @@ -1,17 +1,21 @@ package org.openapitools.client.api; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + import org.openapitools.client.model.Order; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + public class StoreApi { private ApiClient apiClient; @@ -42,49 +46,45 @@ public void setApiClient(ApiClient apiClient) { } /** - * Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything - * above 1000 or nonintegers will generate API errors - * + * 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 (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> */ public void deleteOrder(String orderId) throws ApiException { 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 - * + * 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 (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> */ public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException( - 400, "Missing the required parameter 'orderId' when calling deleteOrder"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); } - + // create path and map variables - String localVarPath = - "/store/order/{order_id}" - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -92,60 +92,55 @@ public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiExcep Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "StoreApi.deleteOrder", - localVarPath, - "DELETE", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("StoreApi.deleteOrder", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * Returns pet inventories by status Returns a map of status codes to quantities - * + * Returns pet inventories by status + * Returns a map of status codes to quantities * @return Map<String, Integer> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public Map<String, Integer> getInventory() throws ApiException { return getInventoryWithHttpInfo().getData(); } /** - * Returns pet inventories by status Returns a map of status codes to quantities - * + * Returns pet inventories by status + * Returns a map of status codes to quantities * @return ApiResponse<Map<String, Integer>> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + </table> */ public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/store/inventory"; @@ -155,80 +150,71 @@ public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {"api_key"}; - - GenericType<Map<String, Integer>> localVarReturnType = - new GenericType<Map<String, Integer>>() {}; - - return apiClient.invokeAPI( - "StoreApi.getInventory", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + String[] localVarAuthNames = new String[] { "api_key" }; + + GenericType<Map<String, Integer>> localVarReturnType = new GenericType<Map<String, Integer>>() {}; + + return apiClient.invokeAPI("StoreApi.getInventory", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** - * Find purchase order by ID For valid response try integer IDs with value <= 5 or > - * 10. Other values will generated exceptions - * + * 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 (required) * @return Order * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> */ public Order getOrderById(Long orderId) throws ApiException { return getOrderByIdWithHttpInfo(orderId).getData(); } /** - * Find purchase order by ID For valid response try integer IDs with value <= 5 or > - * 10. Other values will generated exceptions - * + * 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 (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid ID supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> Order not found </td><td> - </td></tr> + </table> */ public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException( - 400, "Missing the required parameter 'orderId' when calling getOrderById"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); } - + // create path and map variables - String localVarPath = - "/store/order/{order_id}" - .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); + String localVarPath = "/store/order/{order_id}" + .replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -236,44 +222,40 @@ public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/xml", "application/json"}; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<Order> localVarReturnType = new GenericType<Order>() {}; - return apiClient.invokeAPI( - "StoreApi.getOrderById", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("StoreApi.getOrderById", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** * Place an order for a pet - * + * * @param order order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> + </table> */ public Order placeOrder(Order order) throws ApiException { return placeOrderWithHttpInfo(order).getData(); @@ -281,25 +263,25 @@ public Order placeOrder(Order order) throws ApiException { /** * Place an order for a pet - * + * * @param order order placed for purchasing the pet (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr> + </table> */ public ApiResponse<Order> placeOrderWithHttpInfo(Order order) throws ApiException { Object localVarPostBody = order; - + // verify the required parameter 'order' is set if (order == null) { throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); } - + // create path and map variables String localVarPath = "/store/order"; @@ -309,29 +291,26 @@ public ApiResponse<Order> placeOrderWithHttpInfo(Order order) throws ApiExceptio Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/xml", "application/json"}; + + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<Order> localVarReturnType = new GenericType<Order>() {}; - return apiClient.invokeAPI( - "StoreApi.placeOrder", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java index dda3ad6bdf39..9b6250da568d 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/api/UserApi.java @@ -1,17 +1,21 @@ package org.openapitools.client.api; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + import org.openapitools.client.model.User; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + public class UserApi { private ApiClient apiClient; @@ -42,40 +46,40 @@ public void setApiClient(ApiClient apiClient) { } /** - * Create user This can only be done by the logged in user. - * + * Create user + * This can only be done by the logged in user. * @param user Created user object (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ public void createUser(User user) throws ApiException { createUserWithHttpInfo(user); } /** - * Create user This can only be done by the logged in user. - * + * Create user + * This can only be done by the logged in user. * @param user Created user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ public ApiResponse<Void> createUserWithHttpInfo(User user) throws ApiException { Object localVarPostBody = user; - + // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); } - + // create path and map variables String localVarPath = "/user"; @@ -85,40 +89,36 @@ public ApiResponse<Void> createUserWithHttpInfo(User user) throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "UserApi.createUser", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * Creates list of users with given input array - * + * * @param user List of user object (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ public void createUsersWithArrayInput(List<User> user) throws ApiException { createUsersWithArrayInputWithHttpInfo(user); @@ -126,26 +126,24 @@ public void createUsersWithArrayInput(List<User> user) throws ApiException { /** * Creates list of users with given input array - * + * * @param user List of user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user) - throws ApiException { + public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user) throws ApiException { Object localVarPostBody = user; - + // verify the required parameter 'user' is set if (user == null) { - throw new ApiException( - 400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); } - + // create path and map variables String localVarPath = "/user/createWithArray"; @@ -155,40 +153,36 @@ public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user) Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "UserApi.createUsersWithArrayInput", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * Creates list of users with given input array - * + * * @param user List of user object (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ public void createUsersWithListInput(List<User> user) throws ApiException { createUsersWithListInputWithHttpInfo(user); @@ -196,26 +190,24 @@ public void createUsersWithListInput(List<User> user) throws ApiException { /** * Creates list of users with given input array - * + * * @param user List of user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ - public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user) - throws ApiException { + public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user) throws ApiException { Object localVarPostBody = user; - + // verify the required parameter 'user' is set if (user == null) { - throw new ApiException( - 400, "Missing the required parameter 'user' when calling createUsersWithListInput"); + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); } - + // create path and map variables String localVarPath = "/user/createWithList"; @@ -225,72 +217,66 @@ public ApiResponse<Void> createUsersWithListInputWithHttpInfo(List<User> user) Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "UserApi.createUsersWithListInput", - localVarPath, - "POST", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.createUsersWithListInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * Delete user This can only be done by the logged in user. - * + * Delete user + * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ public void deleteUser(String username) throws ApiException { deleteUserWithHttpInfo(username); } /** - * Delete user This can only be done by the logged in user. - * + * Delete user + * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException( - 400, "Missing the required parameter 'username' when calling deleteUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); } - + // create path and map variables - String localVarPath = - "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -298,44 +284,39 @@ public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiExcep Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "UserApi.deleteUser", - localVarPath, - "DELETE", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.deleteUser", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** * Get user by user name - * + * * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ public User getUserByName(String username) throws ApiException { return getUserByNameWithHttpInfo(username).getData(); @@ -343,31 +324,29 @@ public User getUserByName(String username) throws ApiException { /** * Get user by user name - * + * * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return ApiResponse<User> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> - * <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> - </td></tr> + <tr><td> 400 </td><td> Invalid username supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException( - 400, "Missing the required parameter 'username' when calling getUserByName"); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); } - + // create path and map variables - String localVarPath = - "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -375,45 +354,41 @@ public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiEx Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {"application/xml", "application/json"}; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<User> localVarReturnType = new GenericType<User>() {}; - return apiClient.invokeAPI( - "UserApi.getUserByName", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("UserApi.getUserByName", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** * Logs user into the system - * + * * @param username The user name for login (required) * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> - * <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> + <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> + </table> */ public String loginUser(String username, String password) throws ApiException { return loginUserWithHttpInfo(username, password).getData(); @@ -421,34 +396,31 @@ public String loginUser(String username, String password) throws ApiException { /** * Logs user into the system - * + * * @param username The user name for login (required) * @param password The password for login in clear text (required) * @return ApiResponse<String> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> - * <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 200 </td><td> successful operation </td><td> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> </td></tr> + <tr><td> 400 </td><td> Invalid username/password supplied </td><td> - </td></tr> + </table> */ - public ApiResponse<String> loginUserWithHttpInfo(String username, String password) - throws ApiException { + public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException { Object localVarPostBody = null; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException( - 400, "Missing the required parameter 'username' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); } - + // verify the required parameter 'password' is set if (password == null) { - throw new ApiException( - 400, "Missing the required parameter 'password' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); } - + // create path and map variables String localVarPath = "/user/login"; @@ -461,41 +433,36 @@ public ApiResponse<String> loginUserWithHttpInfo(String username, String passwor localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); - final String[] localVarAccepts = {"application/xml", "application/json"}; + + + + final String[] localVarAccepts = { + "application/xml", "application/json" + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; + String[] localVarAuthNames = new String[] { }; GenericType<String> localVarReturnType = new GenericType<String>() {}; - return apiClient.invokeAPI( - "UserApi.loginUser", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - localVarReturnType, - null); + return apiClient.invokeAPI("UserApi.loginUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); } /** * Logs out current logged in user session - * + * * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ public void logoutUser() throws ApiException { logoutUserWithHttpInfo(); @@ -503,18 +470,18 @@ public void logoutUser() throws ApiException { /** * Logs out current logged in user session - * + * * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 0 </td><td> successful operation </td><td> - </td></tr> + </table> */ public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { Object localVarPostBody = null; - + // create path and map variables String localVarPath = "/user/logout"; @@ -524,80 +491,73 @@ public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {}; - + final String[] localVarContentTypes = { + + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "UserApi.logoutUser", - localVarPath, - "GET", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.logoutUser", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } /** - * Updated user This can only be done by the logged in user. - * + * Updated user + * This can only be done by the logged in user. * @param username name that need to be deleted (required) * @param user Updated user object (required) * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ public void updateUser(String username, User user) throws ApiException { updateUserWithHttpInfo(username, user); } /** - * Updated user This can only be done by the logged in user. - * + * Updated user + * This can only be done by the logged in user. * @param username name that need to be deleted (required) * @param user Updated user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details - * <table summary="Response Details" border="1"> - * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> - * <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> - * <tr><td> 404 </td><td> User not found </td><td> - </td></tr> - * </table> + <table summary="Response Details" border="1"> + <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> + <tr><td> 400 </td><td> Invalid user supplied </td><td> - </td></tr> + <tr><td> 404 </td><td> User not found </td><td> - </td></tr> + </table> */ public ApiResponse<Void> updateUserWithHttpInfo(String username, User user) throws ApiException { Object localVarPostBody = user; - + // verify the required parameter 'username' is set if (username == null) { - throw new ApiException( - 400, "Missing the required parameter 'username' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } - + // verify the required parameter 'user' is set if (user == null) { throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); } - + // create path and map variables - String localVarPath = - "/user/{username}" - .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); + String localVarPath = "/user/{username}" + .replaceAll("\\{" + "username" + "\\}", apiClient.escapeString(username.toString())); // query params List<Pair> localVarQueryParams = new ArrayList<Pair>(); @@ -605,28 +565,24 @@ public ApiResponse<Void> updateUserWithHttpInfo(String username, User user) thro Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); - final String[] localVarAccepts = {}; + + + + final String[] localVarAccepts = { + + }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - final String[] localVarContentTypes = {"application/json"}; + final String[] localVarContentTypes = { + "application/json" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] {}; - - return apiClient.invokeAPI( - "UserApi.updateUser", - localVarPath, - "PUT", - localVarQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAccept, - localVarContentType, - localVarAuthNames, - null, - null); + String[] localVarAuthNames = new String[] { }; + + return apiClient.invokeAPI("UserApi.updateUser", localVarPath, "PUT", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, null, null); } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java index e77ca74a38f5..c1b2e4840702 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -3,20 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + import java.net.URI; -import java.util.List; import java.util.Map; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import java.util.List; + public class ApiKeyAuth implements Authentication { private final String location; @@ -55,14 +58,7 @@ public void setApiKeyPrefix(String apiKeyPrefix) { } @Override - public void applyToParams( - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { if (apiKey == null) { return; } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java index b2f568ccf5cc..579b5e0d6d53 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/Authentication.java @@ -3,35 +3,31 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + import java.net.URI; -import java.util.List; import java.util.Map; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import java.util.List; public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams( - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException; + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException; + } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java index 208509bfe862..bf1b68d5a316 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -3,22 +3,27 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + import com.migcomponents.migbase64.Base64; -import java.io.UnsupportedEncodingException; + import java.net.URI; -import java.util.List; import java.util.Map; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import java.util.List; + +import java.io.UnsupportedEncodingException; + public class HttpBasicAuth implements Authentication { private String username; @@ -41,21 +46,13 @@ public void setPassword(String password) { } @Override - public void applyToParams( - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { if (username == null && password == null) { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); try { - headerParams.put( - "Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); + headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java index c932a7456626..1b46b4c6839f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java @@ -3,20 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + import java.net.URI; -import java.util.List; import java.util.Map; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import java.util.List; + public class HttpBearerAuth implements Authentication { private final String scheme; @@ -27,8 +30,7 @@ public HttpBearerAuth(String scheme) { } /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization - * header. + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. * * @return The bearer token */ @@ -37,8 +39,7 @@ public String getBearerToken() { } /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization - * header. + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. * * @param bearerToken The bearer token to send in the Authorization header */ @@ -47,20 +48,12 @@ public void setBearerToken(String bearerToken) { } @Override - public void applyToParams( - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException { - if (bearerToken == null) { + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { + if(bearerToken == null) { return; } - headerParams.put( - "Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); } private static String upperCaseBearer(String scheme) { diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java index c98091bad019..336d15934686 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java @@ -3,66 +3,137 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + import java.net.URI; import java.net.URLEncoder; -import java.security.Key; import java.security.MessageDigest; +import java.security.Key; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Base64; import java.util.Date; -import java.util.List; import java.util.Locale; import java.util.Map; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import java.util.List; + import org.tomitribe.auth.signatures.*; +/** + * A Configuration object for the HTTP message signature security scheme. + */ public class HttpSignatureAuth implements Authentication { private Signer signer; - private String name; + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + // The HTTP signature algorithm. private Algorithm algorithm; + // The list of HTTP headers that should be included in the HTTP signature. private List<String> headers; - public HttpSignatureAuth(String name, Algorithm algorithm, List<String> headers) { - this.name = name; + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param algorithm The signature algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, Algorithm algorithm, List<String> headers) { + this.keyId = keyId; this.algorithm = algorithm; this.headers = headers; + this.digestAlgorithm = "SHA-256"; } - public String getName() { - return name; + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; } - public void setName(String name) { - this.name = name; + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; } + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ public Algorithm getAlgorithm() { return algorithm; } + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ public void setAlgorithm(Algorithm algorithm) { this.algorithm = algorithm; } + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ public List<String> getHeaders() { return headers; } + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ public void setHeaders(List<String> headers) { this.headers = headers; } @@ -75,46 +146,39 @@ public void setSigner(Signer signer) { this.signer = signer; } - public void setup(Key key) throws ApiException { + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + */ + public void setPrivateKey(Key key) throws ApiException { if (key == null) { - throw new ApiException("key (java.security.Key) cannot be null"); + throw new ApiException("Private key (java.security.Key) cannot be null"); } - signer = new Signer(key, new Signature(name, algorithm, null, headers)); + signer = new Signer(key, new Signature(keyId, algorithm, null, headers)); } @Override - public void applyToParams( - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, + String payload, String method, URI uri) throws ApiException { try { if (headers.contains("host")) { headerParams.put("host", uri.getHost()); } if (headers.contains("date")) { - headerParams.put( - "date", - new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); + headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); } if (headers.contains("digest")) { - headerParams.put( - "digest", - "SHA-256=" - + new String( - Base64.getEncoder() - .encode(MessageDigest.getInstance("SHA-256").digest(payload.getBytes())))); + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); } if (signer == null) { - throw new ApiException( - "Signer cannot be null. Please run the method `setup` to set it up correctly"); + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); } // construct the path with the URL query string @@ -122,10 +186,7 @@ public void applyToParams( List<String> urlQueries = new ArrayList<String>(); for (Pair queryParam : queryParams) { - urlQueries.add( - queryParam.getName() - + "=" - + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); + urlQueries.add(queryParam.getName() + "=" + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); } if (!urlQueries.isEmpty()) { @@ -134,8 +195,7 @@ public void applyToParams( headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); } catch (Exception ex) { - throw new ApiException( - "Failed to create signature in the HTTP request header: " + ex.toString()); + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); } } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java index c7302cbcbd49..77061fb4ac88 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuth.java @@ -3,20 +3,23 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + import java.net.URI; -import java.util.List; import java.util.Map; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import java.util.List; + public class OAuth implements Authentication { private String accessToken; @@ -30,14 +33,7 @@ public void setAccessToken(String accessToken) { } @Override - public void applyToParams( - List<Pair> queryParams, - Map<String, String> headerParams, - Map<String, String> cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { if (accessToken != null) { headerParams.put("Authorization", "Bearer " + accessToken); } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java index 1e09cd99afc5..b2d11ff0c4f0 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -3,18 +3,16 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.auth; public enum OAuthFlow { - accessCode, - implicit, - password, - application + accessCode, implicit, password, application } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java index d7bae11f1263..1f7ba0235862 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java @@ -3,62 +3,64 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import org.openapitools.client.ApiException; +import java.lang.reflect.Type; import java.util.Map; import javax.ws.rs.core.GenericType; -/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ + public abstract class AbstractOpenApiSchema { - // store the actual instance of the schema/object - private Object instance; + // store the actual instance of the schema/object + private Object instance; - // schema type (e.g. oneOf, anyOf) - private final String schemaType; + // schema type (e.g. oneOf, anyOf) + private final String schemaType; - public AbstractOpenApiSchema(String schemaType) { - this.schemaType = schemaType; - } + public AbstractOpenApiSchema(String schemaType) { + this.schemaType = schemaType; + } - /** - * * Get the list of schemas allowed to be stored in this object - * - * @return an instance of the actual schema/object - */ - public abstract Map<String, GenericType> getSchemas(); + /*** + * Get the list of schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map<String, GenericType> getSchemas(); - /** - * * Get the actual instance - * - * @return an instance of the actual schema/object - */ - public Object getActualInstance() { - return instance; - } + /*** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + public Object getActualInstance() {return instance;} - /** - * * Set the actual instance - * - * @param instance the actual instance of the schema/object - */ - public void setActualInstance(Object instance) { - this.instance = instance; - } + /*** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} - /** - * * Get the schema type (e.g. anyOf, oneOf) - * - * @return the schema type - */ - public String getSchemaType() { - return schemaType; - } + /*** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } } diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 7d984f4458d0..67520d4d6999 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -3,28 +3,37 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** AdditionalPropertiesClass */ +/** + * AdditionalPropertiesClass + */ @JsonPropertyOrder({ AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY }) + public class AdditionalPropertiesClass { public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; private Map<String, String> mapProperty = null; @@ -32,8 +41,9 @@ public class AdditionalPropertiesClass { public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; private Map<String, Map<String, String>> mapOfMapProperty = null; - public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) { + public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) { + this.mapProperty = mapProperty; return this; } @@ -46,32 +56,32 @@ public AdditionalPropertiesClass putMapPropertyItem(String key, String mapProper return this; } - /** + /** * Get mapProperty - * * @return mapProperty - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, String> getMapProperty() { return mapProperty; } + public void setMapProperty(Map<String, String> mapProperty) { this.mapProperty = mapProperty; } - public AdditionalPropertiesClass mapOfMapProperty( - Map<String, Map<String, String>> mapOfMapProperty) { + public AdditionalPropertiesClass mapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; return this; } - public AdditionalPropertiesClass putMapOfMapPropertyItem( - String key, Map<String, String> mapOfMapPropertyItem) { + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) { if (this.mapOfMapProperty == null) { this.mapOfMapProperty = new HashMap<String, Map<String, String>>(); } @@ -79,23 +89,25 @@ public AdditionalPropertiesClass putMapOfMapPropertyItem( return this; } - /** + /** * Get mapOfMapProperty - * * @return mapOfMapProperty - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Map<String, String>> getMapOfMapProperty() { return mapOfMapProperty; } + public void setMapOfMapProperty(Map<String, Map<String, String>> mapOfMapProperty) { this.mapOfMapProperty = mapOfMapProperty; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -105,8 +117,8 @@ public boolean equals(java.lang.Object o) { return false; } AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; - return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) - && Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); } @Override @@ -114,6 +126,7 @@ public int hashCode() { return Objects.hash(mapProperty, mapOfMapProperty); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -125,7 +138,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -133,4 +147,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java index 0be31d514fe3..67dd4c036fc5 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Animal.java @@ -3,34 +3,42 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Animal */ -@JsonPropertyOrder({Animal.JSON_PROPERTY_CLASS_NAME, Animal.JSON_PROPERTY_COLOR}) -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "className", - visible = true) +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), }) + public class Animal { public static final String JSON_PROPERTY_CLASS_NAME = "className"; private String className; @@ -38,51 +46,56 @@ public class Animal { public static final String JSON_PROPERTY_COLOR = "color"; private String color = "red"; - public Animal className(String className) { + public Animal className(String className) { + this.className = className; return this; } - /** + /** * Get className - * * @return className - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_CLASS_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getClassName() { return className; } + public void setClassName(String className) { this.className = className; } - public Animal color(String color) { + public Animal color(String color) { + this.color = color; return this; } - /** + /** * Get color - * * @return color - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COLOR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getColor() { return color; } + public void setColor(String color) { this.color = color; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -92,8 +105,8 @@ public boolean equals(java.lang.Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) - && Objects.equals(this.color, animal.color); + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); } @Override @@ -101,6 +114,7 @@ public int hashCode() { return Objects.hash(className, color); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -112,7 +126,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -120,4 +135,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index fc5cfed29072..96f829bc648b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -3,32 +3,43 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) -/** ArrayOfArrayOfNumberOnly */ -@JsonPropertyOrder({ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER}) public class ArrayOfArrayOfNumberOnly { public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; private List<List<BigDecimal>> arrayArrayNumber = null; - public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; return this; } @@ -41,23 +52,25 @@ public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayAr return this; } - /** + /** * Get arrayArrayNumber - * * @return arrayArrayNumber - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<List<BigDecimal>> getArrayArrayNumber() { return arrayArrayNumber; } + public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { this.arrayArrayNumber = arrayArrayNumber; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -75,6 +88,7 @@ public int hashCode() { return Objects.hash(arrayArrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -85,7 +99,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -93,4 +108,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 6d4b1ba077e6..37e40dbd3ec8 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -3,32 +3,43 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) -/** ArrayOfNumberOnly */ -@JsonPropertyOrder({ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER}) public class ArrayOfNumberOnly { public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; private List<BigDecimal> arrayNumber = null; - public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) { + public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) { + this.arrayNumber = arrayNumber; return this; } @@ -41,23 +52,25 @@ public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { return this; } - /** + /** * Get arrayNumber - * * @return arrayNumber - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<BigDecimal> getArrayNumber() { return arrayNumber; } + public void setArrayNumber(List<BigDecimal> arrayNumber) { this.arrayNumber = arrayNumber; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -75,6 +88,7 @@ public int hashCode() { return Objects.hash(arrayNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -85,7 +99,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -93,4 +108,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java index b7b468f33edd..de7c895ac93a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -3,29 +3,38 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.Objects; +import org.openapitools.client.model.ReadOnlyFirst; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** ArrayTest */ +/** + * ArrayTest + */ @JsonPropertyOrder({ ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL }) + public class ArrayTest { public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; private List<String> arrayOfString = null; @@ -36,8 +45,9 @@ public class ArrayTest { public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; private List<List<ReadOnlyFirst>> arrayArrayOfModel = null; - public ArrayTest arrayOfString(List<String> arrayOfString) { + public ArrayTest arrayOfString(List<String> arrayOfString) { + this.arrayOfString = arrayOfString; return this; } @@ -50,25 +60,27 @@ public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { return this; } - /** + /** * Get arrayOfString - * * @return arrayOfString - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<String> getArrayOfString() { return arrayOfString; } + public void setArrayOfString(List<String> arrayOfString) { this.arrayOfString = arrayOfString; } - public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { + public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; return this; } @@ -81,25 +93,27 @@ public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) return this; } - /** + /** * Get arrayArrayOfInteger - * * @return arrayArrayOfInteger - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<List<Long>> getArrayArrayOfInteger() { return arrayArrayOfInteger; } + public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { this.arrayArrayOfInteger = arrayArrayOfInteger; } - public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { + public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; return this; } @@ -112,23 +126,25 @@ public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelI return this; } - /** + /** * Get arrayArrayOfModel - * * @return arrayArrayOfModel - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<List<ReadOnlyFirst>> getArrayArrayOfModel() { return arrayArrayOfModel; } + public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { this.arrayArrayOfModel = arrayArrayOfModel; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -138,9 +154,9 @@ public boolean equals(java.lang.Object o) { return false; } ArrayTest arrayTest = (ArrayTest) o; - return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) - && Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) - && Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); } @Override @@ -148,21 +164,21 @@ public int hashCode() { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ArrayTest {\n"); sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); - sb.append(" arrayArrayOfInteger: ") - .append(toIndentedString(arrayArrayOfInteger)) - .append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -170,4 +186,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java index a152526a20d8..033e97881105 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Capitalization.java @@ -3,22 +3,29 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Capitalization */ +/** + * Capitalization + */ @JsonPropertyOrder({ Capitalization.JSON_PROPERTY_SMALL_CAMEL, Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, @@ -27,6 +34,7 @@ Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E }) + public class Capitalization { public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; private String smallCamel; @@ -46,144 +54,157 @@ public class Capitalization { public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; private String ATT_NAME; - public Capitalization smallCamel(String smallCamel) { + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; return this; } - /** + /** * Get smallCamel - * * @return smallCamel - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSmallCamel() { return smallCamel; } + public void setSmallCamel(String smallCamel) { this.smallCamel = smallCamel; } - public Capitalization capitalCamel(String capitalCamel) { + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; return this; } - /** + /** * Get capitalCamel - * * @return capitalCamel - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCapitalCamel() { return capitalCamel; } + public void setCapitalCamel(String capitalCamel) { this.capitalCamel = capitalCamel; } - public Capitalization smallSnake(String smallSnake) { + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; return this; } - /** + /** * Get smallSnake - * * @return smallSnake - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSmallSnake() { return smallSnake; } + public void setSmallSnake(String smallSnake) { this.smallSnake = smallSnake; } - public Capitalization capitalSnake(String capitalSnake) { + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; return this; } - /** + /** * Get capitalSnake - * * @return capitalSnake - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCapitalSnake() { return capitalSnake; } + public void setCapitalSnake(String capitalSnake) { this.capitalSnake = capitalSnake; } - public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; return this; } - /** + /** * Get scAETHFlowPoints - * * @return scAETHFlowPoints - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScAETHFlowPoints() { return scAETHFlowPoints; } + public void setScAETHFlowPoints(String scAETHFlowPoints) { this.scAETHFlowPoints = scAETHFlowPoints; } - public Capitalization ATT_NAME(String ATT_NAME) { + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; return this; } - /** - * Name of the pet - * + /** + * Name of the pet * @return ATT_NAME - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Name of the pet ") @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getATTNAME() { return ATT_NAME; } + public void setATTNAME(String ATT_NAME) { this.ATT_NAME = ATT_NAME; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,20 +214,20 @@ public boolean equals(java.lang.Object o) { return false; } Capitalization capitalization = (Capitalization) o; - return Objects.equals(this.smallCamel, capitalization.smallCamel) - && Objects.equals(this.capitalCamel, capitalization.capitalCamel) - && Objects.equals(this.smallSnake, capitalization.smallSnake) - && Objects.equals(this.capitalSnake, capitalization.capitalSnake) - && Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) - && Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); } @Override public int hashCode() { - return Objects.hash( - smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -222,7 +243,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -230,4 +252,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java index ac0b84d82e4b..484725c76fe0 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Cat.java @@ -3,50 +3,65 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.CatAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) -/** Cat */ -@JsonPropertyOrder({Cat.JSON_PROPERTY_DECLAWED}) public class Cat extends Animal { public static final String JSON_PROPERTY_DECLAWED = "declawed"; private Boolean declawed; - public Cat declawed(Boolean declawed) { + public Cat declawed(Boolean declawed) { + this.declawed = declawed; return this; } - /** + /** * Get declawed - * * @return declawed - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DECLAWED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeclawed() { return declawed; } + public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -56,7 +71,8 @@ public boolean equals(java.lang.Object o) { return false; } Cat cat = (Cat) o; - return Objects.equals(this.declawed, cat.declawed) && super.equals(o); + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); } @Override @@ -64,6 +80,7 @@ public int hashCode() { return Objects.hash(declawed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -75,7 +92,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -83,4 +101,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java index a7e4beaad66a..3e7b991436aa 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -3,50 +3,63 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * CatAllOf + */ +@JsonPropertyOrder({ + CatAllOf.JSON_PROPERTY_DECLAWED +}) -/** CatAllOf */ -@JsonPropertyOrder({CatAllOf.JSON_PROPERTY_DECLAWED}) public class CatAllOf { public static final String JSON_PROPERTY_DECLAWED = "declawed"; private Boolean declawed; - public CatAllOf declawed(Boolean declawed) { + public CatAllOf declawed(Boolean declawed) { + this.declawed = declawed; return this; } - /** + /** * Get declawed - * * @return declawed - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DECLAWED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeclawed() { return declawed; } + public void setDeclawed(Boolean declawed) { this.declawed = declawed; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,6 +77,7 @@ public int hashCode() { return Objects.hash(declawed); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -74,7 +88,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -82,4 +97,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java index 617b395ecfab..868ba8750742 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Category.java @@ -3,23 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) -/** Category */ -@JsonPropertyOrder({Category.JSON_PROPERTY_ID, Category.JSON_PROPERTY_NAME}) public class Category { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -27,51 +38,56 @@ public class Category { public static final String JSON_PROPERTY_NAME = "name"; private String name = "default-name"; - public Category id(Long id) { + public Category id(Long id) { + this.id = id; return this; } - /** + /** * Get id - * * @return id - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } - public Category name(String name) { + public Category name(String name) { + this.name = name; return this; } - /** + /** * Get name - * * @return name - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { return name; } + public void setName(String name) { this.name = name; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -81,7 +97,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && Objects.equals(this.name, category.name); + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); } @Override @@ -89,6 +106,7 @@ public int hashCode() { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -100,7 +118,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -108,4 +127,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java index 13bf74694c85..4de7664b26a7 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ClassModel.java @@ -3,52 +3,64 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Model for testing model with \"_class\" property */ +/** + * Model for testing model with \"_class\" property + */ @ApiModel(description = "Model for testing model with \"_class\" property") -@JsonPropertyOrder({ClassModel.JSON_PROPERTY_PROPERTY_CLASS}) +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) + public class ClassModel { public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; private String propertyClass; - public ClassModel propertyClass(String propertyClass) { + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; return this; } - /** + /** * Get propertyClass - * * @return propertyClass - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPropertyClass() { return propertyClass; } + public void setPropertyClass(String propertyClass) { this.propertyClass = propertyClass; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -66,6 +78,7 @@ public int hashCode() { return Objects.hash(propertyClass); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -76,7 +89,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -84,4 +98,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java index 8aeda7b92c70..02b0aac2247a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Client.java @@ -3,50 +3,63 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) -/** Client */ -@JsonPropertyOrder({Client.JSON_PROPERTY_CLIENT}) public class Client { public static final String JSON_PROPERTY_CLIENT = "client"; private String client; - public Client client(String client) { + public Client client(String client) { + this.client = client; return this; } - /** + /** * Get client - * * @return client - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CLIENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getClient() { return client; } + public void setClient(String client) { this.client = client; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,6 +77,7 @@ public int hashCode() { return Objects.hash(client); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -74,7 +88,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -82,4 +97,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java index 7c8b535861c8..78044654d500 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Dog.java @@ -3,50 +3,65 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.DogAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) -/** Dog */ -@JsonPropertyOrder({Dog.JSON_PROPERTY_BREED}) public class Dog extends Animal { public static final String JSON_PROPERTY_BREED = "breed"; private String breed; - public Dog breed(String breed) { + public Dog breed(String breed) { + this.breed = breed; return this; } - /** + /** * Get breed - * * @return breed - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BREED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBreed() { return breed; } + public void setBreed(String breed) { this.breed = breed; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -56,7 +71,8 @@ public boolean equals(java.lang.Object o) { return false; } Dog dog = (Dog) o; - return Objects.equals(this.breed, dog.breed) && super.equals(o); + return Objects.equals(this.breed, dog.breed) && + super.equals(o); } @Override @@ -64,6 +80,7 @@ public int hashCode() { return Objects.hash(breed, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -75,7 +92,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -83,4 +101,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java index d474f9b5b1b6..dd42595cf202 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -3,50 +3,63 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * DogAllOf + */ +@JsonPropertyOrder({ + DogAllOf.JSON_PROPERTY_BREED +}) -/** DogAllOf */ -@JsonPropertyOrder({DogAllOf.JSON_PROPERTY_BREED}) public class DogAllOf { public static final String JSON_PROPERTY_BREED = "breed"; private String breed; - public DogAllOf breed(String breed) { + public DogAllOf breed(String breed) { + this.breed = breed; return this; } - /** + /** * Get breed - * * @return breed - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BREED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBreed() { return breed; } + public void setBreed(String breed) { this.breed = breed; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,6 +77,7 @@ public int hashCode() { return Objects.hash(breed); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -74,7 +88,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -82,4 +97,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java index 8e72331cc30b..aff182cd4983 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -3,32 +3,43 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; 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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) -/** EnumArrays */ -@JsonPropertyOrder({EnumArrays.JSON_PROPERTY_JUST_SYMBOL, EnumArrays.JSON_PROPERTY_ARRAY_ENUM}) public class EnumArrays { - /** Gets or Sets justSymbol */ + /** + * Gets or Sets justSymbol + */ public enum JustSymbolEnum { GREATER_THAN_OR_EQUAL_TO(">="), - + DOLLAR("$"); private String value; @@ -61,10 +72,12 @@ public static JustSymbolEnum fromValue(String value) { public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; private JustSymbolEnum justSymbol; - /** Gets or Sets arrayEnum */ + /** + * Gets or Sets arrayEnum + */ public enum ArrayEnumEnum { FISH("fish"), - + CRAB("crab"); private String value; @@ -97,31 +110,34 @@ public static ArrayEnumEnum fromValue(String value) { public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; private List<ArrayEnumEnum> arrayEnum = null; - public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; return this; } - /** + /** * Get justSymbol - * * @return justSymbol - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JustSymbolEnum getJustSymbol() { return justSymbol; } + public void setJustSymbol(JustSymbolEnum justSymbol) { this.justSymbol = justSymbol; } - public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) { + public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) { + this.arrayEnum = arrayEnum; return this; } @@ -134,23 +150,25 @@ public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { return this; } - /** + /** * Get arrayEnum - * * @return arrayEnum - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<ArrayEnumEnum> getArrayEnum() { return arrayEnum; } + public void setArrayEnum(List<ArrayEnumEnum> arrayEnum) { this.arrayEnum = arrayEnum; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -160,8 +178,8 @@ public boolean equals(java.lang.Object o) { return false; } EnumArrays enumArrays = (EnumArrays) o; - return Objects.equals(this.justSymbol, enumArrays.justSymbol) - && Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); } @Override @@ -169,6 +187,7 @@ public int hashCode() { return Objects.hash(justSymbol, arrayEnum); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -180,7 +199,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -188,4 +208,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java index f1f1c4348c94..e9102d974276 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumClass.java @@ -3,25 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Gets or Sets EnumClass */ +/** + * Gets or Sets EnumClass + */ public enum EnumClass { + _ABC("_abc"), - + _EFG("-efg"), - + _XYZ_("(xyz)"); private String value; @@ -50,3 +57,4 @@ public static EnumClass fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java index f58b5a2d335d..cf6d574a5f97 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/EnumTest.java @@ -3,26 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import com.fasterxml.jackson.annotation.JsonIgnore; import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** EnumTest */ +/** + * EnumTest + */ @JsonPropertyOrder({ EnumTest.JSON_PROPERTY_ENUM_STRING, EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, @@ -33,13 +43,16 @@ EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE }) + public class EnumTest { - /** Gets or Sets enumString */ + /** + * Gets or Sets enumString + */ public enum EnumStringEnum { UPPER("UPPER"), - + LOWER("lower"), - + EMPTY(""); private String value; @@ -72,12 +85,14 @@ public static EnumStringEnum fromValue(String value) { public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; private EnumStringEnum enumString; - /** Gets or Sets enumStringRequired */ + /** + * Gets or Sets enumStringRequired + */ public enum EnumStringRequiredEnum { UPPER("UPPER"), - + LOWER("lower"), - + EMPTY(""); private String value; @@ -110,10 +125,12 @@ public static EnumStringRequiredEnum fromValue(String value) { public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; private EnumStringRequiredEnum enumStringRequired; - /** Gets or Sets enumInteger */ + /** + * Gets or Sets enumInteger + */ public enum EnumIntegerEnum { NUMBER_1(1), - + NUMBER_MINUS_1(-1); private Integer value; @@ -146,10 +163,12 @@ public static EnumIntegerEnum fromValue(Integer value) { public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; private EnumIntegerEnum enumInteger; - /** Gets or Sets enumNumber */ + /** + * Gets or Sets enumNumber + */ public enum EnumNumberEnum { NUMBER_1_DOT_1(1.1), - + NUMBER_MINUS_1_DOT_2(-1.2); private Double value; @@ -191,126 +210,134 @@ public static EnumNumberEnum fromValue(Double value) { public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; - public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = - "outerEnumIntegerDefaultValue"; - private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = - OuterEnumIntegerDefaultValue.NUMBER_0; + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; - public EnumTest enumString(EnumStringEnum enumString) { + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; return this; } - /** + /** * Get enumString - * * @return enumString - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ENUM_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumStringEnum getEnumString() { return enumString; } + public void setEnumString(EnumStringEnum enumString) { this.enumString = enumString; } - public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; return this; } - /** + /** * Get enumStringRequired - * * @return enumStringRequired - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { this.enumStringRequired = enumStringRequired; } - public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; return this; } - /** + /** * Get enumInteger - * * @return enumInteger - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumIntegerEnum getEnumInteger() { return enumInteger; } + public void setEnumInteger(EnumIntegerEnum enumInteger) { this.enumInteger = enumInteger; } - public EnumTest enumNumber(EnumNumberEnum enumNumber) { + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; return this; } - /** + /** * Get enumNumber - * * @return enumNumber - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumNumberEnum getEnumNumber() { return enumNumber; } + public void setEnumNumber(EnumNumberEnum enumNumber) { this.enumNumber = enumNumber; } + public EnumTest outerEnum(OuterEnum outerEnum) { this.outerEnum = JsonNullable.<OuterEnum>of(outerEnum); - + return this; } - /** + /** * Get outerEnum - * * @return outerEnum - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public OuterEnum getOuterEnum() { - return outerEnum.orElse(null); + return outerEnum.orElse(null); } @JsonProperty(JSON_PROPERTY_OUTER_ENUM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<OuterEnum> getOuterEnum_JsonNullable() { return outerEnum; } - + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) public void setOuterEnum_JsonNullable(JsonNullable<OuterEnum> outerEnum) { this.outerEnum = outerEnum; @@ -320,77 +347,82 @@ public void setOuterEnum(OuterEnum outerEnum) { this.outerEnum = JsonNullable.<OuterEnum>of(outerEnum); } - public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; return this; } - /** + /** * Get outerEnumInteger - * * @return outerEnumInteger - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnumInteger getOuterEnumInteger() { return outerEnumInteger; } + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { this.outerEnumInteger = outerEnumInteger; } - public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; return this; } - /** + /** * Get outerEnumDefaultValue - * * @return outerEnumDefaultValue - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnumDefaultValue getOuterEnumDefaultValue() { return outerEnumDefaultValue; } + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { this.outerEnumDefaultValue = outerEnumDefaultValue; } - public EnumTest outerEnumIntegerDefaultValue( - OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; return this; } - /** + /** * Get outerEnumIntegerDefaultValue - * * @return outerEnumIntegerDefaultValue - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { return outerEnumIntegerDefaultValue; } - public void setOuterEnumIntegerDefaultValue( - OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -400,29 +432,22 @@ public boolean equals(java.lang.Object o) { return false; } EnumTest enumTest = (EnumTest) o; - return Objects.equals(this.enumString, enumTest.enumString) - && Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) - && Objects.equals(this.enumInteger, enumTest.enumInteger) - && Objects.equals(this.enumNumber, enumTest.enumNumber) - && Objects.equals(this.outerEnum, enumTest.outerEnum) - && Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) - && Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) - && Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); } @Override public int hashCode() { - return Objects.hash( - enumString, - enumStringRequired, - enumInteger, - enumNumber, - outerEnum, - outerEnumInteger, - outerEnumDefaultValue, - outerEnumIntegerDefaultValue); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -433,18 +458,15 @@ public String toString() { sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); - sb.append(" outerEnumDefaultValue: ") - .append(toIndentedString(outerEnumDefaultValue)) - .append("\n"); - sb.append(" outerEnumIntegerDefaultValue: ") - .append(toIndentedString(outerEnumIntegerDefaultValue)) - .append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -452,4 +474,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index e596551a7714..8166597792d0 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -3,28 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** FileSchemaTestClass */ +/** + * FileSchemaTestClass + */ @JsonPropertyOrder({ FileSchemaTestClass.JSON_PROPERTY_FILE, FileSchemaTestClass.JSON_PROPERTY_FILES }) + public class FileSchemaTestClass { public static final String JSON_PROPERTY_FILE = "file"; private java.io.File file; @@ -32,31 +40,34 @@ public class FileSchemaTestClass { public static final String JSON_PROPERTY_FILES = "files"; private List<java.io.File> files = null; - public FileSchemaTestClass file(java.io.File file) { + public FileSchemaTestClass file(java.io.File file) { + this.file = file; return this; } - /** + /** * Get file - * * @return file - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public java.io.File getFile() { return file; } + public void setFile(java.io.File file) { this.file = file; } - public FileSchemaTestClass files(List<java.io.File> files) { + public FileSchemaTestClass files(List<java.io.File> files) { + this.files = files; return this; } @@ -69,23 +80,25 @@ public FileSchemaTestClass addFilesItem(java.io.File filesItem) { return this; } - /** + /** * Get files - * * @return files - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<java.io.File> getFiles() { return files; } + public void setFiles(List<java.io.File> files) { this.files = files; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -95,8 +108,8 @@ public boolean equals(java.lang.Object o) { return false; } FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; - return Objects.equals(this.file, fileSchemaTestClass.file) - && Objects.equals(this.files, fileSchemaTestClass.files); + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); } @Override @@ -104,6 +117,7 @@ public int hashCode() { return Objects.hash(file, files); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -115,7 +129,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -123,4 +138,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java index 8dddfe49d020..e531ce87dbf2 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Foo.java @@ -3,50 +3,63 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Foo + */ +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) -/** Foo */ -@JsonPropertyOrder({Foo.JSON_PROPERTY_BAR}) public class Foo { public static final String JSON_PROPERTY_BAR = "bar"; private String bar = "bar"; - public Foo bar(String bar) { + public Foo bar(String bar) { + this.bar = bar; return this; } - /** + /** * Get bar - * * @return bar - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBar() { return bar; } + public void setBar(String bar) { this.bar = bar; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,6 +77,7 @@ public int hashCode() { return Objects.hash(bar); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -74,7 +88,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -82,4 +97,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java index bbecfc092727..35cfcebf4346 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/FormatTest.java @@ -3,28 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Objects; import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** FormatTest */ +/** + * FormatTest + */ @JsonPropertyOrder({ FormatTest.JSON_PROPERTY_INTEGER, FormatTest.JSON_PROPERTY_INT32, @@ -42,6 +48,7 @@ FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER }) + public class FormatTest { public static final String JSON_PROPERTY_INTEGER = "integer"; private Integer integer; @@ -85,354 +92,391 @@ public class FormatTest { public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; private String patternWithDigits; - public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = - "pattern_with_digits_and_delimiter"; + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; private String patternWithDigitsAndDelimiter; - public FormatTest integer(Integer integer) { + public FormatTest integer(Integer integer) { + this.integer = integer; return this; } - /** - * Get integer minimum: 10 maximum: 100 - * + /** + * Get integer + * minimum: 10 + * maximum: 100 * @return integer - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInteger() { return integer; } + public void setInteger(Integer integer) { this.integer = integer; } - public FormatTest int32(Integer int32) { + public FormatTest int32(Integer int32) { + this.int32 = int32; return this; } - /** - * Get int32 minimum: 20 maximum: 200 - * + /** + * Get int32 + * minimum: 20 + * maximum: 200 * @return int32 - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INT32) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInt32() { return int32; } + public void setInt32(Integer int32) { this.int32 = int32; } - public FormatTest int64(Long int64) { + public FormatTest int64(Long int64) { + this.int64 = int64; return this; } - /** + /** * Get int64 - * * @return int64 - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INT64) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getInt64() { return int64; } + public void setInt64(Long int64) { this.int64 = int64; } - public FormatTest number(BigDecimal number) { + public FormatTest number(BigDecimal number) { + this.number = number; return this; } - /** - * Get number minimum: 32.1 maximum: 543.2 - * + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 * @return number - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_NUMBER) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BigDecimal getNumber() { return number; } + public void setNumber(BigDecimal number) { this.number = number; } - public FormatTest _float(Float _float) { + public FormatTest _float(Float _float) { + this._float = _float; return this; } - /** - * Get _float minimum: 54.3 maximum: 987.6 - * + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 * @return _float - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FLOAT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Float getFloat() { return _float; } + public void setFloat(Float _float) { this._float = _float; } - public FormatTest _double(Double _double) { + public FormatTest _double(Double _double) { + this._double = _double; return this; } - /** - * Get _double minimum: 67.8 maximum: 123.4 - * + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 * @return _double - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DOUBLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getDouble() { return _double; } + public void setDouble(Double _double) { this._double = _double; } - public FormatTest string(String string) { + public FormatTest string(String string) { + this.string = string; return this; } - /** + /** * Get string - * * @return string - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getString() { return string; } + public void setString(String string) { this.string = string; } - public FormatTest _byte(byte[] _byte) { + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; return this; } - /** + /** * Get _byte - * * @return _byte - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_BYTE) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public byte[] getByte() { return _byte; } + public void setByte(byte[] _byte) { this._byte = _byte; } - public FormatTest binary(File binary) { + public FormatTest binary(File binary) { + this.binary = binary; return this; } - /** + /** * Get binary - * * @return binary - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BINARY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getBinary() { return binary; } + public void setBinary(File binary) { this.binary = binary; } - public FormatTest date(LocalDate date) { + public FormatTest date(LocalDate date) { + this.date = date; return this; } - /** + /** * Get date - * * @return date - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_DATE) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LocalDate getDate() { return date; } + public void setDate(LocalDate date) { this.date = date; } - public FormatTest dateTime(OffsetDateTime dateTime) { + public FormatTest dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; return this; } - /** + /** * Get dateTime - * * @return dateTime - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DATE_TIME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDateTime() { return dateTime; } + public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } - public FormatTest uuid(UUID uuid) { + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; return this; } - /** + /** * Get uuid - * * @return uuid - */ + **/ @javax.annotation.Nullable @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") @JsonProperty(JSON_PROPERTY_UUID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getUuid() { return uuid; } + public void setUuid(UUID uuid) { this.uuid = uuid; } - public FormatTest password(String password) { + public FormatTest password(String password) { + this.password = password; return this; } - /** + /** * Get password - * * @return password - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } - public FormatTest patternWithDigits(String patternWithDigits) { + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; return this; } - /** + /** * A string that is a 10 digit number. Can have leading zeros. - * * @return patternWithDigits - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPatternWithDigits() { return patternWithDigits; } + public void setPatternWithDigits(String patternWithDigits) { this.patternWithDigits = patternWithDigits; } - public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; return this; } - /** - * A string starting with 'image_' (case insensitive) and one to three digits following - * i.e. Image_01. - * + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. * @return patternWithDigitsAndDelimiter - */ + **/ @javax.annotation.Nullable - @ApiModelProperty( - value = - "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPatternWithDigitsAndDelimiter() { return patternWithDigitsAndDelimiter; } + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -442,44 +486,29 @@ public boolean equals(java.lang.Object o) { return false; } FormatTest formatTest = (FormatTest) o; - return Objects.equals(this.integer, formatTest.integer) - && Objects.equals(this.int32, formatTest.int32) - && Objects.equals(this.int64, formatTest.int64) - && Objects.equals(this.number, formatTest.number) - && Objects.equals(this._float, formatTest._float) - && Objects.equals(this._double, formatTest._double) - && Objects.equals(this.string, formatTest.string) - && Arrays.equals(this._byte, formatTest._byte) - && Objects.equals(this.binary, formatTest.binary) - && Objects.equals(this.date, formatTest.date) - && Objects.equals(this.dateTime, formatTest.dateTime) - && Objects.equals(this.uuid, formatTest.uuid) - && Objects.equals(this.password, formatTest.password) - && Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) - && Objects.equals( - this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); } @Override public int hashCode() { - return Objects.hash( - integer, - int32, - int64, - number, - _float, - _double, - string, - Arrays.hashCode(_byte), - binary, - date, - dateTime, - uuid, - password, - patternWithDigits, - patternWithDigitsAndDelimiter); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -498,15 +527,14 @@ public String toString() { sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); - sb.append(" patternWithDigitsAndDelimiter: ") - .append(toIndentedString(patternWithDigitsAndDelimiter)) - .append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -514,4 +542,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 24bbe4252c51..0a3f0d464360 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -3,23 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) -/** HasOnlyReadOnly */ -@JsonPropertyOrder({HasOnlyReadOnly.JSON_PROPERTY_BAR, HasOnlyReadOnly.JSON_PROPERTY_FOO}) public class HasOnlyReadOnly { public static final String JSON_PROPERTY_BAR = "bar"; private String bar; @@ -27,32 +38,39 @@ public class HasOnlyReadOnly { public static final String JSON_PROPERTY_FOO = "foo"; private String foo; - /** + + /** * Get bar - * * @return bar - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBar() { return bar; } - /** + + + + /** * Get foo - * * @return foo - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FOO) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFoo() { return foo; } + + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -62,8 +80,8 @@ public boolean equals(java.lang.Object o) { return false; } HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; - return Objects.equals(this.bar, hasOnlyReadOnly.bar) - && Objects.equals(this.foo, hasOnlyReadOnly.foo); + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); } @Override @@ -71,6 +89,7 @@ public int hashCode() { return Objects.hash(bar, foo); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -82,7 +101,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -90,4 +110,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java index acaf6793dc26..efb77061df17 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -3,60 +3,67 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnore; import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer - * in generated model. + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. */ -@ApiModel( - description = - "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") -@JsonPropertyOrder({HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE}) +@ApiModel(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) + public class HealthCheckResult { public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; private JsonNullable<String> nullableMessage = JsonNullable.<String>undefined(); + public HealthCheckResult nullableMessage(String nullableMessage) { this.nullableMessage = JsonNullable.<String>of(nullableMessage); - + return this; } - /** + /** * Get nullableMessage - * * @return nullableMessage - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public String getNullableMessage() { - return nullableMessage.orElse(null); + return nullableMessage.orElse(null); } @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<String> getNullableMessage_JsonNullable() { return nullableMessage; } - + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) public void setNullableMessage_JsonNullable(JsonNullable<String> nullableMessage) { this.nullableMessage = nullableMessage; @@ -66,6 +73,7 @@ public void setNullableMessage(String nullableMessage) { this.nullableMessage = JsonNullable.<String>of(nullableMessage); } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -83,6 +91,7 @@ public int hashCode() { return Objects.hash(nullableMessage); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -93,7 +102,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -101,4 +111,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java index 1141c6634853..bb0804c5240e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject.java @@ -3,23 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject + */ +@JsonPropertyOrder({ + InlineObject.JSON_PROPERTY_NAME, + InlineObject.JSON_PROPERTY_STATUS +}) -/** InlineObject */ -@JsonPropertyOrder({InlineObject.JSON_PROPERTY_NAME, InlineObject.JSON_PROPERTY_STATUS}) public class InlineObject { public static final String JSON_PROPERTY_NAME = "name"; private String name; @@ -27,52 +38,57 @@ public class InlineObject { public static final String JSON_PROPERTY_STATUS = "status"; private String status; - public InlineObject name(String name) { + public InlineObject name(String name) { + this.name = name; return this; } - /** + /** * Updated name of the pet - * * @return name - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Updated name of the pet") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { return name; } + public void setName(String name) { this.name = name; } - public InlineObject status(String status) { + public InlineObject status(String status) { + this.status = status; return this; } - /** + /** * Updated status of the pet - * * @return status - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Updated status of the pet") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,8 +98,8 @@ public boolean equals(java.lang.Object o) { return false; } InlineObject inlineObject = (InlineObject) o; - return Objects.equals(this.name, inlineObject.name) - && Objects.equals(this.status, inlineObject.status); + return Objects.equals(this.name, inlineObject.name) && + Objects.equals(this.status, inlineObject.status); } @Override @@ -91,6 +107,7 @@ public int hashCode() { return Objects.hash(name, status); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -102,7 +119,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -110,4 +128,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java index 2bf1fade373c..99b98f4c848e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject1.java @@ -3,27 +3,35 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.File; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** InlineObject1 */ +/** + * InlineObject1 + */ @JsonPropertyOrder({ InlineObject1.JSON_PROPERTY_ADDITIONAL_METADATA, InlineObject1.JSON_PROPERTY_FILE }) + public class InlineObject1 { public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; private String additionalMetadata; @@ -31,52 +39,57 @@ public class InlineObject1 { public static final String JSON_PROPERTY_FILE = "file"; private File file; - public InlineObject1 additionalMetadata(String additionalMetadata) { + public InlineObject1 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; return this; } - /** + /** * Additional data to pass to server - * * @return additionalMetadata - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Additional data to pass to server") @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAdditionalMetadata() { return additionalMetadata; } + public void setAdditionalMetadata(String additionalMetadata) { this.additionalMetadata = additionalMetadata; } - public InlineObject1 file(File file) { + public InlineObject1 file(File file) { + this.file = file; return this; } - /** + /** * file to upload - * * @return file - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "file to upload") @JsonProperty(JSON_PROPERTY_FILE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getFile() { return file; } + public void setFile(File file) { this.file = file; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -86,8 +99,8 @@ public boolean equals(java.lang.Object o) { return false; } InlineObject1 inlineObject1 = (InlineObject1) o; - return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) - && Objects.equals(this.file, inlineObject1.file); + return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) && + Objects.equals(this.file, inlineObject1.file); } @Override @@ -95,6 +108,7 @@ public int hashCode() { return Objects.hash(additionalMetadata, file); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -106,7 +120,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -114,4 +129,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java index 92639fccaeff..e3031fbd564e 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject2.java @@ -3,35 +3,43 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; 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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** InlineObject2 */ +/** + * InlineObject2 + */ @JsonPropertyOrder({ InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING_ARRAY, InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING }) + public class InlineObject2 { - /** Gets or Sets enumFormStringArray */ + /** + * Gets or Sets enumFormStringArray + */ public enum EnumFormStringArrayEnum { GREATER_THAN(">"), - + DOLLAR("$"); private String value; @@ -64,12 +72,14 @@ public static EnumFormStringArrayEnum fromValue(String value) { public static final String JSON_PROPERTY_ENUM_FORM_STRING_ARRAY = "enum_form_string_array"; private List<EnumFormStringArrayEnum> enumFormStringArray = null; - /** Form parameter enum test (string) */ + /** + * Form parameter enum test (string) + */ public enum EnumFormStringEnum { _ABC("_abc"), - + _EFG("-efg"), - + _XYZ_("(xyz)"); private String value; @@ -102,8 +112,9 @@ public static EnumFormStringEnum fromValue(String value) { public static final String JSON_PROPERTY_ENUM_FORM_STRING = "enum_form_string"; private EnumFormStringEnum enumFormString = EnumFormStringEnum._EFG; - public InlineObject2 enumFormStringArray(List<EnumFormStringArrayEnum> enumFormStringArray) { + public InlineObject2 enumFormStringArray(List<EnumFormStringArrayEnum> enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; return this; } @@ -116,46 +127,50 @@ public InlineObject2 addEnumFormStringArrayItem(EnumFormStringArrayEnum enumForm return this; } - /** + /** * Form parameter enum test (string array) - * * @return enumFormStringArray - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Form parameter enum test (string array)") @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<EnumFormStringArrayEnum> getEnumFormStringArray() { return enumFormStringArray; } + public void setEnumFormStringArray(List<EnumFormStringArrayEnum> enumFormStringArray) { this.enumFormStringArray = enumFormStringArray; } - public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; return this; } - /** + /** * Form parameter enum test (string) - * * @return enumFormString - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Form parameter enum test (string)") @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EnumFormStringEnum getEnumFormString() { return enumFormString; } + public void setEnumFormString(EnumFormStringEnum enumFormString) { this.enumFormString = enumFormString; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -165,8 +180,8 @@ public boolean equals(java.lang.Object o) { return false; } InlineObject2 inlineObject2 = (InlineObject2) o; - return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) - && Objects.equals(this.enumFormString, inlineObject2.enumFormString); + return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) && + Objects.equals(this.enumFormString, inlineObject2.enumFormString); } @Override @@ -174,20 +189,20 @@ public int hashCode() { return Objects.hash(enumFormStringArray, enumFormString); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InlineObject2 {\n"); - sb.append(" enumFormStringArray: ") - .append(toIndentedString(enumFormStringArray)) - .append("\n"); + sb.append(" enumFormStringArray: ").append(toIndentedString(enumFormStringArray)).append("\n"); sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -195,4 +210,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java index e95a6cbf369d..29978813614f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject3.java @@ -3,27 +3,33 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.File; import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Objects; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** InlineObject3 */ +/** + * InlineObject3 + */ @JsonPropertyOrder({ InlineObject3.JSON_PROPERTY_INTEGER, InlineObject3.JSON_PROPERTY_INT32, @@ -40,6 +46,7 @@ InlineObject3.JSON_PROPERTY_PASSWORD, InlineObject3.JSON_PROPERTY_CALLBACK }) + public class InlineObject3 { public static final String JSON_PROPERTY_INTEGER = "integer"; private Integer integer; @@ -83,324 +90,362 @@ public class InlineObject3 { public static final String JSON_PROPERTY_CALLBACK = "callback"; private String callback; - public InlineObject3 integer(Integer integer) { + public InlineObject3 integer(Integer integer) { + this.integer = integer; return this; } - /** - * None minimum: 10 maximum: 100 - * + /** + * None + * minimum: 10 + * maximum: 100 * @return integer - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInteger() { return integer; } + public void setInteger(Integer integer) { this.integer = integer; } - public InlineObject3 int32(Integer int32) { + public InlineObject3 int32(Integer int32) { + this.int32 = int32; return this; } - /** - * None minimum: 20 maximum: 200 - * + /** + * None + * minimum: 20 + * maximum: 200 * @return int32 - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_INT32) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getInt32() { return int32; } + public void setInt32(Integer int32) { this.int32 = int32; } - public InlineObject3 int64(Long int64) { + public InlineObject3 int64(Long int64) { + this.int64 = int64; return this; } - /** + /** * None - * * @return int64 - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_INT64) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getInt64() { return int64; } + public void setInt64(Long int64) { this.int64 = int64; } - public InlineObject3 number(BigDecimal number) { + public InlineObject3 number(BigDecimal number) { + this.number = number; return this; } - /** - * None minimum: 32.1 maximum: 543.2 - * + /** + * None + * minimum: 32.1 + * maximum: 543.2 * @return number - */ + **/ @ApiModelProperty(required = true, value = "None") @JsonProperty(JSON_PROPERTY_NUMBER) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BigDecimal getNumber() { return number; } + public void setNumber(BigDecimal number) { this.number = number; } - public InlineObject3 _float(Float _float) { + public InlineObject3 _float(Float _float) { + this._float = _float; return this; } - /** - * None maximum: 987.6 - * + /** + * None + * maximum: 987.6 * @return _float - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_FLOAT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Float getFloat() { return _float; } + public void setFloat(Float _float) { this._float = _float; } - public InlineObject3 _double(Double _double) { + public InlineObject3 _double(Double _double) { + this._double = _double; return this; } - /** - * None minimum: 67.8 maximum: 123.4 - * + /** + * None + * minimum: 67.8 + * maximum: 123.4 * @return _double - */ + **/ @ApiModelProperty(required = true, value = "None") @JsonProperty(JSON_PROPERTY_DOUBLE) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getDouble() { return _double; } + public void setDouble(Double _double) { this._double = _double; } - public InlineObject3 string(String string) { + public InlineObject3 string(String string) { + this.string = string; return this; } - /** + /** * None - * * @return string - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getString() { return string; } + public void setString(String string) { this.string = string; } - public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; return this; } - /** + /** * None - * * @return patternWithoutDelimiter - */ + **/ @ApiModelProperty(required = true, value = "None") @JsonProperty(JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPatternWithoutDelimiter() { return patternWithoutDelimiter; } + public void setPatternWithoutDelimiter(String patternWithoutDelimiter) { this.patternWithoutDelimiter = patternWithoutDelimiter; } - public InlineObject3 _byte(byte[] _byte) { + public InlineObject3 _byte(byte[] _byte) { + this._byte = _byte; return this; } - /** + /** * None - * * @return _byte - */ + **/ @ApiModelProperty(required = true, value = "None") @JsonProperty(JSON_PROPERTY_BYTE) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public byte[] getByte() { return _byte; } + public void setByte(byte[] _byte) { this._byte = _byte; } - public InlineObject3 binary(File binary) { + public InlineObject3 binary(File binary) { + this.binary = binary; return this; } - /** + /** * None - * * @return binary - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_BINARY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public File getBinary() { return binary; } + public void setBinary(File binary) { this.binary = binary; } - public InlineObject3 date(LocalDate date) { + public InlineObject3 date(LocalDate date) { + this.date = date; return this; } - /** + /** * None - * * @return date - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LocalDate getDate() { return date; } + public void setDate(LocalDate date) { this.date = date; } - public InlineObject3 dateTime(OffsetDateTime dateTime) { + public InlineObject3 dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; return this; } - /** + /** * None - * * @return dateTime - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_DATE_TIME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDateTime() { return dateTime; } + public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } - public InlineObject3 password(String password) { + public InlineObject3 password(String password) { + this.password = password; return this; } - /** + /** * None - * * @return password - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } - public InlineObject3 callback(String callback) { + public InlineObject3 callback(String callback) { + this.callback = callback; return this; } - /** + /** * None - * * @return callback - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "None") @JsonProperty(JSON_PROPERTY_CALLBACK) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCallback() { return callback; } + public void setCallback(String callback) { this.callback = callback; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -410,41 +455,28 @@ public boolean equals(java.lang.Object o) { return false; } InlineObject3 inlineObject3 = (InlineObject3) o; - return Objects.equals(this.integer, inlineObject3.integer) - && Objects.equals(this.int32, inlineObject3.int32) - && Objects.equals(this.int64, inlineObject3.int64) - && Objects.equals(this.number, inlineObject3.number) - && Objects.equals(this._float, inlineObject3._float) - && Objects.equals(this._double, inlineObject3._double) - && Objects.equals(this.string, inlineObject3.string) - && Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) - && Arrays.equals(this._byte, inlineObject3._byte) - && Objects.equals(this.binary, inlineObject3.binary) - && Objects.equals(this.date, inlineObject3.date) - && Objects.equals(this.dateTime, inlineObject3.dateTime) - && Objects.equals(this.password, inlineObject3.password) - && Objects.equals(this.callback, inlineObject3.callback); + return Objects.equals(this.integer, inlineObject3.integer) && + Objects.equals(this.int32, inlineObject3.int32) && + Objects.equals(this.int64, inlineObject3.int64) && + Objects.equals(this.number, inlineObject3.number) && + Objects.equals(this._float, inlineObject3._float) && + Objects.equals(this._double, inlineObject3._double) && + Objects.equals(this.string, inlineObject3.string) && + Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) && + Arrays.equals(this._byte, inlineObject3._byte) && + Objects.equals(this.binary, inlineObject3.binary) && + Objects.equals(this.date, inlineObject3.date) && + Objects.equals(this.dateTime, inlineObject3.dateTime) && + Objects.equals(this.password, inlineObject3.password) && + Objects.equals(this.callback, inlineObject3.callback); } @Override public int hashCode() { - return Objects.hash( - integer, - int32, - int64, - number, - _float, - _double, - string, - patternWithoutDelimiter, - Arrays.hashCode(_byte), - binary, - date, - dateTime, - password, - callback); + return Objects.hash(integer, int32, int64, number, _float, _double, string, patternWithoutDelimiter, Arrays.hashCode(_byte), binary, date, dateTime, password, callback); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -456,9 +488,7 @@ public String toString() { sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); sb.append(" string: ").append(toIndentedString(string)).append("\n"); - sb.append(" patternWithoutDelimiter: ") - .append(toIndentedString(patternWithoutDelimiter)) - .append("\n"); + sb.append(" patternWithoutDelimiter: ").append(toIndentedString(patternWithoutDelimiter)).append("\n"); sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).append("\n"); @@ -470,7 +500,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -478,4 +509,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java index 8704fc9a4b1b..953ca1d5b2bc 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject4.java @@ -3,23 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject4 + */ +@JsonPropertyOrder({ + InlineObject4.JSON_PROPERTY_PARAM, + InlineObject4.JSON_PROPERTY_PARAM2 +}) -/** InlineObject4 */ -@JsonPropertyOrder({InlineObject4.JSON_PROPERTY_PARAM, InlineObject4.JSON_PROPERTY_PARAM2}) public class InlineObject4 { public static final String JSON_PROPERTY_PARAM = "param"; private String param; @@ -27,50 +38,55 @@ public class InlineObject4 { public static final String JSON_PROPERTY_PARAM2 = "param2"; private String param2; - public InlineObject4 param(String param) { + public InlineObject4 param(String param) { + this.param = param; return this; } - /** + /** * field1 - * * @return param - */ + **/ @ApiModelProperty(required = true, value = "field1") @JsonProperty(JSON_PROPERTY_PARAM) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getParam() { return param; } + public void setParam(String param) { this.param = param; } - public InlineObject4 param2(String param2) { + public InlineObject4 param2(String param2) { + this.param2 = param2; return this; } - /** + /** * field2 - * * @return param2 - */ + **/ @ApiModelProperty(required = true, value = "field2") @JsonProperty(JSON_PROPERTY_PARAM2) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getParam2() { return param2; } + public void setParam2(String param2) { this.param2 = param2; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -80,8 +96,8 @@ public boolean equals(java.lang.Object o) { return false; } InlineObject4 inlineObject4 = (InlineObject4) o; - return Objects.equals(this.param, inlineObject4.param) - && Objects.equals(this.param2, inlineObject4.param2); + return Objects.equals(this.param, inlineObject4.param) && + Objects.equals(this.param2, inlineObject4.param2); } @Override @@ -89,6 +105,7 @@ public int hashCode() { return Objects.hash(param, param2); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -100,7 +117,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -108,4 +126,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java index d5426d00c120..1b079adfcf91 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineObject5.java @@ -3,27 +3,35 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.File; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** InlineObject5 */ +/** + * InlineObject5 + */ @JsonPropertyOrder({ InlineObject5.JSON_PROPERTY_ADDITIONAL_METADATA, InlineObject5.JSON_PROPERTY_REQUIRED_FILE }) + public class InlineObject5 { public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; private String additionalMetadata; @@ -31,51 +39,56 @@ public class InlineObject5 { public static final String JSON_PROPERTY_REQUIRED_FILE = "requiredFile"; private File requiredFile; - public InlineObject5 additionalMetadata(String additionalMetadata) { + public InlineObject5 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; return this; } - /** + /** * Additional data to pass to server - * * @return additionalMetadata - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Additional data to pass to server") @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAdditionalMetadata() { return additionalMetadata; } + public void setAdditionalMetadata(String additionalMetadata) { this.additionalMetadata = additionalMetadata; } - public InlineObject5 requiredFile(File requiredFile) { + public InlineObject5 requiredFile(File requiredFile) { + this.requiredFile = requiredFile; return this; } - /** + /** * file to upload - * * @return requiredFile - */ + **/ @ApiModelProperty(required = true, value = "file to upload") @JsonProperty(JSON_PROPERTY_REQUIRED_FILE) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public File getRequiredFile() { return requiredFile; } + public void setRequiredFile(File requiredFile) { this.requiredFile = requiredFile; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -85,8 +98,8 @@ public boolean equals(java.lang.Object o) { return false; } InlineObject5 inlineObject5 = (InlineObject5) o; - return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) - && Objects.equals(this.requiredFile, inlineObject5.requiredFile); + return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) && + Objects.equals(this.requiredFile, inlineObject5.requiredFile); } @Override @@ -94,6 +107,7 @@ public int hashCode() { return Objects.hash(additionalMetadata, requiredFile); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -105,7 +119,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -113,4 +128,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java index f9e010ddc702..6b90bf2a18fa 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/InlineResponseDefault.java @@ -3,50 +3,64 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import org.openapitools.client.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineResponseDefault + */ +@JsonPropertyOrder({ + InlineResponseDefault.JSON_PROPERTY_STRING +}) -/** InlineResponseDefault */ -@JsonPropertyOrder({InlineResponseDefault.JSON_PROPERTY_STRING}) public class InlineResponseDefault { public static final String JSON_PROPERTY_STRING = "string"; private Foo string; - public InlineResponseDefault string(Foo string) { + public InlineResponseDefault string(Foo string) { + this.string = string; return this; } - /** + /** * Get string - * * @return string - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Foo getString() { return string; } + public void setString(Foo string) { this.string = string; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,6 +78,7 @@ public int hashCode() { return Objects.hash(string); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -74,7 +89,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -82,4 +98,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java index d5d3dfe599d7..113f92dd9cbe 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MapTest.java @@ -3,40 +3,49 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; 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 java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** MapTest */ +/** + * MapTest + */ @JsonPropertyOrder({ MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, MapTest.JSON_PROPERTY_DIRECT_MAP, MapTest.JSON_PROPERTY_INDIRECT_MAP }) + public class MapTest { public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; private Map<String, Map<String, String>> mapMapOfString = null; - /** Gets or Sets inner */ + /** + * Gets or Sets inner + */ public enum InnerEnum { UPPER("UPPER"), - + LOWER("lower"); private String value; @@ -75,8 +84,9 @@ public static InnerEnum fromValue(String value) { public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; private Map<String, Boolean> indirectMap = null; - public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) { + public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) { + this.mapMapOfString = mapMapOfString; return this; } @@ -89,25 +99,27 @@ public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStr return this; } - /** + /** * Get mapMapOfString - * * @return mapMapOfString - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Map<String, String>> getMapMapOfString() { return mapMapOfString; } + public void setMapMapOfString(Map<String, Map<String, String>> mapMapOfString) { this.mapMapOfString = mapMapOfString; } - public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { + public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; return this; } @@ -120,25 +132,27 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) return this; } - /** + /** * Get mapOfEnumString - * * @return mapOfEnumString - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, InnerEnum> getMapOfEnumString() { return mapOfEnumString; } + public void setMapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { this.mapOfEnumString = mapOfEnumString; } - public MapTest directMap(Map<String, Boolean> directMap) { + public MapTest directMap(Map<String, Boolean> directMap) { + this.directMap = directMap; return this; } @@ -151,25 +165,27 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { return this; } - /** + /** * Get directMap - * * @return directMap - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DIRECT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Boolean> getDirectMap() { return directMap; } + public void setDirectMap(Map<String, Boolean> directMap) { this.directMap = directMap; } - public MapTest indirectMap(Map<String, Boolean> indirectMap) { + public MapTest indirectMap(Map<String, Boolean> indirectMap) { + this.indirectMap = indirectMap; return this; } @@ -182,23 +198,25 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { return this; } - /** + /** * Get indirectMap - * * @return indirectMap - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Boolean> getIndirectMap() { return indirectMap; } + public void setIndirectMap(Map<String, Boolean> indirectMap) { this.indirectMap = indirectMap; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -208,10 +226,10 @@ public boolean equals(java.lang.Object o) { return false; } MapTest mapTest = (MapTest) o; - return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) - && Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) - && Objects.equals(this.directMap, mapTest.directMap) - && Objects.equals(this.indirectMap, mapTest.indirectMap); + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); } @Override @@ -219,6 +237,7 @@ public int hashCode() { return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -232,7 +251,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -240,4 +260,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 9a30d1299f9f..d483d69700f8 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -3,31 +3,41 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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 java.util.Objects; import java.util.UUID; +import org.openapitools.client.model.Animal; import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** MixedPropertiesAndAdditionalPropertiesClass */ +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ @JsonPropertyOrder({ MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP }) + public class MixedPropertiesAndAdditionalPropertiesClass { public static final String JSON_PROPERTY_UUID = "uuid"; private UUID uuid; @@ -38,54 +48,59 @@ public class MixedPropertiesAndAdditionalPropertiesClass { public static final String JSON_PROPERTY_MAP = "map"; private Map<String, Animal> map = null; - public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; return this; } - /** + /** * Get uuid - * * @return uuid - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_UUID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getUuid() { return uuid; } + public void setUuid(UUID uuid) { this.uuid = uuid; } - public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; return this; } - /** + /** * Get dateTime - * * @return dateTime - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DATE_TIME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDateTime() { return dateTime; } + public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } - public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) { + public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) { + this.map = map; return this; } @@ -98,23 +113,25 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal return this; } - /** + /** * Get map - * * @return map - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Animal> getMap() { return map; } + public void setMap(Map<String, Animal> map) { this.map = map; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -123,11 +140,10 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = - (MixedPropertiesAndAdditionalPropertiesClass) o; - return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) - && Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) - && Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); } @Override @@ -135,6 +151,7 @@ public int hashCode() { return Objects.hash(uuid, dateTime, map); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -147,7 +164,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -155,4 +173,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java index b3972c060311..dd99468a0059 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Model200Response.java @@ -3,28 +3,35 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Model for testing model name starting with number */ +/** + * Model for testing model name starting with number + */ @ApiModel(description = "Model for testing model name starting with number") @JsonPropertyOrder({ Model200Response.JSON_PROPERTY_NAME, Model200Response.JSON_PROPERTY_PROPERTY_CLASS }) + public class Model200Response { public static final String JSON_PROPERTY_NAME = "name"; private Integer name; @@ -32,52 +39,57 @@ public class Model200Response { public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; private String propertyClass; - public Model200Response name(Integer name) { + public Model200Response name(Integer name) { + this.name = name; return this; } - /** + /** * Get name - * * @return name - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getName() { return name; } + public void setName(Integer name) { this.name = name; } - public Model200Response propertyClass(String propertyClass) { + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; return this; } - /** + /** * Get propertyClass - * * @return propertyClass - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPropertyClass() { return propertyClass; } + public void setPropertyClass(String propertyClass) { this.propertyClass = propertyClass; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -87,8 +99,8 @@ public boolean equals(java.lang.Object o) { return false; } Model200Response _200response = (Model200Response) o; - return Objects.equals(this.name, _200response.name) - && Objects.equals(this.propertyClass, _200response.propertyClass); + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); } @Override @@ -96,6 +108,7 @@ public int hashCode() { return Objects.hash(name, propertyClass); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -107,7 +120,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -115,4 +129,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2efca6f97bd1..383cafdd3a5a 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -3,27 +3,35 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** ModelApiResponse */ +/** + * ModelApiResponse + */ @JsonPropertyOrder({ ModelApiResponse.JSON_PROPERTY_CODE, ModelApiResponse.JSON_PROPERTY_TYPE, ModelApiResponse.JSON_PROPERTY_MESSAGE }) + public class ModelApiResponse { public static final String JSON_PROPERTY_CODE = "code"; private Integer code; @@ -34,75 +42,82 @@ public class ModelApiResponse { public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; - public ModelApiResponse code(Integer code) { + public ModelApiResponse code(Integer code) { + this.code = code; return this; } - /** + /** * Get code - * * @return code - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getCode() { return code; } + public void setCode(Integer code) { this.code = code; } - public ModelApiResponse type(String type) { + public ModelApiResponse type(String type) { + this.type = type; return this; } - /** + /** * Get type - * * @return type - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { return type; } + public void setType(String type) { this.type = type; } - public ModelApiResponse message(String message) { + public ModelApiResponse message(String message) { + this.message = message; return this; } - /** + /** * Get message - * * @return message - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -112,9 +127,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) - && Objects.equals(this.type, _apiResponse.type) - && Objects.equals(this.message, _apiResponse.message); + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); } @Override @@ -122,6 +137,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -134,7 +150,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -142,4 +159,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java index 374989b521c5..b62e13a90a0c 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -3,52 +3,64 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Model for testing reserved words */ +/** + * Model for testing reserved words + */ @ApiModel(description = "Model for testing reserved words") -@JsonPropertyOrder({ModelReturn.JSON_PROPERTY_RETURN}) +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) + public class ModelReturn { public static final String JSON_PROPERTY_RETURN = "return"; private Integer _return; - public ModelReturn _return(Integer _return) { + public ModelReturn _return(Integer _return) { + this._return = _return; return this; } - /** + /** * Get _return - * * @return _return - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_RETURN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getReturn() { return _return; } + public void setReturn(Integer _return) { this._return = _return; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -66,6 +78,7 @@ public int hashCode() { return Objects.hash(_return); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -76,7 +89,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -84,4 +98,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java index 918eb738e286..bd625c5f66f3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Name.java @@ -3,23 +3,29 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Model for testing model name same as property name */ +/** + * Model for testing model name same as property name + */ @ApiModel(description = "Model for testing model name same as property name") @JsonPropertyOrder({ Name.JSON_PROPERTY_NAME, @@ -27,6 +33,7 @@ Name.JSON_PROPERTY_PROPERTY, Name.JSON_PROPERTY_123NUMBER }) + public class Name { public static final String JSON_PROPERTY_NAME = "name"; private Integer name; @@ -40,77 +47,88 @@ public class Name { public static final String JSON_PROPERTY_123NUMBER = "123Number"; private Integer _123number; - public Name name(Integer name) { + public Name name(Integer name) { + this.name = name; return this; } - /** + /** * Get name - * * @return name - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getName() { return name; } + public void setName(Integer name) { this.name = name; } - /** + + /** * Get snakeCase - * * @return snakeCase - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SNAKE_CASE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getSnakeCase() { return snakeCase; } - public Name property(String property) { + + + public Name property(String property) { + this.property = property; return this; } - /** + /** * Get property - * * @return property - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getProperty() { return property; } + public void setProperty(String property) { this.property = property; } - /** + + /** * Get _123number - * * @return _123number - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_123NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer get123number() { return _123number; } + + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -120,10 +138,10 @@ public boolean equals(java.lang.Object o) { return false; } Name name = (Name) o; - return Objects.equals(this.name, name.name) - && Objects.equals(this.snakeCase, name.snakeCase) - && Objects.equals(this.property, name.property) - && Objects.equals(this._123number, name._123number); + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); } @Override @@ -131,6 +149,7 @@ public int hashCode() { return Objects.hash(name, snakeCase, property, _123number); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -144,7 +163,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -152,4 +172,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java index 1c74f6e2158f..31e6e1b2dd02 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NullableClass.java @@ -3,31 +3,39 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +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.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import org.openapitools.jackson.nullable.JsonNullable; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** NullableClass */ +/** + * NullableClass + */ @JsonPropertyOrder({ NullableClass.JSON_PROPERTY_INTEGER_PROP, NullableClass.JSON_PROPERTY_NUMBER_PROP, @@ -42,6 +50,7 @@ NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE }) + public class NullableClass extends HashMap<String, Object> { public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; private JsonNullable<Integer> integerProp = JsonNullable.<Integer>undefined(); @@ -64,50 +73,47 @@ public class NullableClass extends HashMap<String, Object> { public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; private JsonNullable<List<Object>> arrayNullableProp = JsonNullable.<List<Object>>undefined(); - public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = - "array_and_items_nullable_prop"; - private JsonNullable<List<Object>> arrayAndItemsNullableProp = - JsonNullable.<List<Object>>undefined(); + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + private JsonNullable<List<Object>> arrayAndItemsNullableProp = JsonNullable.<List<Object>>undefined(); public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; private List<Object> arrayItemsNullable = null; public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; - private JsonNullable<Map<String, Object>> objectNullableProp = - JsonNullable.<Map<String, Object>>undefined(); + private JsonNullable<Map<String, Object>> objectNullableProp = JsonNullable.<Map<String, Object>>undefined(); - public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = - "object_and_items_nullable_prop"; - private JsonNullable<Map<String, Object>> objectAndItemsNullableProp = - JsonNullable.<Map<String, Object>>undefined(); + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + private JsonNullable<Map<String, Object>> objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>undefined(); public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; private Map<String, Object> objectItemsNullable = null; + public NullableClass integerProp(Integer integerProp) { this.integerProp = JsonNullable.<Integer>of(integerProp); - + return this; } - /** + /** * Get integerProp - * * @return integerProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public Integer getIntegerProp() { - return integerProp.orElse(null); + return integerProp.orElse(null); } @JsonProperty(JSON_PROPERTY_INTEGER_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Integer> getIntegerProp_JsonNullable() { return integerProp; } - + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) public void setIntegerProp_JsonNullable(JsonNullable<Integer> integerProp) { this.integerProp = integerProp; @@ -117,30 +123,32 @@ public void setIntegerProp(Integer integerProp) { this.integerProp = JsonNullable.<Integer>of(integerProp); } + public NullableClass numberProp(BigDecimal numberProp) { this.numberProp = JsonNullable.<BigDecimal>of(numberProp); - + return this; } - /** + /** * Get numberProp - * * @return numberProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public BigDecimal getNumberProp() { - return numberProp.orElse(null); + return numberProp.orElse(null); } @JsonProperty(JSON_PROPERTY_NUMBER_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<BigDecimal> getNumberProp_JsonNullable() { return numberProp; } - + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) public void setNumberProp_JsonNullable(JsonNullable<BigDecimal> numberProp) { this.numberProp = numberProp; @@ -150,30 +158,32 @@ public void setNumberProp(BigDecimal numberProp) { this.numberProp = JsonNullable.<BigDecimal>of(numberProp); } + public NullableClass booleanProp(Boolean booleanProp) { this.booleanProp = JsonNullable.<Boolean>of(booleanProp); - + return this; } - /** + /** * Get booleanProp - * * @return booleanProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public Boolean getBooleanProp() { - return booleanProp.orElse(null); + return booleanProp.orElse(null); } @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Boolean> getBooleanProp_JsonNullable() { return booleanProp; } - + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) public void setBooleanProp_JsonNullable(JsonNullable<Boolean> booleanProp) { this.booleanProp = booleanProp; @@ -183,30 +193,32 @@ public void setBooleanProp(Boolean booleanProp) { this.booleanProp = JsonNullable.<Boolean>of(booleanProp); } + public NullableClass stringProp(String stringProp) { this.stringProp = JsonNullable.<String>of(stringProp); - + return this; } - /** + /** * Get stringProp - * * @return stringProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public String getStringProp() { - return stringProp.orElse(null); + return stringProp.orElse(null); } @JsonProperty(JSON_PROPERTY_STRING_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<String> getStringProp_JsonNullable() { return stringProp; } - + @JsonProperty(JSON_PROPERTY_STRING_PROP) public void setStringProp_JsonNullable(JsonNullable<String> stringProp) { this.stringProp = stringProp; @@ -216,30 +228,32 @@ public void setStringProp(String stringProp) { this.stringProp = JsonNullable.<String>of(stringProp); } + public NullableClass dateProp(LocalDate dateProp) { this.dateProp = JsonNullable.<LocalDate>of(dateProp); - + return this; } - /** + /** * Get dateProp - * * @return dateProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public LocalDate getDateProp() { - return dateProp.orElse(null); + return dateProp.orElse(null); } @JsonProperty(JSON_PROPERTY_DATE_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<LocalDate> getDateProp_JsonNullable() { return dateProp; } - + @JsonProperty(JSON_PROPERTY_DATE_PROP) public void setDateProp_JsonNullable(JsonNullable<LocalDate> dateProp) { this.dateProp = dateProp; @@ -249,30 +263,32 @@ public void setDateProp(LocalDate dateProp) { this.dateProp = JsonNullable.<LocalDate>of(dateProp); } + public NullableClass datetimeProp(OffsetDateTime datetimeProp) { this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp); - + return this; } - /** + /** * Get datetimeProp - * * @return datetimeProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public OffsetDateTime getDatetimeProp() { - return datetimeProp.orElse(null); + return datetimeProp.orElse(null); } @JsonProperty(JSON_PROPERTY_DATETIME_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<OffsetDateTime> getDatetimeProp_JsonNullable() { return datetimeProp; } - + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) public void setDatetimeProp_JsonNullable(JsonNullable<OffsetDateTime> datetimeProp) { this.datetimeProp = datetimeProp; @@ -282,9 +298,10 @@ public void setDatetimeProp(OffsetDateTime datetimeProp) { this.datetimeProp = JsonNullable.<OffsetDateTime>of(datetimeProp); } + public NullableClass arrayNullableProp(List<Object> arrayNullableProp) { this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp); - + return this; } @@ -300,24 +317,25 @@ public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { return this; } - /** + /** * Get arrayNullableProp - * * @return arrayNullableProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public List<Object> getArrayNullableProp() { - return arrayNullableProp.orElse(null); + return arrayNullableProp.orElse(null); } @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<List<Object>> getArrayNullableProp_JsonNullable() { return arrayNullableProp; } - + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) public void setArrayNullableProp_JsonNullable(JsonNullable<List<Object>> arrayNullableProp) { this.arrayNullableProp = arrayNullableProp; @@ -327,9 +345,10 @@ public void setArrayNullableProp(List<Object> arrayNullableProp) { this.arrayNullableProp = JsonNullable.<List<Object>>of(arrayNullableProp); } + public NullableClass arrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) { this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp); - + return this; } @@ -345,27 +364,27 @@ public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullab return this; } - /** + /** * Get arrayAndItemsNullableProp - * * @return arrayAndItemsNullableProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public List<Object> getArrayAndItemsNullableProp() { - return arrayAndItemsNullableProp.orElse(null); + return arrayAndItemsNullableProp.orElse(null); } @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<List<Object>> getArrayAndItemsNullableProp_JsonNullable() { return arrayAndItemsNullableProp; } - + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) - public void setArrayAndItemsNullableProp_JsonNullable( - JsonNullable<List<Object>> arrayAndItemsNullableProp) { + public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable<List<Object>> arrayAndItemsNullableProp) { this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; } @@ -373,8 +392,9 @@ public void setArrayAndItemsNullableProp(List<Object> arrayAndItemsNullableProp) this.arrayAndItemsNullableProp = JsonNullable.<List<Object>>of(arrayAndItemsNullableProp); } - public NullableClass arrayItemsNullable(List<Object> arrayItemsNullable) { + public NullableClass arrayItemsNullable(List<Object> arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; return this; } @@ -387,26 +407,28 @@ public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { return this; } - /** + /** * Get arrayItemsNullable - * * @return arrayItemsNullable - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<Object> getArrayItemsNullable() { return arrayItemsNullable; } + public void setArrayItemsNullable(List<Object> arrayItemsNullable) { this.arrayItemsNullable = arrayItemsNullable; } + public NullableClass objectNullableProp(Map<String, Object> objectNullableProp) { this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp); - + return this; } @@ -422,27 +444,27 @@ public NullableClass putObjectNullablePropItem(String key, Object objectNullable return this; } - /** + /** * Get objectNullableProp - * * @return objectNullableProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public Map<String, Object> getObjectNullableProp() { - return objectNullableProp.orElse(null); + return objectNullableProp.orElse(null); } @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Map<String, Object>> getObjectNullableProp_JsonNullable() { return objectNullableProp; } - + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) - public void setObjectNullableProp_JsonNullable( - JsonNullable<Map<String, Object>> objectNullableProp) { + public void setObjectNullableProp_JsonNullable(JsonNullable<Map<String, Object>> objectNullableProp) { this.objectNullableProp = objectNullableProp; } @@ -450,18 +472,16 @@ public void setObjectNullableProp(Map<String, Object> objectNullableProp) { this.objectNullableProp = JsonNullable.<Map<String, Object>>of(objectNullableProp); } - public NullableClass objectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) { - this.objectAndItemsNullableProp = - JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp); + public NullableClass objectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp); + return this; } - public NullableClass putObjectAndItemsNullablePropItem( - String key, Object objectAndItemsNullablePropItem) { + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { - this.objectAndItemsNullableProp = - JsonNullable.<Map<String, Object>>of(new HashMap<String, Object>()); + this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(new HashMap<String, Object>()); } try { this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); @@ -471,37 +491,37 @@ public NullableClass putObjectAndItemsNullablePropItem( return this; } - /** + /** * Get objectAndItemsNullableProp - * * @return objectAndItemsNullableProp - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonIgnore + public Map<String, Object> getObjectAndItemsNullableProp() { - return objectAndItemsNullableProp.orElse(null); + return objectAndItemsNullableProp.orElse(null); } @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable<Map<String, Object>> getObjectAndItemsNullableProp_JsonNullable() { return objectAndItemsNullableProp; } - + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) - public void setObjectAndItemsNullableProp_JsonNullable( - JsonNullable<Map<String, Object>> objectAndItemsNullableProp) { + public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable<Map<String, Object>> objectAndItemsNullableProp) { this.objectAndItemsNullableProp = objectAndItemsNullableProp; } public void setObjectAndItemsNullableProp(Map<String, Object> objectAndItemsNullableProp) { - this.objectAndItemsNullableProp = - JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp); + this.objectAndItemsNullableProp = JsonNullable.<Map<String, Object>>of(objectAndItemsNullableProp); } - public NullableClass objectItemsNullable(Map<String, Object> objectItemsNullable) { + public NullableClass objectItemsNullable(Map<String, Object> objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; return this; } @@ -514,23 +534,25 @@ public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNu return this; } - /** + /** * Get objectItemsNullable - * * @return objectItemsNullable - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + public Map<String, Object> getObjectItemsNullable() { return objectItemsNullable; } + public void setObjectItemsNullable(Map<String, Object> objectItemsNullable) { this.objectItemsNullable = objectItemsNullable; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -540,39 +562,27 @@ public boolean equals(java.lang.Object o) { return false; } NullableClass nullableClass = (NullableClass) o; - return Objects.equals(this.integerProp, nullableClass.integerProp) - && Objects.equals(this.numberProp, nullableClass.numberProp) - && Objects.equals(this.booleanProp, nullableClass.booleanProp) - && Objects.equals(this.stringProp, nullableClass.stringProp) - && Objects.equals(this.dateProp, nullableClass.dateProp) - && Objects.equals(this.datetimeProp, nullableClass.datetimeProp) - && Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) - && Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) - && Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) - && Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) - && Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) - && Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) - && super.equals(o); + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); } @Override public int hashCode() { - return Objects.hash( - integerProp, - numberProp, - booleanProp, - stringProp, - dateProp, - datetimeProp, - arrayNullableProp, - arrayAndItemsNullableProp, - arrayItemsNullable, - objectNullableProp, - objectAndItemsNullableProp, - objectItemsNullable, - super.hashCode()); + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -585,23 +595,18 @@ public String toString() { sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); - sb.append(" arrayAndItemsNullableProp: ") - .append(toIndentedString(arrayAndItemsNullableProp)) - .append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); - sb.append(" objectAndItemsNullableProp: ") - .append(toIndentedString(objectAndItemsNullableProp)) - .append("\n"); - sb.append(" objectItemsNullable: ") - .append(toIndentedString(objectItemsNullable)) - .append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -609,4 +614,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java index 04ea549f07c4..5ca72a169fe8 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -3,51 +3,64 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) -/** NumberOnly */ -@JsonPropertyOrder({NumberOnly.JSON_PROPERTY_JUST_NUMBER}) public class NumberOnly { public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; private BigDecimal justNumber; - public NumberOnly justNumber(BigDecimal justNumber) { + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; return this; } - /** + /** * Get justNumber - * * @return justNumber - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_JUST_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getJustNumber() { return justNumber; } + public void setJustNumber(BigDecimal justNumber) { this.justNumber = justNumber; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -65,6 +78,7 @@ public int hashCode() { return Objects.hash(justNumber); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -75,7 +89,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -83,4 +98,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java index b78b7482b4e3..6e2816302162 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Order.java @@ -3,25 +3,30 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; import org.threeten.bp.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Order */ +/** + * Order + */ @JsonPropertyOrder({ Order.JSON_PROPERTY_ID, Order.JSON_PROPERTY_PET_ID, @@ -30,6 +35,7 @@ Order.JSON_PROPERTY_STATUS, Order.JSON_PROPERTY_COMPLETE }) + public class Order { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -43,12 +49,14 @@ public class Order { public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; private OffsetDateTime shipDate; - /** Order Status */ + /** + * Order Status + */ public enum StatusEnum { PLACED("placed"), - + APPROVED("approved"), - + DELIVERED("delivered"); private String value; @@ -84,144 +92,157 @@ public static StatusEnum fromValue(String value) { public static final String JSON_PROPERTY_COMPLETE = "complete"; private Boolean complete = false; - public Order id(Long id) { + public Order id(Long id) { + this.id = id; return this; } - /** + /** * Get id - * * @return id - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } - public Order petId(Long petId) { + public Order petId(Long petId) { + this.petId = petId; return this; } - /** + /** * Get petId - * * @return petId - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getPetId() { return petId; } + public void setPetId(Long petId) { this.petId = petId; } - public Order quantity(Integer quantity) { + public Order quantity(Integer quantity) { + this.quantity = quantity; return this; } - /** + /** * Get quantity - * * @return quantity - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getQuantity() { return quantity; } + public void setQuantity(Integer quantity) { this.quantity = quantity; } - public Order shipDate(OffsetDateTime shipDate) { + public Order shipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; return this; } - /** + /** * Get shipDate - * * @return shipDate - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getShipDate() { return shipDate; } + public void setShipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; } - public Order status(StatusEnum status) { + public Order status(StatusEnum status) { + this.status = status; return this; } - /** + /** * Order Status - * * @return status - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { return status; } + public void setStatus(StatusEnum status) { this.status = status; } - public Order complete(Boolean complete) { + public Order complete(Boolean complete) { + this.complete = complete; return this; } - /** + /** * Get complete - * * @return complete - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getComplete() { return complete; } + public void setComplete(Boolean complete) { this.complete = complete; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -231,12 +252,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) - && Objects.equals(this.petId, order.petId) - && Objects.equals(this.quantity, order.quantity) - && Objects.equals(this.shipDate, order.shipDate) - && Objects.equals(this.status, order.status) - && Objects.equals(this.complete, order.complete); + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); } @Override @@ -244,6 +265,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -259,7 +281,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -267,4 +290,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java index 1fd74d7906f4..d4d9ac6ba110 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -3,28 +3,36 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** OuterComposite */ +/** + * OuterComposite + */ @JsonPropertyOrder({ OuterComposite.JSON_PROPERTY_MY_NUMBER, OuterComposite.JSON_PROPERTY_MY_STRING, OuterComposite.JSON_PROPERTY_MY_BOOLEAN }) + public class OuterComposite { public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; private BigDecimal myNumber; @@ -35,75 +43,82 @@ public class OuterComposite { public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; private Boolean myBoolean; - public OuterComposite myNumber(BigDecimal myNumber) { + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; return this; } - /** + /** * Get myNumber - * * @return myNumber - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public BigDecimal getMyNumber() { return myNumber; } + public void setMyNumber(BigDecimal myNumber) { this.myNumber = myNumber; } - public OuterComposite myString(String myString) { + public OuterComposite myString(String myString) { + this.myString = myString; return this; } - /** + /** * Get myString - * * @return myString - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMyString() { return myString; } + public void setMyString(String myString) { this.myString = myString; } - public OuterComposite myBoolean(Boolean myBoolean) { + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; return this; } - /** + /** * Get myBoolean - * * @return myBoolean - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getMyBoolean() { return myBoolean; } + public void setMyBoolean(Boolean myBoolean) { this.myBoolean = myBoolean; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -113,9 +128,9 @@ public boolean equals(java.lang.Object o) { return false; } OuterComposite outerComposite = (OuterComposite) o; - return Objects.equals(this.myNumber, outerComposite.myNumber) - && Objects.equals(this.myString, outerComposite.myString) - && Objects.equals(this.myBoolean, outerComposite.myBoolean); + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); } @Override @@ -123,6 +138,7 @@ public int hashCode() { return Objects.hash(myNumber, myString, myBoolean); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -135,7 +151,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -143,4 +160,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java index 6d7255bbe62c..d0c0bc3c9d20 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -3,25 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Gets or Sets OuterEnum */ +/** + * Gets or Sets OuterEnum + */ public enum OuterEnum { + PLACED("placed"), - + APPROVED("approved"), - + DELIVERED("delivered"); private String value; @@ -50,3 +57,4 @@ public static OuterEnum fromValue(String value) { return null; } } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java index 109be684331b..7f6c2c73aa24 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -3,25 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Gets or Sets OuterEnumDefaultValue */ +/** + * Gets or Sets OuterEnumDefaultValue + */ public enum OuterEnumDefaultValue { + PLACED("placed"), - + APPROVED("approved"), - + DELIVERED("delivered"); private String value; @@ -50,3 +57,4 @@ public static OuterEnumDefaultValue fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java index 277107e01030..c747a2e6daef 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -3,25 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Gets or Sets OuterEnumInteger */ +/** + * Gets or Sets OuterEnumInteger + */ public enum OuterEnumInteger { + NUMBER_0(0), - + NUMBER_1(1), - + NUMBER_2(2); private Integer value; @@ -50,3 +57,4 @@ public static OuterEnumInteger fromValue(Integer value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java index 91c11e7b4aa0..4f5fcd1cd95f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -3,25 +3,32 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Gets or Sets OuterEnumIntegerDefaultValue */ +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ public enum OuterEnumIntegerDefaultValue { + NUMBER_0(0), - + NUMBER_1(1), - + NUMBER_2(2); private Integer value; @@ -50,3 +57,4 @@ public static OuterEnumIntegerDefaultValue fromValue(Integer value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java index 7690da073c12..be74dd5ca081 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Pet.java @@ -3,26 +3,33 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; -import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; 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 java.util.Objects; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** Pet */ +/** + * Pet + */ @JsonPropertyOrder({ Pet.JSON_PROPERTY_ID, Pet.JSON_PROPERTY_CATEGORY, @@ -31,6 +38,7 @@ Pet.JSON_PROPERTY_TAGS, Pet.JSON_PROPERTY_STATUS }) + public class Pet { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -47,12 +55,14 @@ public class Pet { public static final String JSON_PROPERTY_TAGS = "tags"; private List<Tag> tags = null; - /** pet status in the store */ + /** + * pet status in the store + */ public enum StatusEnum { AVAILABLE("available"), - + PENDING("pending"), - + SOLD("sold"); private String value; @@ -85,76 +95,83 @@ public static StatusEnum fromValue(String value) { public static final String JSON_PROPERTY_STATUS = "status"; private StatusEnum status; - public Pet id(Long id) { + public Pet id(Long id) { + this.id = id; return this; } - /** + /** * Get id - * * @return id - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } - public Pet category(Category category) { + public Pet category(Category category) { + this.category = category; return this; } - /** + /** * Get category - * * @return category - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Category getCategory() { return category; } + public void setCategory(Category category) { this.category = category; } - public Pet name(String name) { + public Pet name(String name) { + this.name = name; return this; } - /** + /** * Get name - * * @return name - */ + **/ @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { return name; } + public void setName(String name) { this.name = name; } - public Pet photoUrls(List<String> photoUrls) { + public Pet photoUrls(List<String> photoUrls) { + this.photoUrls = photoUrls; return this; } @@ -164,24 +181,26 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) { return this; } - /** + /** * Get photoUrls - * * @return photoUrls - */ + **/ @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List<String> getPhotoUrls() { return photoUrls; } + public void setPhotoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; } - public Pet tags(List<Tag> tags) { + public Pet tags(List<Tag> tags) { + this.tags = tags; return this; } @@ -194,46 +213,50 @@ public Pet addTagsItem(Tag tagsItem) { return this; } - /** + /** * Get tags - * * @return tags - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List<Tag> getTags() { return tags; } + public void setTags(List<Tag> tags) { this.tags = tags; } - public Pet status(StatusEnum status) { + public Pet status(StatusEnum status) { + this.status = status; return this; } - /** + /** * pet status in the store - * * @return status - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public StatusEnum getStatus() { return status; } + public void setStatus(StatusEnum status) { this.status = status; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -243,12 +266,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) - && Objects.equals(this.category, pet.category) - && Objects.equals(this.name, pet.name) - && Objects.equals(this.photoUrls, pet.photoUrls) - && Objects.equals(this.tags, pet.tags) - && Objects.equals(this.status, pet.status); + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); } @Override @@ -256,6 +279,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -271,7 +295,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -279,4 +304,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 11ad89b4d018..b3e58ef3d2c5 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -3,23 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) -/** ReadOnlyFirst */ -@JsonPropertyOrder({ReadOnlyFirst.JSON_PROPERTY_BAR, ReadOnlyFirst.JSON_PROPERTY_BAZ}) public class ReadOnlyFirst { public static final String JSON_PROPERTY_BAR = "bar"; private String bar; @@ -27,42 +38,48 @@ public class ReadOnlyFirst { public static final String JSON_PROPERTY_BAZ = "baz"; private String baz; - /** + + /** * Get bar - * * @return bar - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBar() { return bar; } - public ReadOnlyFirst baz(String baz) { + + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; return this; } - /** + /** * Get baz - * * @return baz - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_BAZ) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getBaz() { return baz; } + public void setBaz(String baz) { this.baz = baz; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -72,8 +89,8 @@ public boolean equals(java.lang.Object o) { return false; } ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; - return Objects.equals(this.bar, readOnlyFirst.bar) - && Objects.equals(this.baz, readOnlyFirst.baz); + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); } @Override @@ -81,6 +98,7 @@ public int hashCode() { return Objects.hash(bar, baz); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -92,7 +110,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -100,4 +119,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java index 2749ec0c7b4f..b588ef95226b 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -3,50 +3,63 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) -/** SpecialModelName */ -@JsonPropertyOrder({SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME}) public class SpecialModelName { public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; private Long $specialPropertyName; - public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; return this; } - /** + /** * Get $specialPropertyName - * * @return $specialPropertyName - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long get$SpecialPropertyName() { return $specialPropertyName; } + public void set$SpecialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -64,19 +77,19 @@ public int hashCode() { return Objects.hash($specialPropertyName); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SpecialModelName {\n"); - sb.append(" $specialPropertyName: ") - .append(toIndentedString($specialPropertyName)) - .append("\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); sb.append("}"); return sb.toString(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -84,4 +97,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java index f2155a9a7e7f..a3ecb398faa3 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/Tag.java @@ -3,23 +3,34 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) -/** Tag */ -@JsonPropertyOrder({Tag.JSON_PROPERTY_ID, Tag.JSON_PROPERTY_NAME}) public class Tag { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -27,52 +38,57 @@ public class Tag { public static final String JSON_PROPERTY_NAME = "name"; private String name; - public Tag id(Long id) { + public Tag id(Long id) { + this.id = id; return this; } - /** + /** * Get id - * * @return id - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } - public Tag name(String name) { + public Tag name(String name) { + this.name = name; return this; } - /** + /** * Get name - * * @return name - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { return name; } + public void setName(String name) { this.name = name; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -82,7 +98,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && Objects.equals(this.name, tag.name); + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); } @Override @@ -90,6 +107,7 @@ public int hashCode() { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -101,7 +119,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -109,4 +128,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java index 637c9625657f..b7e74643dab2 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2-experimental/src/main/java/org/openapitools/client/model/User.java @@ -3,22 +3,29 @@ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * The version of the OpenAPI document: 1.0.0 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + package org.openapitools.client.model; +import java.util.Objects; +import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; -/** User */ +/** + * User + */ @JsonPropertyOrder({ User.JSON_PROPERTY_ID, User.JSON_PROPERTY_USERNAME, @@ -29,6 +36,7 @@ User.JSON_PROPERTY_PHONE, User.JSON_PROPERTY_USER_STATUS }) + public class User { public static final String JSON_PROPERTY_ID = "id"; private Long id; @@ -54,190 +62,207 @@ public class User { public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; private Integer userStatus; - public User id(Long id) { + public User id(Long id) { + this.id = id; return this; } - /** + /** * Get id - * * @return id - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } - public User username(String username) { + public User username(String username) { + this.username = username; return this; } - /** + /** * Get username - * * @return username - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } - public User firstName(String firstName) { + public User firstName(String firstName) { + this.firstName = firstName; return this; } - /** + /** * Get firstName - * * @return firstName - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } - public User lastName(String lastName) { + public User lastName(String lastName) { + this.lastName = lastName; return this; } - /** + /** * Get lastName - * * @return lastName - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } - public User email(String email) { + public User email(String email) { + this.email = email; return this; } - /** + /** * Get email - * * @return email - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } - public User password(String password) { + public User password(String password) { + this.password = password; return this; } - /** + /** * Get password - * * @return password - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } - public User phone(String phone) { + public User phone(String phone) { + this.phone = phone; return this; } - /** + /** * Get phone - * * @return phone - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPhone() { return phone; } + public void setPhone(String phone) { this.phone = phone; } - public User userStatus(Integer userStatus) { + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; return this; } - /** + /** * User Status - * * @return userStatus - */ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getUserStatus() { return userStatus; } + public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -247,14 +272,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) - && Objects.equals(this.username, user.username) - && Objects.equals(this.firstName, user.firstName) - && Objects.equals(this.lastName, user.lastName) - && Objects.equals(this.email, user.email) - && Objects.equals(this.password, user.password) - && Objects.equals(this.phone, user.phone) - && Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); } @Override @@ -262,6 +287,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -279,7 +305,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { @@ -287,4 +314,6 @@ private String toIndentedString(java.lang.Object o) { } return o.toString().replace("\n", "\n "); } + } + diff --git a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java index 6426c753cad5..2847096c224f 100644 --- a/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/jersey2-experimental/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -70,7 +70,7 @@ public void fakeHttpSignatureTestTest() throws Exception { HttpSignatureAuth auth = (HttpSignatureAuth) client.getAuthentication("http_signature_test"); auth.setAlgorithm(Algorithm.RSA_SHA512); auth.setHeaders(Arrays.asList("(request-target)", "host", "date")); - auth.setup(privateKey); + auth.setPrivateKey(privateKey); Pet pet = new Pet(); pet.setId(10l); From afa66f858bfe296ef24614d7ce534918f4aca251 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Sat, 2 May 2020 08:48:43 -0700 Subject: [PATCH 52/78] fix documentation (#6131) --- .../openapitools/codegen/CodegenModel.java | 21 ++++++++++++++++++- .../openapitools/codegen/DefaultCodegen.java | 10 ++++----- 2 files changed, 25 insertions(+), 6 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 e9d25fd5ca74..f2f0ee97ca39 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 @@ -74,7 +74,26 @@ public class CodegenModel implements IJsonSchemaValidationProperties { public Set<String> allMandatory = new TreeSet<String>(); // with parent's required properties public Set<String> imports = new TreeSet<String>(); - public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, isNullable, hasRequired, hasOptional, isArrayModel, hasChildren, isMapModel, isDeprecated; + public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum; + /** + * Indicates the OAS schema specifies "nullable: true". + */ + public boolean isNullable; + /** + * Indicates the type has at least one required property. + */ + public boolean hasRequired; + /** + * Indicates the type has at least one optional property. + */ + public boolean hasOptional; + public boolean isArrayModel; + public boolean hasChildren; + public boolean isMapModel; + /** + * Indicates the OAS schema specifies "deprecated: true". + */ + public boolean isDeprecated; public boolean hasOnlyReadOnly = true; // true if all properties are read-only public ExternalDocumentation externalDocumentation; 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 71bb39fee086..6394f1ace4cb 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 @@ -2007,7 +2007,7 @@ public String lowerCamelCase(String name) { } /** - * Output the type declaration of a given name + * Output the language-specific type declaration of a given OAS name. * * @param name name * @return a string presentation of the type @@ -2018,15 +2018,15 @@ public String getTypeDeclaration(String name) { } /** - * Output the type declaration of the property + * Output the language-specific type declaration of the property. * * @param schema property schema * @return a string presentation of the property type */ public String getTypeDeclaration(Schema schema) { if (schema == null) { - LOGGER.warn("Null schema found. Default type to `NULL_SCHMEA_ERR`"); - return "NULL_SCHMEA_ERR"; + LOGGER.warn("Null schema found. Default type to `NULL_SCHEMA_ERR`"); + return "NULL_SCHEMA_ERR"; } String oasType = getSchemaType(schema); @@ -2812,7 +2812,7 @@ public String getterAndSetterCapitalize(String name) { * Convert OAS Property object to Codegen Property object * * @param name name of the property - * @param p OAS property object + * @param p OAS property schema * @return Codegen Property object */ public CodegenProperty fromProperty(String name, Schema p) { From 15d58dc89b11d17f52c2daadfae9736e442f3b1a Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Sun, 3 May 2020 00:18:55 +0800 Subject: [PATCH 53/78] Add paladinzh to rust technical committee (#6137) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0e45c2ff4772..c9bec50e1147 100644 --- a/README.md +++ b/README.md @@ -962,8 +962,8 @@ If you want to join the committee, please kindly apply by sending an email to te | PowerShell | | | Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) @slash-arun (2019/11) @spacether (2019/11) | | R | @Ramanth (2019/07) @saigiridhar21 (2019/07) | -| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) | -| Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) @richardwhiuk (2019/07) | +| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) | +| Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) @richardwhiuk (2019/07) @paladinzh (2020/05) | | Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) | | Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) | | TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) | From cd88c06372c5b66b7515bb524504533033d9dc6c Mon Sep 17 00:00:00 2001 From: minenok-tutu <minenok@tutu.ru> Date: Sun, 3 May 2020 07:21:22 +0300 Subject: [PATCH 54/78] File return type fix (#5644) * file return type fix * Update client.mustache --- .../src/main/resources/go/client.mustache | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 78ee276d0f3d..f760f3371133 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -9,6 +9,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "log" "mime/multipart" "net/http" @@ -392,6 +393,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err From c98499454c9f8906159aef18ca2dd936b14dfd93 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Sun, 3 May 2020 12:42:48 +0800 Subject: [PATCH 55/78] update go samples --- samples/client/petstore/go/go-petstore/client.go | 10 ++++++++++ .../openapi3/client/petstore/go/go-petstore/client.go | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 533439041493..19297c80fb8e 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -17,6 +17,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "log" "mime/multipart" "net/http" @@ -381,6 +382,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index 730e67621edf..c33a4967d824 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -17,6 +17,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "log" "mime/multipart" "net/http" @@ -384,6 +385,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err From ec0db2f1ee3487bafb577277ec004a1ce87c3dd5 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Sun, 3 May 2020 14:46:17 +0800 Subject: [PATCH 56/78] Test java 11 native client in drone.ci (#6144) * test java 11 native clientin drone.ci * trigger build failure * Revert "trigger build failure" This reverts commit e52ad39ec1c6508864fd7c3c8513e56a2eef6539. --- CI/.drone.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/CI/.drone.yml b/CI/.drone.yml index ad8bb2fa2d53..fa27e5b67e27 100644 --- a/CI/.drone.yml +++ b/CI/.drone.yml @@ -18,20 +18,14 @@ steps: image: haskell:8.6.5 commands: - (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast) -# below dart tests moved to circle ci -# test Dart 2.x petstore client -#- name: dart2x-test -# image: google/dart -# commands: -# - (cd samples/client/petstore/dart-jaguar/openapi && pub get && pub run build_runner build --delete-conflicting-outputs) -# - (cd samples/client/petstore/dart-jaguar/flutter_petstore/openapi && pub get && pub run build_runner build --delete-conflicting-outputs) -# - (cd samples/client/petstore/dart2/petstore && pub get && pub run test) # test Java 11 HTTP client - name: java11-test image: openjdk:11.0 commands: - ./mvnw -quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error - ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error + # test java native client + - ./mvnw clean test -f samples/client/petstore/java/native/pom.xml # test all generators with fake petstore spec (2.0, 3.0) - /bin/bash bin/utils/test-fake-petstore-for-all.sh # generate test scripts From f4fa00fefa09dce8d302c30391e31215245bbaa1 Mon Sep 17 00:00:00 2001 From: Ukonn Ra <16066720+UkonnRa@users.noreply.github.com> Date: Sun, 3 May 2020 16:06:18 +0800 Subject: [PATCH 57/78] Add async native Java Client (#4721) * Add async native Java Client * UPDATE: Reformat the samples * test java native async in drone.io * update test count Co-authored-by: William Cheng <wing328hk@gmail.com> --- CI/.drone.yml | 1 + bin/java-petstore-native-async.sh | 35 + .../codegen/languages/JavaClientCodegen.java | 9 + .../Java/libraries/native/api.mustache | 76 +- .../codegen/java/JavaClientCodegenTest.java | 39 + .../petstore/java/native-async/.gitignore | 21 + .../native-async/.openapi-generator-ignore | 23 + .../native-async/.openapi-generator/VERSION | 1 + .../petstore/java/native-async/.travis.yml | 16 + .../petstore/java/native-async/README.md | 238 ++ .../java/native-async/api/openapi.yaml | 2183 +++++++++++++++++ .../petstore/java/native-async/build.gradle | 66 + .../petstore/java/native-async/build.sbt | 1 + .../docs/AdditionalPropertiesAnyType.md | 12 + .../docs/AdditionalPropertiesArray.md | 12 + .../docs/AdditionalPropertiesBoolean.md | 12 + .../docs/AdditionalPropertiesClass.md | 22 + .../docs/AdditionalPropertiesInteger.md | 12 + .../docs/AdditionalPropertiesNumber.md | 12 + .../docs/AdditionalPropertiesObject.md | 12 + .../docs/AdditionalPropertiesString.md | 12 + .../petstore/java/native-async/docs/Animal.md | 13 + .../java/native-async/docs/AnotherFakeApi.md | 74 + .../docs/ArrayOfArrayOfNumberOnly.md | 12 + .../native-async/docs/ArrayOfNumberOnly.md | 12 + .../java/native-async/docs/ArrayTest.md | 14 + .../petstore/java/native-async/docs/BigCat.md | 23 + .../java/native-async/docs/BigCatAllOf.md | 23 + .../java/native-async/docs/Capitalization.md | 17 + .../petstore/java/native-async/docs/Cat.md | 12 + .../java/native-async/docs/CatAllOf.md | 12 + .../java/native-async/docs/Category.md | 13 + .../java/native-async/docs/ClassModel.md | 13 + .../petstore/java/native-async/docs/Client.md | 12 + .../petstore/java/native-async/docs/Dog.md | 12 + .../java/native-async/docs/DogAllOf.md | 12 + .../java/native-async/docs/EnumArrays.md | 31 + .../java/native-async/docs/EnumClass.md | 15 + .../java/native-async/docs/EnumTest.md | 54 + .../java/native-async/docs/FakeApi.md | 987 ++++++++ .../docs/FakeClassnameTags123Api.md | 81 + .../native-async/docs/FileSchemaTestClass.md | 13 + .../java/native-async/docs/FormatTest.md | 25 + .../java/native-async/docs/HasOnlyReadOnly.md | 13 + .../java/native-async/docs/MapTest.md | 24 + ...dPropertiesAndAdditionalPropertiesClass.md | 14 + .../native-async/docs/Model200Response.md | 14 + .../native-async/docs/ModelApiResponse.md | 14 + .../java/native-async/docs/ModelReturn.md | 13 + .../petstore/java/native-async/docs/Name.md | 16 + .../java/native-async/docs/NumberOnly.md | 12 + .../petstore/java/native-async/docs/Order.md | 27 + .../java/native-async/docs/OuterComposite.md | 14 + .../java/native-async/docs/OuterEnum.md | 15 + .../petstore/java/native-async/docs/Pet.md | 27 + .../petstore/java/native-async/docs/PetApi.md | 656 +++++ .../java/native-async/docs/ReadOnlyFirst.md | 13 + .../native-async/docs/SpecialModelName.md | 12 + .../java/native-async/docs/StoreApi.md | 276 +++ .../petstore/java/native-async/docs/Tag.md | 13 + .../native-async/docs/TypeHolderDefault.md | 16 + .../native-async/docs/TypeHolderExample.md | 17 + .../petstore/java/native-async/docs/User.md | 19 + .../java/native-async/docs/UserApi.md | 525 ++++ .../java/native-async/docs/XmlItem.md | 40 + .../petstore/java/native-async/git_push.sh | 58 + .../java/native-async/gradle.properties | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 58702 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + .../client/petstore/java/native-async/gradlew | 183 ++ .../petstore/java/native-async/gradlew.bat | 100 + .../client/petstore/java/native-async/pom.xml | 214 ++ .../java/native-async/settings.gradle | 1 + .../native-async/src/main/AndroidManifest.xml | 3 + .../org/openapitools/client/ApiClient.java | 358 +++ .../org/openapitools/client/ApiException.java | 90 + .../openapitools/client/Configuration.java | 39 + .../java/org/openapitools/client/Pair.java | 61 + .../client/ServerConfiguration.java | 58 + .../openapitools/client/ServerVariable.java | 23 + .../client/api/AnotherFakeApi.java | 112 + .../org/openapitools/client/api/FakeApi.java | 844 +++++++ .../client/api/FakeClassnameTags123Api.java | 112 + .../org/openapitools/client/api/PetApi.java | 507 ++++ .../org/openapitools/client/api/StoreApi.java | 240 ++ .../org/openapitools/client/api/UserApi.java | 450 ++++ .../model/AdditionalPropertiesAnyType.java | 106 + .../model/AdditionalPropertiesArray.java | 107 + .../model/AdditionalPropertiesBoolean.java | 106 + .../model/AdditionalPropertiesClass.java | 480 ++++ .../model/AdditionalPropertiesInteger.java | 106 + .../model/AdditionalPropertiesNumber.java | 107 + .../model/AdditionalPropertiesObject.java | 106 + .../model/AdditionalPropertiesString.java | 106 + .../org/openapitools/client/model/Animal.java | 141 ++ .../model/ArrayOfArrayOfNumberOnly.java | 113 + .../client/model/ArrayOfNumberOnly.java | 113 + .../openapitools/client/model/ArrayTest.java | 191 ++ .../org/openapitools/client/model/BigCat.java | 145 ++ .../client/model/BigCatAllOf.java | 141 ++ .../client/model/Capitalization.java | 257 ++ .../org/openapitools/client/model/Cat.java | 106 + .../openapitools/client/model/CatAllOf.java | 102 + .../openapitools/client/model/Category.java | 132 + .../openapitools/client/model/ClassModel.java | 103 + .../org/openapitools/client/model/Client.java | 102 + .../org/openapitools/client/model/Dog.java | 106 + .../openapitools/client/model/DogAllOf.java | 102 + .../openapitools/client/model/EnumArrays.java | 213 ++ .../openapitools/client/model/EnumClass.java | 60 + .../openapitools/client/model/EnumTest.java | 370 +++ .../client/model/FileSchemaTestClass.java | 143 ++ .../openapitools/client/model/FormatTest.java | 516 ++++ .../client/model/HasOnlyReadOnly.java | 115 + .../openapitools/client/model/MapTest.java | 265 ++ ...ropertiesAndAdditionalPropertiesClass.java | 178 ++ .../client/model/Model200Response.java | 134 + .../client/model/ModelApiResponse.java | 164 ++ .../client/model/ModelReturn.java | 103 + .../org/openapitools/client/model/Name.java | 177 ++ .../openapitools/client/model/NumberOnly.java | 103 + .../org/openapitools/client/model/Order.java | 295 +++ .../client/model/OuterComposite.java | 165 ++ .../openapitools/client/model/OuterEnum.java | 60 + .../org/openapitools/client/model/Pet.java | 309 +++ .../client/model/ReadOnlyFirst.java | 124 + .../client/model/SpecialModelName.java | 102 + .../org/openapitools/client/model/Tag.java | 133 + .../client/model/TypeHolderDefault.java | 229 ++ .../client/model/TypeHolderExample.java | 259 ++ .../org/openapitools/client/model/User.java | 319 +++ .../openapitools/client/model/XmlItem.java | 1045 ++++++++ .../client/api/AnotherFakeApiTest.java | 51 + .../openapitools/client/api/FakeApiTest.java | 322 +++ .../api/FakeClassnameTags123ApiTest.java | 51 + .../openapitools/client/api/PetApiTest.java | 191 ++ .../openapitools/client/api/StoreApiTest.java | 98 + .../openapitools/client/api/UserApiTest.java | 162 ++ .../AdditionalPropertiesAnyTypeTest.java | 51 + .../model/AdditionalPropertiesArrayTest.java | 52 + .../AdditionalPropertiesBooleanTest.java | 51 + .../model/AdditionalPropertiesClassTest.java | 133 + .../AdditionalPropertiesIntegerTest.java | 51 + .../model/AdditionalPropertiesNumberTest.java | 52 + .../model/AdditionalPropertiesObjectTest.java | 51 + .../model/AdditionalPropertiesStringTest.java | 51 + .../openapitools/client/model/AnimalTest.java | 59 + .../model/ArrayOfArrayOfNumberOnlyTest.java | 52 + .../client/model/ArrayOfNumberOnlyTest.java | 52 + .../client/model/ArrayTestTest.java | 68 + .../client/model/BigCatAllOfTest.java | 49 + .../openapitools/client/model/BigCatTest.java | 75 + .../client/model/CapitalizationTest.java | 89 + .../client/model/CatAllOfTest.java | 49 + .../openapitools/client/model/CatTest.java | 67 + .../client/model/CategoryTest.java | 57 + .../client/model/ClassModelTest.java | 49 + .../openapitools/client/model/ClientTest.java | 49 + .../client/model/DogAllOfTest.java | 49 + .../openapitools/client/model/DogTest.java | 67 + .../client/model/EnumArraysTest.java | 59 + .../client/model/EnumClassTest.java | 33 + .../client/model/EnumTestTest.java | 82 + .../client/model/FileSchemaTestClassTest.java | 59 + .../client/model/FormatTestTest.java | 158 ++ .../client/model/HasOnlyReadOnlyTest.java | 57 + .../client/model/MapTestTest.java | 76 + ...rtiesAndAdditionalPropertiesClassTest.java | 71 + .../client/model/Model200ResponseTest.java | 57 + .../client/model/ModelApiResponseTest.java | 65 + .../client/model/ModelReturnTest.java | 49 + .../openapitools/client/model/NameTest.java | 73 + .../client/model/NumberOnlyTest.java | 50 + .../openapitools/client/model/OrderTest.java | 90 + .../client/model/OuterCompositeTest.java | 66 + .../client/model/OuterEnumTest.java | 33 + .../openapitools/client/model/PetTest.java | 93 + .../client/model/ReadOnlyFirstTest.java | 57 + .../client/model/SpecialModelNameTest.java | 49 + .../openapitools/client/model/TagTest.java | 57 + .../client/model/TypeHolderDefaultTest.java | 84 + .../client/model/TypeHolderExampleTest.java | 92 + .../openapitools/client/model/UserTest.java | 105 + .../client/model/XmlItemTest.java | 276 +++ .../client/api/AnotherFakeApi.java | 22 +- .../org/openapitools/client/api/FakeApi.java | 307 ++- .../client/api/FakeClassnameTags123Api.java | 22 +- .../org/openapitools/client/api/PetApi.java | 192 +- .../org/openapitools/client/api/StoreApi.java | 83 +- .../org/openapitools/client/api/UserApi.java | 171 +- 190 files changed, 22661 insertions(+), 427 deletions(-) create mode 100755 bin/java-petstore-native-async.sh create mode 100644 samples/client/petstore/java/native-async/.gitignore create mode 100644 samples/client/petstore/java/native-async/.openapi-generator-ignore create mode 100644 samples/client/petstore/java/native-async/.openapi-generator/VERSION create mode 100644 samples/client/petstore/java/native-async/.travis.yml create mode 100644 samples/client/petstore/java/native-async/README.md create mode 100644 samples/client/petstore/java/native-async/api/openapi.yaml create mode 100644 samples/client/petstore/java/native-async/build.gradle create mode 100644 samples/client/petstore/java/native-async/build.sbt create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesArray.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesBoolean.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesInteger.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesNumber.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesObject.md create mode 100644 samples/client/petstore/java/native-async/docs/AdditionalPropertiesString.md create mode 100644 samples/client/petstore/java/native-async/docs/Animal.md create mode 100644 samples/client/petstore/java/native-async/docs/AnotherFakeApi.md create mode 100644 samples/client/petstore/java/native-async/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/native-async/docs/ArrayOfNumberOnly.md create mode 100644 samples/client/petstore/java/native-async/docs/ArrayTest.md create mode 100644 samples/client/petstore/java/native-async/docs/BigCat.md create mode 100644 samples/client/petstore/java/native-async/docs/BigCatAllOf.md create mode 100644 samples/client/petstore/java/native-async/docs/Capitalization.md create mode 100644 samples/client/petstore/java/native-async/docs/Cat.md create mode 100644 samples/client/petstore/java/native-async/docs/CatAllOf.md create mode 100644 samples/client/petstore/java/native-async/docs/Category.md create mode 100644 samples/client/petstore/java/native-async/docs/ClassModel.md create mode 100644 samples/client/petstore/java/native-async/docs/Client.md create mode 100644 samples/client/petstore/java/native-async/docs/Dog.md create mode 100644 samples/client/petstore/java/native-async/docs/DogAllOf.md create mode 100644 samples/client/petstore/java/native-async/docs/EnumArrays.md create mode 100644 samples/client/petstore/java/native-async/docs/EnumClass.md create mode 100644 samples/client/petstore/java/native-async/docs/EnumTest.md create mode 100644 samples/client/petstore/java/native-async/docs/FakeApi.md create mode 100644 samples/client/petstore/java/native-async/docs/FakeClassnameTags123Api.md create mode 100644 samples/client/petstore/java/native-async/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/native-async/docs/FormatTest.md create mode 100644 samples/client/petstore/java/native-async/docs/HasOnlyReadOnly.md create mode 100644 samples/client/petstore/java/native-async/docs/MapTest.md create mode 100644 samples/client/petstore/java/native-async/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/client/petstore/java/native-async/docs/Model200Response.md create mode 100644 samples/client/petstore/java/native-async/docs/ModelApiResponse.md create mode 100644 samples/client/petstore/java/native-async/docs/ModelReturn.md create mode 100644 samples/client/petstore/java/native-async/docs/Name.md create mode 100644 samples/client/petstore/java/native-async/docs/NumberOnly.md create mode 100644 samples/client/petstore/java/native-async/docs/Order.md create mode 100644 samples/client/petstore/java/native-async/docs/OuterComposite.md create mode 100644 samples/client/petstore/java/native-async/docs/OuterEnum.md create mode 100644 samples/client/petstore/java/native-async/docs/Pet.md create mode 100644 samples/client/petstore/java/native-async/docs/PetApi.md create mode 100644 samples/client/petstore/java/native-async/docs/ReadOnlyFirst.md create mode 100644 samples/client/petstore/java/native-async/docs/SpecialModelName.md create mode 100644 samples/client/petstore/java/native-async/docs/StoreApi.md create mode 100644 samples/client/petstore/java/native-async/docs/Tag.md create mode 100644 samples/client/petstore/java/native-async/docs/TypeHolderDefault.md create mode 100644 samples/client/petstore/java/native-async/docs/TypeHolderExample.md create mode 100644 samples/client/petstore/java/native-async/docs/User.md create mode 100644 samples/client/petstore/java/native-async/docs/UserApi.md create mode 100644 samples/client/petstore/java/native-async/docs/XmlItem.md create mode 100644 samples/client/petstore/java/native-async/git_push.sh create mode 100644 samples/client/petstore/java/native-async/gradle.properties create mode 100644 samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar create mode 100644 samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties create mode 100644 samples/client/petstore/java/native-async/gradlew create mode 100644 samples/client/petstore/java/native-async/gradlew.bat create mode 100644 samples/client/petstore/java/native-async/pom.xml create mode 100644 samples/client/petstore/java/native-async/settings.gradle create mode 100644 samples/client/petstore/java/native-async/src/main/AndroidManifest.xml create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiClient.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiException.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Configuration.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Pair.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerConfiguration.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerVariable.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Animal.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayTest.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCat.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCatAllOf.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Capitalization.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Cat.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/CatAllOf.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Category.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ClassModel.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Client.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Dog.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/DogAllOf.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumArrays.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumClass.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumTest.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FormatTest.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MapTest.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Model200Response.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelApiResponse.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelReturn.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Name.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NumberOnly.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Order.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterComposite.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterEnum.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Pet.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/SpecialModelName.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Tag.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderDefault.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderExample.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/User.java create mode 100644 samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/XmlItem.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeApiTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/PetApiTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/StoreApiTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/UserApiTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AnimalTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayTestTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CapitalizationTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatAllOfTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CategoryTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClassModelTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClientTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogAllOfTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumArraysTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumClassTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumTestTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FormatTestTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MapTestTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/Model200ResponseTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelReturnTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NameTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NumberOnlyTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OrderTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterCompositeTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterEnumTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/PetTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TagTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/UserTest.java create mode 100644 samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/XmlItemTest.java diff --git a/CI/.drone.yml b/CI/.drone.yml index fa27e5b67e27..b65d5d3e720e 100644 --- a/CI/.drone.yml +++ b/CI/.drone.yml @@ -26,6 +26,7 @@ steps: - ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error # test java native client - ./mvnw clean test -f samples/client/petstore/java/native/pom.xml + - ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml # test all generators with fake petstore spec (2.0, 3.0) - /bin/bash bin/utils/test-fake-petstore-for-all.sh # generate test scripts diff --git a/bin/java-petstore-native-async.sh b/bin/java-petstore-native-async.sh new file mode 100755 index 000000000000..d163250beb6d --- /dev/null +++ b/bin/java-petstore-native-async.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/native -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-native.json -o samples/client/petstore/java/native-async --additional-properties hideGenerationTimestamp=true,asyncNative=true $@" + +echo "Removing files and folders under samples/client/petstore/java/httpclient/src/main" +rm -rf samples/client/petstore/java/native-async/src/main +find samples/client/petstore/java/native-async -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags 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 e708b1f7e624..058e68f5aa63 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 @@ -55,6 +55,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String USE_PLAY_WS = "usePlayWS"; public static final String PLAY_VERSION = "playVersion"; public static final String FEIGN_VERSION = "feignVersion"; + public static final String ASYNC_NATIVE = "asyncNative"; public static final String PARCELABLE_MODEL = "parcelableModel"; public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; @@ -95,6 +96,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean usePlayWS = false; protected String playVersion = PLAY_25; protected String feignVersion = FEIGN_10; + protected boolean asyncNative = false; protected boolean parcelableModel = false; protected boolean useBeanValidation = false; protected boolean performBeanValidation = false; @@ -139,6 +141,7 @@ public JavaClientCodegen() { cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Perform BeanValidation")); cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests")); cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception")); + cliOptions.add(CliOption.newBoolean(ASYNC_NATIVE, "If true, async handlers will be used, instead of the sync version")); cliOptions.add(CliOption.newBoolean(FEIGN_VERSION, "Version of OpenFeign: '10.x' (default), '9.x' (deprecated)")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); @@ -249,6 +252,10 @@ public void processOpts() { } additionalProperties.put(FEIGN_VERSION, feignVersion); + if (additionalProperties.containsKey(ASYNC_NATIVE)) { + this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE)); + } + if (additionalProperties.containsKey(PARCELABLE_MODEL)) { this.setParcelableModel(Boolean.valueOf(additionalProperties.get(PARCELABLE_MODEL).toString())); } @@ -850,6 +857,8 @@ public void setFeignVersion(String feignVersion) { this.feignVersion = feignVersion; } + public void setAsyncNative(boolean asyncNative) { this.asyncNative = asyncNative; } + public void setParcelableModel(boolean parcelableModel) { this.parcelableModel = parcelableModel; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index 4c4848ca4803..23388d36a76d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -28,6 +28,10 @@ import java.util.List; import java.util.Map; {{/fullJavaUtil}} +{{#asyncNative}} +import java.util.concurrent.CompletableFuture; +{{/asyncNative}} + {{>generatedAnnotation}} {{#operations}} public class {{classname}} { @@ -73,14 +77,19 @@ public class {{classname}} { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { + public {{#returnType}}{{#asyncNative}}CompletableFuture<{{{returnType}}}>{{/asyncNative}}{{^asyncNative}}{{{returnType}}}{{/asyncNative}}{{/returnType}}{{^returnType}}{{#asyncNative}}CompletableFuture<Void>{{/asyncNative}}{{^asyncNative}}void{{/asyncNative}}{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws ApiException { {{#allParams}} - {{#required}} + {{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { - throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + {{#asyncNative}} + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}")); + {{/asyncNative}} + {{^asyncNative}} + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + {{/asyncNative}} } - {{/required}} + {{/required}} {{/allParams}} HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -122,7 +131,14 @@ public class {{classname}} { {{/bodyParam}} localVarRequestBuilder.header("Accept", "application/json"); + {{^asyncNative}} + try { + {{/asyncNative}} + {{#asyncNative}} + {{#bodyParam}} try { + {{/bodyParam}} + {{/asyncNative}} {{#bodyParam}} byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes({{paramName}}); localVarRequestBuilder.method("{{httpMethod}}", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); @@ -136,29 +152,63 @@ public class {{classname}} { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - + {{^asyncNative}} HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "{{operationId}} call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "{{operationId}} call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - {{#returnType}} return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}); {{/returnType}} + {{/asyncNative}} + {{#asyncNative}} + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "{{operationId}} call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + {{#returnValue}} + memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) + {{/returnValue}} + {{^returnValue}} + null + {{/returnValue}} + ); + } + }); + {{/asyncNative}} + {{#asyncNative}} + {{#bodyParam}} + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + {{/bodyParam}} + {{/asyncNative}} + {{^asyncNative}} } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + {{/asyncNative}} + {{^asyncNative}} + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } + {{/asyncNative}} } {{/operation}} } 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 fa3f2b152487..384c717f74f6 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 @@ -433,6 +433,45 @@ public void testJdkHttpClient() throws Exception { assertTrue(apiClientContent.contains("import java.net.http.HttpRequest;")); } + @Test + public void testJdkHttpAsyncClient() throws Exception { + Map<String, Object> properties = new HashMap<>(); + properties.put(JavaClientCodegen.JAVA8_MODE, true); + properties.put(CodegenConstants.API_PACKAGE, "xyz.abcdef.api"); + properties.put(JavaClientCodegen.ASYNC_NATIVE, true); + + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("java") + .setLibrary(JavaClientCodegen.NATIVE) + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/pingSomeObj.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + MockDefaultGenerator generator = new MockDefaultGenerator(); + generator.opts(clientOptInput).generate(); + + Map<String, String> generatedFiles = generator.getFiles(); + Assert.assertEquals(generatedFiles.size(), 29); + validateJavaSourceFiles(generatedFiles); + String defaultApiFilename = new File(output, "src/main/java/xyz/abcdef/api/PingApi.java").getAbsolutePath().replace("\\", "/"); + String defaultApiContent = generatedFiles.get(defaultApiFilename); + assertTrue(defaultApiContent.contains("public class PingApi")); + assertTrue(defaultApiContent.contains("import java.net.http.HttpClient;")); + assertTrue(defaultApiContent.contains("import java.net.http.HttpRequest;")); + assertTrue(defaultApiContent.contains("import java.net.http.HttpResponse;")); + assertTrue(defaultApiContent.contains("import java.util.concurrent.CompletableFuture;")); + + String apiClientFilename = new File(output, "src/main/java/xyz/abcdef/ApiClient.java").getAbsolutePath().replace("\\", "/"); + String apiClientContent = generatedFiles.get(apiClientFilename); + assertTrue(apiClientContent.contains("public class ApiClient")); + assertTrue(apiClientContent.contains("import java.net.http.HttpClient;")); + assertTrue(apiClientContent.contains("import java.net.http.HttpRequest;")); + } + @Test public void testReferencedHeader() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue855.yaml"); diff --git a/samples/client/petstore/java/native-async/.gitignore b/samples/client/petstore/java/native-async/.gitignore new file mode 100644 index 000000000000..a530464afa1b --- /dev/null +++ b/samples/client/petstore/java/native-async/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/native-async/.openapi-generator-ignore b/samples/client/petstore/java/native-async/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/java/native-async/.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/java/native-async/.openapi-generator/VERSION b/samples/client/petstore/java/native-async/.openapi-generator/VERSION new file mode 100644 index 000000000000..b5d898602c2c --- /dev/null +++ b/samples/client/petstore/java/native-async/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/native-async/.travis.yml b/samples/client/petstore/java/native-async/.travis.yml new file mode 100644 index 000000000000..d489da682e9e --- /dev/null +++ b/samples/client/petstore/java/native-async/.travis.yml @@ -0,0 +1,16 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk11 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/native-async/README.md b/samples/client/petstore/java/native-async/README.md new file mode 100644 index 000000000000..95bf0640c902 --- /dev/null +++ b/samples/client/petstore/java/native-async/README.md @@ -0,0 +1,238 @@ +# petstore-native + +OpenAPI Petstore + +- API version: 1.0.0 + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: + +1. Java 11+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml +<dependency> + <groupId>org.openapitools</groupId> + <artifactId>petstore-native</artifactId> + <version>1.0.0</version> + <scope>compile</scope> +</dependency> +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "org.openapitools:petstore-native:1.0.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +- `target/petstore-native-1.0.0.jar` +- `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import org.openapitools.client.*; +import org.openapitools.client.model.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class AnotherFakeApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + // Configure clients using the `defaultClient` object, such as + // overriding the host and port, timeout, etc. + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](docs/FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +*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 +*PetApi* | [**uploadFileWithRequiredFile**](docs/PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | 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/{order_id} | 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 + + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md) + - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md) + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md) + - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md) + - [Animal](docs/Animal.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [CatAllOf](docs/CatAllOf.md) + - [Category](docs/Category.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Dog](docs/Dog.md) + - [DogAllOf](docs/DogAllOf.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumTest](docs/EnumTest.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NumberOnly](docs/NumberOnly.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [Pet](docs/Pet.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [Tag](docs/Tag.md) + - [TypeHolderDefault](docs/TypeHolderDefault.md) + - [TypeHolderExample](docs/TypeHolderExample.md) + - [User](docs/User.md) + - [XmlItem](docs/XmlItem.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### api_key_query + + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +### http_basic_test + + +- **Type**: HTTP basic authentication + +### 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 + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. +However, the instances of the api clients created from the `ApiClient` are thread-safe and can be re-used. + +## Author + + + diff --git a/samples/client/petstore/java/native-async/api/openapi.yaml b/samples/client/petstore/java/native-async/api/openapi.yaml new file mode 100644 index 000000000000..30aad25824c8 --- /dev/null +++ b/samples/client/petstore/java/native-async/api/openapi.yaml @@ -0,0 +1,2183 @@ +openapi: 3.0.1 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + "405": + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: application/json + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: application/json + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: {} + description: successful operation + "400": + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: application/json + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: application/json + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-contentType: multipart/form-data + x-accepts: application/json + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: application/json + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: application/json + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: application/json + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + "400": + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: application/json + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: application/json + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Delete user + tags: + - user + x-accepts: application/json + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: application/json + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + "400": + content: {} + description: Invalid user supplied + "404": + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: application/json + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + in: query + name: required_string_group + required: true + schema: + type: integer + - description: Required Boolean in group parameters + in: header + name: required_boolean_group + required: true + schema: + type: boolean + - description: Required Integer in group parameters + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + - description: String in group parameters + in: query + name: string_group + schema: + type: integer + - description: Boolean in group parameters + in: header + name: boolean_group + schema: + type: boolean + - description: Integer in group parameters + in: query + name: int64_group + schema: + format: int64 + type: integer + responses: + "400": + content: {} + description: Someting wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + x-accepts: application/json + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + explode: false + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + responses: + "400": + content: {} + description: Invalid request + "404": + content: {} + description: Not found + summary: To test enum parameters + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + post: + description: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + integer: + description: None + format: int32 + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + security: + - http_basic_test: [] + summary: |- + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + required: false + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-codegen-request-body-name: body + x-contentType: '*/*' + x-accepts: '*/*' + /fake/jsonFormData: + get: + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true + responses: + "200": + content: {} + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-contentType: application/x-www-form-urlencoded + x-accepts: application/json + /fake/inline-additionalProperties: + post: + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + "200": + content: {} + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-codegen-request-body-name: param + x-contentType: application/json + x-accepts: application/json + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake/create_xml_item: + post: + description: this route creates an XmlItem + operationId: createXmlItem + requestBody: + content: + application/xml: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + description: XmlItem Body + required: true + responses: + "200": + content: {} + description: successful operation + summary: creates an XmlItem + tags: + - fake + x-codegen-request-body-name: XmlItem + x-contentType: application/xml + x-accepts: application/json + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema + named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + "200": + content: {} + description: Success + tags: + - fake + x-codegen-request-body-name: body + x-contentType: application/json + x-accepts: application/json + /fake/test-query-paramters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: false + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: form + - in: query + name: ioutil + required: true + schema: + items: + type: string + type: array + - in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: {} + description: Success + tags: + - fake + x-accepts: application/json + /fake/{petId}/uploadImageWithRequiredFile: + post: + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-contentType: multipart/form-data + x-accepts: application/json +components: + schemas: + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + Category: + example: + name: default-name + id: 6 + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + User: + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + type: object + xml: + name: User + Tag: + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + Pet: + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: default-name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + type: object + xml: + name: Pet + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + "123Number": + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + "200_response": + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Dog_allOf' + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + BigDecimal: + format: number + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + AdditionalPropertiesClass: + properties: + map_string: + additionalProperties: + type: string + type: object + map_number: + additionalProperties: + type: number + type: object + map_integer: + additionalProperties: + type: integer + type: object + map_boolean: + additionalProperties: + type: boolean + type: object + map_array_integer: + additionalProperties: + items: + type: integer + type: array + type: object + map_array_anytype: + additionalProperties: + items: + properties: {} + type: object + type: array + type: object + map_map_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_map_anytype: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + type: object + anytype_1: + properties: {} + type: object + anytype_2: + type: object + anytype_3: + properties: {} + type: object + type: object + AdditionalPropertiesString: + additionalProperties: + type: string + properties: + name: + type: string + type: object + AdditionalPropertiesInteger: + additionalProperties: + type: integer + properties: + name: + type: string + type: object + AdditionalPropertiesNumber: + additionalProperties: + type: number + properties: + name: + type: string + type: object + AdditionalPropertiesBoolean: + additionalProperties: + type: boolean + properties: + name: + type: string + type: object + AdditionalPropertiesArray: + additionalProperties: + items: + properties: {} + type: object + type: array + properties: + name: + type: string + type: object + AdditionalPropertiesObject: + additionalProperties: + additionalProperties: + properties: {} + type: object + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesAnyType: + additionalProperties: + properties: {} + type: object + properties: + name: + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + List: + properties: + "123-list": + type: string + type: object + Client: + example: + client: client + properties: + client: + type: string + type: object + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterComposite: + example: + my_string: my_string + my_number: 0.8008281904610115 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + TypeHolderDefault: + properties: + string_item: + default: what + type: string + number_item: + type: number + integer_item: + type: integer + bool_item: + default: true + type: boolean + array_item: + items: + type: integer + type: array + required: + - array_item + - bool_item + - integer_item + - number_item + - string_item + type: object + TypeHolderExample: + properties: + string_item: + example: what + type: string + number_item: + example: 1.234 + type: number + float_item: + example: 1.234 + format: float + type: number + integer_item: + example: -2 + type: integer + bool_item: + example: true + type: boolean + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + required: + - array_item + - bool_item + - float_item + - integer_item + - number_item + - string_item + type: object + XmlItem: + properties: + attribute_string: + example: string + type: string + xml: + attribute: true + attribute_number: + example: 1.234 + type: number + xml: + attribute: true + attribute_integer: + example: -2 + type: integer + xml: + attribute: true + attribute_boolean: + example: true + type: boolean + xml: + attribute: true + wrapped_array: + items: + type: integer + type: array + xml: + wrapped: true + name_string: + example: string + type: string + xml: + name: xml_name_string + name_number: + example: 1.234 + type: number + xml: + name: xml_name_number + name_integer: + example: -2 + type: integer + xml: + name: xml_name_integer + name_boolean: + example: true + type: boolean + xml: + name: xml_name_boolean + name_array: + items: + type: integer + xml: + name: xml_name_array_item + type: array + name_wrapped_array: + items: + type: integer + xml: + name: xml_name_wrapped_array_item + type: array + xml: + name: xml_name_wrapped_array + wrapped: true + prefix_string: + example: string + type: string + xml: + prefix: ab + prefix_number: + example: 1.234 + type: number + xml: + prefix: cd + prefix_integer: + example: -2 + type: integer + xml: + prefix: ef + prefix_boolean: + example: true + type: boolean + xml: + prefix: gh + prefix_array: + items: + type: integer + xml: + prefix: ij + type: array + prefix_wrapped_array: + items: + type: integer + xml: + prefix: mn + type: array + xml: + prefix: kl + wrapped: true + namespace_string: + example: string + type: string + xml: + namespace: http://a.com/schema + namespace_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + namespace_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + namespace_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + namespace_array: + items: + type: integer + xml: + namespace: http://e.com/schema + type: array + namespace_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + type: array + xml: + namespace: http://f.com/schema + wrapped: true + prefix_ns_string: + example: string + type: string + xml: + namespace: http://a.com/schema + prefix: a + prefix_ns_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + prefix: b + prefix_ns_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + prefix: c + prefix_ns_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + prefix: d + prefix_ns_array: + items: + type: integer + xml: + namespace: http://e.com/schema + prefix: e + type: array + prefix_ns_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + prefix: g + type: array + xml: + namespace: http://f.com/schema + prefix: f + wrapped: true + type: object + xml: + namespace: http://a.com/schema + prefix: pre + Dog_allOf: + properties: + breed: + type: string + Cat_allOf: + properties: + declawed: + type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + diff --git a/samples/client/petstore/java/native-async/build.gradle b/samples/client/petstore/java/native-async/build.gradle new file mode 100644 index 000000000000..a790b04b52b9 --- /dev/null +++ b/samples/client/petstore/java/native-async/build.gradle @@ -0,0 +1,66 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + maven { url "https://repo1.maven.org/maven2" } + jcenter() + } +} + +repositories { + maven { url "https://repo1.maven.org/maven2" } + jcenter() +} + +apply plugin: 'java' +apply plugin: 'maven' + +sourceCompatibility = JavaVersion.VERSION_11 +targetCompatibility = JavaVersion.VERSION_11 + +install { + repositories.mavenInstaller { + pom.artifactId = 'petstore-native' + } +} + +task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath +} + +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + + +ext { + swagger_annotations_version = "1.5.22" + jackson_version = "2.9.9" + junit_version = "4.13" +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "com.google.code.findbugs:jsr305:3.0.2" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + testCompile "junit:junit:$junit_version" +} diff --git a/samples/client/petstore/java/native-async/build.sbt b/samples/client/petstore/java/native-async/build.sbt new file mode 100644 index 000000000000..464090415c47 --- /dev/null +++ b/samples/client/petstore/java/native-async/build.sbt @@ -0,0 +1 @@ +# TODO diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 000000000000..87b468bb7ca3 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesAnyType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesArray.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesArray.md new file mode 100644 index 000000000000..cb7fe9b3903d --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesArray.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesArray + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 000000000000..6b53e7ba73a1 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesBoolean + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..36e181620016 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesClass.md @@ -0,0 +1,22 @@ + + +# AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapString** | **Map<String, String>** | | [optional] +**mapNumber** | [**Map<String, BigDecimal>**](BigDecimal.md) | | [optional] +**mapInteger** | **Map<String, Integer>** | | [optional] +**mapBoolean** | **Map<String, Boolean>** | | [optional] +**mapArrayInteger** | [**Map<String, List<Integer>>**](List.md) | | [optional] +**mapArrayAnytype** | [**Map<String, List<Object>>**](List.md) | | [optional] +**mapMapString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapMapAnytype** | [**Map<String, Map<String, Object>>**](Map.md) | | [optional] +**anytype1** | [**Object**](.md) | | [optional] +**anytype2** | [**Object**](.md) | | [optional] +**anytype3** | [**Object**](.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesInteger.md new file mode 100644 index 000000000000..d2ed7fb1a460 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesNumber.md new file mode 100644 index 000000000000..53f6e81e7176 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesNumber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesObject.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesObject.md new file mode 100644 index 000000000000..98ac8d2e5fe0 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesObject.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AdditionalPropertiesString.md b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesString.md new file mode 100644 index 000000000000..d7970cdfe190 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AdditionalPropertiesString.md @@ -0,0 +1,12 @@ + + +# AdditionalPropertiesString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Animal.md b/samples/client/petstore/java/native-async/docs/Animal.md new file mode 100644 index 000000000000..c8e18ae55e4f --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Animal.md @@ -0,0 +1,13 @@ + + +# Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/AnotherFakeApi.md b/samples/client/petstore/java/native-async/docs/AnotherFakeApi.md new file mode 100644 index 000000000000..059616ec6baa --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/AnotherFakeApi.md @@ -0,0 +1,74 @@ +# AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + + +## call123testSpecialTags + +> Client call123testSpecialTags(body) + +To test special tags + +To test special tags and operation ID starting with number + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/native-async/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/native-async/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..a48aa23e78ee --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,12 @@ + + +# ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/native-async/docs/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..fa2909211a07 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ArrayOfNumberOnly.md @@ -0,0 +1,12 @@ + + +# ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/ArrayTest.md b/samples/client/petstore/java/native-async/docs/ArrayTest.md new file mode 100644 index 000000000000..9ad1c9814a51 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ArrayTest.md @@ -0,0 +1,14 @@ + + +# ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/BigCat.md b/samples/client/petstore/java/native-async/docs/BigCat.md new file mode 100644 index 000000000000..8a075304abf8 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/native-async/docs/BigCatAllOf.md b/samples/client/petstore/java/native-async/docs/BigCatAllOf.md new file mode 100644 index 000000000000..21177dbf089d --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/native-async/docs/Capitalization.md b/samples/client/petstore/java/native-async/docs/Capitalization.md new file mode 100644 index 000000000000..7b73c40b5545 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Capitalization.md @@ -0,0 +1,17 @@ + + +# Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**scAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Cat.md b/samples/client/petstore/java/native-async/docs/Cat.md new file mode 100644 index 000000000000..39c2f864df88 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Cat.md @@ -0,0 +1,12 @@ + + +# Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/CatAllOf.md b/samples/client/petstore/java/native-async/docs/CatAllOf.md new file mode 100644 index 000000000000..1098fd900c5d --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/CatAllOf.md @@ -0,0 +1,12 @@ + + +# CatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Category.md b/samples/client/petstore/java/native-async/docs/Category.md new file mode 100644 index 000000000000..613ea9f7ee24 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Category.md @@ -0,0 +1,13 @@ + + +# Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | + + + diff --git a/samples/client/petstore/java/native-async/docs/ClassModel.md b/samples/client/petstore/java/native-async/docs/ClassModel.md new file mode 100644 index 000000000000..d5453c20133a --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ClassModel.md @@ -0,0 +1,13 @@ + + +# ClassModel + +Model for testing model with \"_class\" property +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Client.md b/samples/client/petstore/java/native-async/docs/Client.md new file mode 100644 index 000000000000..228df492383f --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Client.md @@ -0,0 +1,12 @@ + + +# Client + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Dog.md b/samples/client/petstore/java/native-async/docs/Dog.md new file mode 100644 index 000000000000..73cedf2bc919 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Dog.md @@ -0,0 +1,12 @@ + + +# Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/DogAllOf.md b/samples/client/petstore/java/native-async/docs/DogAllOf.md new file mode 100644 index 000000000000..cbeb9e9a22df --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/DogAllOf.md @@ -0,0 +1,12 @@ + + +# DogAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/EnumArrays.md b/samples/client/petstore/java/native-async/docs/EnumArrays.md new file mode 100644 index 000000000000..869b7a6c066d --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/EnumArrays.md @@ -0,0 +1,31 @@ + + +# EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] +**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] + + + +## Enum: JustSymbolEnum + +Name | Value +---- | ----- +GREATER_THAN_OR_EQUAL_TO | ">=" +DOLLAR | "$" + + + +## Enum: List<ArrayEnumEnum> + +Name | Value +---- | ----- +FISH | "fish" +CRAB | "crab" + + + diff --git a/samples/client/petstore/java/native-async/docs/EnumClass.md b/samples/client/petstore/java/native-async/docs/EnumClass.md new file mode 100644 index 000000000000..b314590a7591 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/EnumClass.md @@ -0,0 +1,15 @@ + + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/native-async/docs/EnumTest.md b/samples/client/petstore/java/native-async/docs/EnumTest.md new file mode 100644 index 000000000000..61eb95f22fe9 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/EnumTest.md @@ -0,0 +1,54 @@ + + +# EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] + + + +## Enum: EnumStringEnum + +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + + +## Enum: EnumStringRequiredEnum + +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + + +## Enum: EnumIntegerEnum + +Name | Value +---- | ----- +NUMBER_1 | 1 +NUMBER_MINUS_1 | -1 + + + +## Enum: EnumNumberEnum + +Name | Value +---- | ----- +NUMBER_1_DOT_1 | 1.1 +NUMBER_MINUS_1_DOT_2 | -1.2 + + + diff --git a/samples/client/petstore/java/native-async/docs/FakeApi.md b/samples/client/petstore/java/native-async/docs/FakeApi.md new file mode 100644 index 000000000000..1ce9c124e914 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/FakeApi.md @@ -0,0 +1,987 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | + + + +## createXmlItem + +> createXmlItem(xmlItem) + +creates an XmlItem + +this route creates an XmlItem + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## fakeOuterBooleanSerialize + +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Boolean**| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + + +## fakeOuterCompositeSerialize + +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + + +## fakeOuterNumberSerialize + +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **BigDecimal**| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + + +## fakeOuterStringSerialize + +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + + +## testBodyWithFileSchema + +> testBodyWithFileSchema(body) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testBodyWithQueryParams + +> testBodyWithQueryParams(query, body) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **body** | [**User**](User.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + + +## testClientModel + +> Client testClientModel(body) + +To test \"client\" model + +To test \"client\" model + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testEndpointParameters + +> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); + + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + + +## testEnumParameters + +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List<String> enumHeaderStringArray = Arrays.asList("$"); // List<String> | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List<String> enumQueryStringArray = Arrays.asList("$"); // List<String> | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List<String> enumFormStringArray = "$"; // List<String> | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + + +## testGroupParameters + +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **Integer**| Required String in group parameters | + **requiredBooleanGroup** | **Boolean**| Required Boolean in group parameters | + **requiredInt64Group** | **Long**| Required Integer in group parameters | + **stringGroup** | **Integer**| String in group parameters | [optional] + **booleanGroup** | **Boolean**| Boolean in group parameters | [optional] + **int64Group** | **Long**| Integer in group parameters | [optional] + +### Return type + +null (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** | Someting wrong | - | + + +## testInlineAdditionalProperties + +> testInlineAdditionalProperties(param) + +test inline additionalProperties + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + Map<String, String> param = new HashMap(); // Map<String, String> | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**Map<String, String>**](String.md)| request body | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testJsonFormData + +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + +## testQueryParameterCollectionFormat + +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + List<String> pipe = Arrays.asList(); // List<String> | + List<String> ioutil = Arrays.asList(); // List<String> | + List<String> http = Arrays.asList(); // List<String> | + List<String> url = Arrays.asList(); // List<String> | + List<String> context = Arrays.asList(); // List<String> | + try { + apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List<String>**](String.md)| | + **ioutil** | [**List<String>**](String.md)| | + **http** | [**List<String>**](String.md)| | + **url** | [**List<String>**](String.md)| | + **context** | [**List<String>**](String.md)| | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **200** | Success | - | + diff --git a/samples/client/petstore/java/native-async/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/native-async/docs/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..14a74a37a4e2 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/FakeClassnameTags123Api.md @@ -0,0 +1,81 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +## testClassname + +> Client testClassname(body) + +To test class name in snake case + +To test class name in snake case + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); + + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/native-async/docs/FileSchemaTestClass.md b/samples/client/petstore/java/native-async/docs/FileSchemaTestClass.md new file mode 100644 index 000000000000..3a95e27d7c09 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/FileSchemaTestClass.md @@ -0,0 +1,13 @@ + + +# FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**java.io.File**](java.io.File.md) | | [optional] +**files** | [**List<java.io.File>**](java.io.File.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/FormatTest.md b/samples/client/petstore/java/native-async/docs/FormatTest.md new file mode 100644 index 000000000000..d138e921902a --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/FormatTest.md @@ -0,0 +1,25 @@ + + +# FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Long** | | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | | +**_float** | **Float** | | [optional] +**_double** | **Double** | | [optional] +**string** | **String** | | [optional] +**_byte** | **byte[]** | | +**binary** | [**File**](File.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] +**password** | **String** | | +**bigDecimal** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/native-async/docs/HasOnlyReadOnly.md new file mode 100644 index 000000000000..4795b40ef65e --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/HasOnlyReadOnly.md @@ -0,0 +1,13 @@ + + +# HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + + + diff --git a/samples/client/petstore/java/native-async/docs/MapTest.md b/samples/client/petstore/java/native-async/docs/MapTest.md new file mode 100644 index 000000000000..c35c3cf2c0be --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/MapTest.md @@ -0,0 +1,24 @@ + + +# MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] +**directMap** | **Map<String, Boolean>** | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] + + + +## Enum: Map<String, InnerEnum> + +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" + + + diff --git a/samples/client/petstore/java/native-async/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/native-async/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..3dc283ae4936 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,14 @@ + + +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | [**UUID**](UUID.md) | | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Model200Response.md b/samples/client/petstore/java/native-async/docs/Model200Response.md new file mode 100644 index 000000000000..f9928d70622c --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Model200Response.md @@ -0,0 +1,14 @@ + + +# Model200Response + +Model for testing model name starting with number +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/ModelApiResponse.md b/samples/client/petstore/java/native-async/docs/ModelApiResponse.md new file mode 100644 index 000000000000..14fb7f1ed27b --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ModelApiResponse.md @@ -0,0 +1,14 @@ + + +# ModelApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/ModelReturn.md b/samples/client/petstore/java/native-async/docs/ModelReturn.md new file mode 100644 index 000000000000..5005d4b72392 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ModelReturn.md @@ -0,0 +1,13 @@ + + +# ModelReturn + +Model for testing reserved words +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Name.md b/samples/client/petstore/java/native-async/docs/Name.md new file mode 100644 index 000000000000..b815a0b4c994 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Name.md @@ -0,0 +1,16 @@ + + +# Name + +Model for testing model name same as property name +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | +**snakeCase** | **Integer** | | [optional] [readonly] +**property** | **String** | | [optional] +**_123number** | **Integer** | | [optional] [readonly] + + + diff --git a/samples/client/petstore/java/native-async/docs/NumberOnly.md b/samples/client/petstore/java/native-async/docs/NumberOnly.md new file mode 100644 index 000000000000..1c12b6adf3bd --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/NumberOnly.md @@ -0,0 +1,12 @@ + + +# NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/Order.md b/samples/client/petstore/java/native-async/docs/Order.md new file mode 100644 index 000000000000..409fc4cc9616 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Order.md @@ -0,0 +1,27 @@ + + +# Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" + + + diff --git a/samples/client/petstore/java/native-async/docs/OuterComposite.md b/samples/client/petstore/java/native-async/docs/OuterComposite.md new file mode 100644 index 000000000000..e06292218847 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/OuterComposite.md @@ -0,0 +1,14 @@ + + +# OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/OuterEnum.md b/samples/client/petstore/java/native-async/docs/OuterEnum.md new file mode 100644 index 000000000000..1f9b723eb8e7 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/OuterEnum.md @@ -0,0 +1,15 @@ + + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/native-async/docs/Pet.md b/samples/client/petstore/java/native-async/docs/Pet.md new file mode 100644 index 000000000000..37ac007b7931 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Pet.md @@ -0,0 +1,27 @@ + + +# Pet + +## 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** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" + + + diff --git a/samples/client/petstore/java/native-async/docs/PetApi.md b/samples/client/petstore/java/native-async/docs/PetApi.md new file mode 100644 index 000000000000..875a8e6783e9 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/PetApi.md @@ -0,0 +1,656 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io:80/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 +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + + +## addPet + +> addPet(body) + +Add a new pet to the store + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + + +## deletePet + +> deletePet(petId, apiKey) + +Deletes a pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + + +## findPetsByStatus + +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List<String> status = Arrays.asList("available"); // List<String> | Status values that need to be considered for filter + try { + List<Pet> result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + +### 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 | - | + + +## findPetsByTags + +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + List<String> tags = Arrays.asList(); // List<String> | Tags to filter by + try { + List<Pet> result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## getPetById + +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## updatePet + +> updatePet(body) + +Update an existing pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + + +## updatePetWithForm + +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 + +null (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 | - | + + +## uploadFile + +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.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 | - | + + +## uploadFileWithRequiredFile + +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.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 | - | + diff --git a/samples/client/petstore/java/native-async/docs/ReadOnlyFirst.md b/samples/client/petstore/java/native-async/docs/ReadOnlyFirst.md new file mode 100644 index 000000000000..a692499dc661 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/ReadOnlyFirst.md @@ -0,0 +1,13 @@ + + +# ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/SpecialModelName.md b/samples/client/petstore/java/native-async/docs/SpecialModelName.md new file mode 100644 index 000000000000..934b8f0f25d7 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/SpecialModelName.md @@ -0,0 +1,12 @@ + + +# SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**$specialPropertyName** | **Long** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/StoreApi.md b/samples/client/petstore/java/native-async/docs/StoreApi.md new file mode 100644 index 000000000000..352399ea515c --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/StoreApi.md @@ -0,0 +1,276 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +## deleteOrder + +> deleteOrder(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 + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +null (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 | - | + + +## getInventory + +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); + + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map<String, Integer> result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**Map<String, Integer>** + +### 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 | - | + + +## getOrderById + +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## placeOrder + +> Order placeOrder(body) + +Place an order for a pet + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### 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 Order | - | + diff --git a/samples/client/petstore/java/native-async/docs/Tag.md b/samples/client/petstore/java/native-async/docs/Tag.md new file mode 100644 index 000000000000..f24eba7d222e --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/Tag.md @@ -0,0 +1,13 @@ + + +# Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/TypeHolderDefault.md b/samples/client/petstore/java/native-async/docs/TypeHolderDefault.md new file mode 100644 index 000000000000..a338fc900cb1 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/TypeHolderDefault.md @@ -0,0 +1,16 @@ + + +# TypeHolderDefault + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | [**BigDecimal**](BigDecimal.md) | | +**integerItem** | **Integer** | | +**boolItem** | **Boolean** | | +**arrayItem** | **List<Integer>** | | + + + diff --git a/samples/client/petstore/java/native-async/docs/TypeHolderExample.md b/samples/client/petstore/java/native-async/docs/TypeHolderExample.md new file mode 100644 index 000000000000..f8858da60664 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/TypeHolderExample.md @@ -0,0 +1,17 @@ + + +# TypeHolderExample + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**stringItem** | **String** | | +**numberItem** | [**BigDecimal**](BigDecimal.md) | | +**floatItem** | **Float** | | +**integerItem** | **Integer** | | +**boolItem** | **Boolean** | | +**arrayItem** | **List<Integer>** | | + + + diff --git a/samples/client/petstore/java/native-async/docs/User.md b/samples/client/petstore/java/native-async/docs/User.md new file mode 100644 index 000000000000..c4ea94b7fc17 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/User.md @@ -0,0 +1,19 @@ + + +# User + +## 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** | **Integer** | User Status | [optional] + + + diff --git a/samples/client/petstore/java/native-async/docs/UserApi.md b/samples/client/petstore/java/native-async/docs/UserApi.md new file mode 100644 index 000000000000..ca9f550c3167 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/UserApi.md @@ -0,0 +1,525 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io:80/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 + +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithArrayInput + +> createUsersWithArrayInput(body) + +Creates list of users with given input array + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List<User> body = Arrays.asList(); // List<User> | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## createUsersWithListInput + +> createUsersWithListInput(body) + +Creates list of users with given input array + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + List<User> body = Arrays.asList(); // List<User> | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## deleteUser + +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (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 username supplied | - | +| **404** | User not found | - | + + +## getUserByName + +> User getUserByName(username) + +Get user by user name + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | - | + + +## loginUser + +> String loginUser(username, password) + +Logs user into the system + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### 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 | * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when token expires <br> | +| **400** | Invalid username/password supplied | - | + + +## logoutUser + +> logoutUser() + +Logs out current logged in user session + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +null (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 | +|-------------|-------------|------------------| +| **0** | successful operation | - | + + +## updateUser + +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (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 user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/native-async/docs/XmlItem.md b/samples/client/petstore/java/native-async/docs/XmlItem.md new file mode 100644 index 000000000000..6065fd1f4e59 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/XmlItem.md @@ -0,0 +1,40 @@ + + +# XmlItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attributeString** | **String** | | [optional] +**attributeNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**attributeInteger** | **Integer** | | [optional] +**attributeBoolean** | **Boolean** | | [optional] +**wrappedArray** | **List<Integer>** | | [optional] +**nameString** | **String** | | [optional] +**nameNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**nameInteger** | **Integer** | | [optional] +**nameBoolean** | **Boolean** | | [optional] +**nameArray** | **List<Integer>** | | [optional] +**nameWrappedArray** | **List<Integer>** | | [optional] +**prefixString** | **String** | | [optional] +**prefixNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**prefixInteger** | **Integer** | | [optional] +**prefixBoolean** | **Boolean** | | [optional] +**prefixArray** | **List<Integer>** | | [optional] +**prefixWrappedArray** | **List<Integer>** | | [optional] +**namespaceString** | **String** | | [optional] +**namespaceNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**namespaceInteger** | **Integer** | | [optional] +**namespaceBoolean** | **Boolean** | | [optional] +**namespaceArray** | **List<Integer>** | | [optional] +**namespaceWrappedArray** | **List<Integer>** | | [optional] +**prefixNsString** | **String** | | [optional] +**prefixNsNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**prefixNsInteger** | **Integer** | | [optional] +**prefixNsBoolean** | **Boolean** | | [optional] +**prefixNsArray** | **List<Integer>** | | [optional] +**prefixNsWrappedArray** | **List<Integer>** | | [optional] + + + diff --git a/samples/client/petstore/java/native-async/git_push.sh b/samples/client/petstore/java/native-async/git_push.sh new file mode 100644 index 000000000000..ced3be2b0c7b --- /dev/null +++ b/samples/client/petstore/java/native-async/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/java/native-async/gradle.properties b/samples/client/petstore/java/native-async/gradle.properties new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..cc4fdc293d0e50b0ad9b65c16e7ddd1db2f6025b GIT binary patch literal 58702 zcma&OV~}W3vL#%;<*Hk@ZQHhO+qTVHwr$(CZQFL$+?np4n10i5zVAmKMC6WrGGd+F zD|4@N<RpPXAOQft!2tjO`2QLJ0MP$B0suh#JxdEK@l%V-h|mH9$o-q6bsY~k-(Lsb zzlQXGI!g1)h>Hj-D$z)bJV;MYNJ&!D%)v-fQ%q0JG$_z5GVUJTPg0MHPf1Tvic<kX zo`)DE9~Nqmx1tgk9~M#sp%SAY6{6fZ+&KXLml^*~^1mMq<nOhugX#bERR5<B)IWVp z9rTT?jQ^jmi2v^D>Y#6DXYBBQ4M`$iC~gA;06+%@0HFQPLj-JXogAJ1j+fRqw^4M` zcW^RxAfl%+w9<EUj8>SiS>QwBUTAfuFAjPXc2DHf6*sr+V+jLQj^m@DQgHTPmAb@F z8%GyCfcQkhWWlT31%4$PtV4tV*LI?J#C4orYI~WU(cSR{aEs^ycxY`1>j1po>yDMi zh4W$pMaecV*mCsOsPLxQ#Xc!RXhpXy*p3S2Hl8t}H7x#p5<WRyv}DXB?O~G(<$s$* zKaOKsPlhxwVsG;yzcbFHI7dn;N@!ew>V6G5va4jV;5^S^+>+x&#zzv4!R}wB;)TyU zE_N~}nN>DTG+uZns%_eI=DL1E#<--Sccx30gvMT}^eu`2-u|{qQZ58(rA2aBYE*ZD zm|*12zg*@J$n|tbH%Mp|d|O9W%VT~<mtdFxoyg6#?kijTREKTws{`nYl9fj8r{K~0 zMu0f8cYQ}X31$v~y4H25-D)q8#heTIRfC~{opJg3^7Ooc5b-v2z7D{(ZN1$J#;pIq zcmMvi?bwYCS7hZ>xG})R=Ld5z<(z%DOO6=MF3Xh-aF%9Hf$?1N9%8Pkev{wun$jZ2 z^i*EhRt8Ve<7`Wyz~iMZDye+XVn}O%qbhV`wHL+%P+n)K&-UMuZw^RRfeQ)%K=k*m zq5l7mf`4K_WkV5B73~MxajljrjGiJqpiV#>0FkyyrB)@HY!;Ln(7JJ*W(>d5#^ubU zVAkTMs*CHzzvUa^nRu0<X(7d>*f-(ek+VZw+@P~}a;;(K=|!9Mhv(~y-ml<QTm%4- zL1zFI0#z_Ik&f69<7WJpKZ%Y|Uqu8u#Yk(|li~Oe@<?YCJc^N4pR#=?u7HeOb+Daw z|1Sgu27*?6Lo8NeuhnoJFCu;@efib#$O1fA8h!C$A3(g2{2*g6<8h|8Ec!-=v=sD! z5+_Ah8OB$HF-qv~DCJ$~4dt!FhNO9dmXjvoKr;QMam!)kspTQh=u_8Z=lVD$>W);J zb&bB=vySHG`u?j&_6dh^*se*l_B3avjlE|!!Cb0pXyEXRbLy*@WEQ4|)M<`p8<Y|5 z2%93>Q!rfDJ2RI!u1hPzNjy&)(kcY~GaD6?)7#dCbm`NF<g;7l5g5&;Mj%py#Ra;y z1f5hxOf`Wvp;B#xff%qI8u3<?PxNalP0$dvK)<OJ=xo<{oLC}PR#F@5qU=twiZ#W7 z67lXxhom0vf~r;n1SbcUy7Uvu7@IU>h?Y_g$#!+Qrie7%<7P}<-+W@{sxi4JYI{iY zk0(>m$DxOI=~-&eXf2bfh^&(U@o)>(iA1_wJ%B(+nFH+ceib%H<b^rOPv2E&MDz*+ zr2XQfL74H-frDv=SY0Pdq#DCW*_^D%3zICZ*|CytwcjZFf`LbQNP;uT36ha5;8j5z zkkE-B2=@&q?8HR?nCy^Lm13`I{xIWZ1-Sv7kk=8002K(!NL~T5$eRP+<1|gK;}^wB z*p}nK<Oun@j9xNT6dC~v8w$#xy1SB~x_g%Ag&y;aA<D=3-H_dVde~Z37)+5$(13@U zpgVj10XKJk#h1vTR=Z&VxVMA@vy>Eck32QL=J(BNFh`f>St1%llF8chX7#cp*;z}& zcTeXkwsXhf+e;#<mHvK))RWS2J3{sLW+lTJ7aYn7N;z>#!FS2yi=2cChcYfzm$wQJ z9%4kAq)wLHf5wfcj!A|xDsAiAOHRzf*)Z-|daN9y5jK-*R{Q0?xaSX-3m|WeuZ`BJ z>eTi@uQ{OGSDIJ#Iu@JPtOy!C?q)g*6SHORg)eAJGh8b-I*X_+xNqZ|OXEsQ-RWte ze`zjjeV9PpE3ac2za+Rs=PA;%QZ>T{x(TRzwWLp_X^2yC-DOEMUy5So!npzL&-@}u z#>uK#&`i&c%J$!bsntEJhY@rF(>6eY;6RoI5Qkn!&<80X5+1(<A$tFH9m~_-ye9aQ z>x$T|wR-ad?4N1N^a0)nBj#&EkVvQ?I_+8t*%l#VK&I?uo$ERI1HMu4P2rLMeH%m3 zZ|HA^*O^dA$gb<A+8nWE*k|^~9YyriduFNhhxV~rFy`G?Fp=Nyxg%Hcw9t{3e=8LB zF)zo5Es8J(TDV5xlhq!cIHF5nZif)&_hum~A2pjjr;tmkr{n=0C`K<u%<PnC^Yk2C zzTu%X@i-=%OlQX7fplhWP?xe~(g>$`Cw;z9?G?m3@nH6TNYJ04Fd-M2wp8@(;vAvJ ztFoni)BLwncQ3@cO*^+6u;(&D<;N;RKb)_NQ_Qu&?@h3MWvo>6FHG%%*smTwj3;dG zQJnT7Wb?4!XmV^>N@ZkA7Jv9kAfD-gC<I~>Hu2i+!A!}y98SO><8g}t;1JOOxj>#l zM!?y|j5fR3WY2(&_HSGjgMa?Zif<<W?VbNO!_NOT!vCCUg=}4ItZem-{<X$>M@d8W z)4>Ptm@zj|xX=bbt$=j}@a_s|xdp6-tRlq6D|xb_;`9oJlkYF1AH%?Pzv$eIAogMi zf(_H*5t({Arfs5XAPj46pjiudQw?dulW-=OUqBVa)OW9E;^R+NDr&LES&m_nmP>Ga zPf)7_&Gn(3v1qu_a^qW9w4#XIEfgiHOQ(LDi=E&(-DcUSfuQE0`ULsRvS}fpS@<)3 z|CbQSi49rU{<4|XU;kiV|C7}Gld$}Yh5YXjg^W$~ovobybuZ^&YwBR^=qP3G=wxhT z?C_5Trbu~95mOoIXUmEOY646_j4ZL)ubCM{qFkl1u*%xs%#18a4!(*b<&edy<8t2w z_zUxWS5fypUp9ue+eswoJSyv*J&=*3;2;q9U?j>n^q?)}c8+}4Ns8oToBJgD;Ug=y zOa0>{VFrLJutjR{PJmm(P9lPzoPi{K!I{l)pGwDy59p-uxHB9I&7zl11lkCu(}*A< zh492AmxsgwEondBpB^{`I*L&Ut40fjM^JS8VdAWQMlwc>_RUM5|Mjes!36DGqW`xs z4tU4`CpOk|vew8!(L}fEvv5&-3#GqZ(#1EZF4ekDQ@y*$tMDEeG?nOUiS-KXG=rAZ zHUDlMo@X&yzo1TdE6b6!s#f{*45V-T3`e2)w5Ra3l>JWf46`v?Y6B&7*1$eS4M(3% z9C~G@<i(!>N@RXm)8~EXL*9IObA+PwD)`%64fON_8}&pqjrg|<uecKJ--R_&hYSS; z45Wc65)1%>2LmP{W^<0@W`9s^*i#F}V;E8~`-}(4@R4kz?t(RjA;y-r%s^=)15%C> zbF;NZET~nybEsmUr8sH^Hgq^xc^n$ZP=GcZ!-X-Go7J4nByj8%?aQ`c{88;p15K<V z_d~|1+?4Of*5i$x2xWRe8tvdys2dG>f>|0h+5BLkM&@KI-(flp^npO3MC~W@Uyjv* z6Hu!4#(NtZJ0*;_{8<J7i=0az&%(<wS04-($bOqbcbe=uYc<`1Rb#j%;6L!T%ZS_V zMbGG<3YW{=7)G%MCMRNB>^xcLrC4-zK$BVo7S5V=eg?R8P;BOpK3Xwms+Jt-8R6us zf_rUHFYHn~lu!)U$e$#%UBz7d8YS;mq}xx$T1PIi=4={c-_cY6OVc<=){mOVn>~J$ zW*2PB%*40eE^c<dlxK9Bvqt-M7aU^3PVe-^Jdu~jOmq^mOt%KN4?i~W$Rz0zz3gTI zO10DxC0A~Xt|6f*@>+d=PP7J@bqIX_h4u6b6#W|ir<;IlR`#s`Q*_Z8Q?*s<ipU}C znJI(0^W}FQE#0cJ?}zrKq&LVFW@=gW@-3uOe9H}<#JHT}p&{DB{3o-4!x`}b_o6VK zx_QKsJ{r-=Y5h-fZFj+CH)$d6Y$&chBrmxO`M#7{#wFMtQhdY~p2sMLLWhoXb?h@o zqg!S0;-k+JS<Moesi8@EgD2<{{X!b%EaE#h7NN;r&^HdO_%wt!GRa&Fc2{T!e6b=# zR{1MnI@pu!?=15b)mgWnY9L&^02S(JQaRCkQ;Kui#Z+B;pq{udS&lnShF4(1SIHuW z_)%trHzwlpgrUL&*@|H!)`f}k!qoM#LZ&1o>_&emuu8D;NSiPX9mK?>$CwcbjhCuv zO&u(0)@}8nZe=Fl*0uMri02oYDjs#g$OHCZ6oTXV2Y0TrZ}+o%{%i)OAJBj2xHC<V zJg9%`K&ii}iRu3%^Zw04ZtncfPG-h7PUeRCPPYHdL`jNQHVFJk+zoOlEs{gZeHtJ7 znimR5MLxoT^yYLVBxdPK8L8jt{UFO$u48m!?v&9G@X}rYxZ`f7l9c8UOJ8-2jyLQl z*_^Bo7cVb4066<)!Rl1%wRJ`Y?9s?jEp_R`8W<NIo+JHW*BWBI%ys7bID+TFxbNr0 zg8kH&^hA{M+H_jg?|E)3>|F5o+`Qmq`$`2EaL=uePwq%k<;6S2n=w%_9vj$8NO|{` zTEg*tK8PU#DnQ#dQ2mMJaaL|HV;BCn?eQ%d0v<K_HfTbf-99?GlXN@q7NMtGV#^~A zK1d9eZNcZH-)WwCa@$67YlGe)%B~iBRrS~FY!viVx&TJCE(I}_;Va$O+>Y@S7Pu@7 zsf5u`T=bL7NfyYO?K^PR_|jap@<F00udMd{#(px%QdVnBTcYiwhKRCg5kIbJ&~1u_ zrU;RW878B{gMOhfwk<0v`+xLRW`sq8l(<7+S~$Su=ixAq`rqIO8X$Uo3r%K*M}s0L zq-k1;4vh%TP@XBF-yn#eDLwk36xRnKyD%`{C3|NBLAn4q+#Bbi=^EJm?vhx*>K|qQ zmO8CK+&O3fzgEnp2|_=^K9ln~QhxjgMM>EQqY@k@@#np@FnZq|C{EyEP7^NurUm0q zW5rKmiy%__KE>YItA<BWGcGAzq0!#vJ2KS5%v%gT395&RU@W@)Dr)Tn2kOsw{~c(u zSvk0UumAvvH~;|n|8JoEV|}Yqhj7zUb^eYuahEM988Xy-UJYlAF%(_K;EchZ2uGZ_ zSiKipR%56?V3VCsV0tzaNpm;URQKcCLNS93ZVcuFhZpm!WkZUULZWk`r`A3dK$SR4 zpYL+YD{2IJ>TyMhE({0%ve10la=mUd<^AcB{T_$Y`2_N-x;F#3xTORXvhPZ7psm<b zUAnad>qhXy?WxxB5w!m*4&Q;?t$4Kt?m_em-htVDxora24&6~5z$MG(RT{trtp(L( zy&VDT{@p9_DGoq+I|abw$E!TyTO7j6dWQ<wiR)Vy(!+3D@A2&nAbX$*_zCl^0^_SH zZS8Bjj|=oF`kCPG%W`)Gz_O?7CFhIbhw(}IP3>25dqdKV*z3E?n-p|IG42ZUnNok? zY4K{y{27bUT@#|Zcni!tIgjE`j=-0rl(tVlWEn>5x7BJBkt0iw6j^4n1f2i^6ebo; zt^&Yb##}W0$3xhH&Nz*nANYpO$emARR6-FWX;C?(l7+}<97Ay#!y%BI6^st=LaJ>n zu{ORVJ9%`f*oy85MUf@Fek@T_+ML0-0b$lkEE2y8h%#P^<E#sUGr^uAAmf?6z=dV+ zT2fn#MB!P?mV-Ijg(2<QZP<B~3_RY+-a>X6+cn<CYt==OX!%7nR>)IEXa@T7CQ{fV z-{^wJGN*+T!NsAH@VNM3tWG;%y{pV<xGCY<FKd*exDmpl{T&W#b;p$ig}qG|?>F2m z2*0+i?o40zSKVq_S18#=0RrJIse+;5cv#a`*`wNs+B%Ln8#e0v^I>7a_33h?lHo14 zg)CbDfGMyH2cj%7C`>|Rrg;U?$&y!z(U10>(dHKQsf9*=z)&@9u@w%y+e@*CnUS|E z*O^cQqM*!sD|e!u(yhXPi$Sl<$daf3sq@Ie<ZQHLniQg<q{eeW>xafxt3F#2R&=cK z!gT-qto{oVdGUIxC0q`tg)B-Zy(pxGx}&svoA}7p=}jb3<Deq;uYCwnOS;Rr-^Lgh z20WA(rh{XxcSiiGTc2H2eqX4eS>jEjQ!v6=afKI!2`&M{#tY$~3LR}#G#U2up2L{} zMGSX>Yjg6-^vWgeX0i;Nb0=gQmYa!|r0rRUshm2+z3AlehjfTqRGnRAmGhHY3`R_@ zPh4GAF@=nkRz;xMO3TPh$)9Iq?Fs5B@~)Q<G^#^w-p1z4@tK-Tg<F4M1#K9OBJnk0 z+Ooh*FXc;ku~92E;V-A4fXBlIVb(;ppgmHu!r^G8PLCtrG%kb2we(sar!y-`MdAy{ z`=|e8**Dv6<X|mR*OrwDm@5nX385dEvX#Jf-n>IntSyeBy^10!ts?9Z@tK&L6xJd9 zNzaaz<rXw;6ED)9yFL}aX;}zw-PcebRxU3jIEY~o>6zvrtr&MPQ@UD)njFUtFupwB zv+8%r`c@#asm}cKW^*x0%v_k3faHOnRLt7vzVFlqslue32rt(NNXnkS+fMSM&^u)8 zC`p{on>0pf=1id|vzdTnBLB;v%*ta`o_lzj21u+U-cTRXR%sxE%4k<(bU!orfsJ&v z3FLM2UT_*)BJm1^W;Z{0<d(!lZ_}A{gA{p}>;z^_e=N&QXSO>rdB`*cp>yGnjHJt$ zcJd~52X&k1b<-`2R{bqLm*E(W{=|-)RTB*i$h4TdV12@beTkR&*iJ==ck*QlFiQ52 zBZ|o_LP06C?Sgs3VJ=oZQU0vK6#}f9gHSs)JB7TU2h~}UVe%un<qkD{F?01SaaNX7 z)^EWW&3Rg@z9Zs4r{qbscuGj<-Fl||#+VyPb-*E+wTI3OW@F;)#D4fM>JA!URBgJ# zI~26)lGD4yk~ngKRg;(s4f@PccDZaL{Y=%6UKHl&k|M@Zc4vdx-DX4{belQ);URF? zyxW+|Ziv}%Y<r9Dq}a^~ObiFm4~Y;n`Vy<s!I7z$$Hlk&*e$o<6C~KU;}qG?cDDWa z>!sFdY@YO))Z|f34L(WjN*v#EfZHn6m)X@;TzQ@wIjl4B_TieZY}qY`mG}3VL{w?; z&O>sZ8)YnW+eLuW@rhClOOCZe2YP@4YWKN?P{c~zFUj*U?OayavPUo!r{uqA1<8h! zs0=rKKlwJYk~34F9$q6fQ&jnw_|@cTn{_kA8sUZ#2(Lb@R$NL*u>08yYGx{p6OeX~ zr7!lwGqMSury(v5=1_9%#*MORl2apGf(MQIQTMN35yE3l`^OS7r;SKS6&v-5q}Gw* zNWI*4OKBD&2YbCr8c{ifn~-9w-v+mV49W+k)$jjU@WA+Aok01SA#X$Sspj}*r52!- zNqOS<0%uMUZeSp+*i1TEO$KGKn7EwzW=s?(b5X^@3s5k*80ns2I2|bTHU+bWZ$x;j z`k@<m7i|D;)p+5h2=doQb#<n7oFI?h-8r2Le0MiDcODojim!C5C7&lD!*Tb;{j^M! zwo4_dJ|LYnc7;R>>)1G#JgT=F!8awgol?DqK^S4R*g?<j)Em0v<Rr^iEUud)JcOH( z;j}xl%Ki+t#kp}5-1LyHCEG}dwhXenu4yedz7AtrlzTlWS~@$is%I}VLm5qXh=H9c z=RD{ouN=1VZE5UvE5AADipriSPn0vLPSj+*b)YLV>e}2rOYRVMUKKxSudO(hOLnnL zQqpxPNouLiQFYJs3?7!9f6!-#Pi83{q3-GgOA|{btKup4fYDu-JFOK~Q1c3KD@fdJ z?uABYOkHA^Fc~l0gTAy4geF<-1UqdS=b=UM6Xi30mPhy1-f^aQh9H(jwFl5w*X`Mh z=Ee5C<tYtM&3HgW2B%f^TRXT=U62{6MBC$8$4Z|{?j2f=zZggy{xnO!otRFog--_9 zp;oV#6Ml}L5D_jvr_=ldE2?RSY|XQmVlDd>?038GEqSVTd!67bn9*zQg-r8RIH3$$ zf8vWEBbOc`_0U{b)t)Toa~~<7c-K_=G%*iTW^?6mj9{#)<L8!847Sdr#z3mABv$w= zEvStNJ~?l6I@Kk@27iwDE^HS$6ph<mYmV@yOUSNX1EEp~l?On9(o~Lc2;tl5;RQ9Y zjkp8xA(PaCi5E)TBzXDOUUEn0z7y?nm3B)!K6veo!9no=A7=FnV&NWZ@_OCgt8Z-* zR9P?lL2XPGWimt_QAsr$D9B_!LBI3p<p05_)1XA)RxB@nlp=pHL$;+Vb^E1Us>@|# zku9R^IDzbzzERz~fpxFrU*it;-Iu&<j;5*?pXVX-!@&XPBzIw**a7Oi8iCxJ)wdQB z-72`zNKM;jv``!`ozd8#?2)|0QkGUfElI&!1G)TUX6cXI*Q>m!CAtM&$)6^2rMyV4 z$+e!$(e)!UY(Sc9n6hkr^n&cvqy8}NfZz+AQc8fU9lNczlP>5D3qzWoR55YvH94^* z-S%SVQ<IE2ZA<>96pK3|Yo`75D&85)xij9Dl8AO<OG)v-)LY{lc$!e^^sZ4&kUDTL z^8>8{J*{_yhs-KtsLXUYqwieO(nfrkB@%|OyI>yF+1G?m7>X&djb(HBNNw3KX;M<Q zZL^M3x-GBRRlsrxmBt?Qt3_3n8|H*!`NZzQv-X~G6~2==G@5ah39Zu^LwW_nQbk3# z-gS{_`P|gn@Cwo@yVPf&Tulp7%VS@>a*oMV)cV0xzxmIy+5>yz>l_LLH)VyRnYYce zw$?q!hJzX0TlE0+o5QJDM~sPrjVCN7#|32#rUkc>?-eN6Q0RqQTAl~`&isrQg)ass z+x5XapaYh{Dj`+V096?w)w2!Cnmh?x1WmFC$jEFY4;V)XAl3*tBS)V)3TbL)g46_g zCw9pl^!3OCTOcaEP!?==guEAw;VZ}fE6K-;@qD-Rx~td+j(N>)Wv$_mq<O4G#`)_D zg%4ybW4PuW2>FTH_wVZNEEuDG!0T`HXLsf+_E=X3lw4`_&d5&YMl%H733ckO){vZm znF<wT-MSz)%0zh6H-vHoxb5hdUc&M}_nclvZU{HVN=o#;5dP|r)y%ciy(qvpjJJvY zFPLuYy}zIz(W4UF%1lwDB^|<#*Js%z1-~NS!lW9UOtvABw4uH1lE0Q}&5B+_p|MQP zWQ5y{y$#BD9FWrQ!2?U%&A*_Vp;=C9mDx6@bF4qx0(m#y8VoU9b!eK(bZyymm!B{0 z^hKOxhD1l-sIn<bUyT5jU0GYC3{4xaCT_doFRk*bv0S(zBv-DrE4P++w-{Hs*`hrI zUXE)^(!e)|Okq9Oq8x7%Li<C_Mh2jl2%!%z>LS`;5J#^`5~unet`V#*Y5In3yb|Ax z|A6b^F37!_z$_{6h{7l~<{u7{Fx*A*#zw{GD)6e}n6f<|)&7`S-txiz3Jm4S5hV&8 zm|Ncc{j_~`^pQ*I#w21;(jwi8GnH4efO;R|r4<G1p%Ku<jzuUqgF5G$#u;0Y_4VKy z(y0*MvA`MV-?s}9tXk6{f++pmOHa}y`+-3@Seh2+f1TuN!2FS)^;MgoZ6CF?HKKuQ z+SKF!^o2&LHFUuvqQ}h6(`V&A+69=iKPfqG;f0Zs)@MJ=ChHlc?hBZ+R~fr{3zbP8 z=F^FEG2*P{{(y((i=t{)5Mc*ZZc?^gV40BhN0Asi<H-J;I!<g>$tH~i;Bcmp^sP9) zjhJne@yzU&XvFNoc~i(wQ?nE`o6Hk~!;x(%xh7?zvigH2g`!v<HwxDXh*xMMM<3HW z_4L_Fy~v7Oy+?S3!Iq}+)$tv#C5(_ZnW6~n9#W&J%Udh6PZE@~ho88dPWG4VLjU#d z*ZMl+`1&p|7H1c~Cbw4~{?qNRP)w;Tz2zQOmeZpFR7|6^L9j3U>8L-vEN0DvV3?m( zSW(TZ%2AWf`rS}GGMqUj!8yCp#|fR--Vxfj=9}YD<U6o`xy0)+sf@3V>97Gocdj=S z0zkF-jsO>EcPTB1zRO$++k^bH%O`=UkHdHT^5?{$)ot<-K2XIE7js*4OjF)BsVjCJ z*KN<g*T3%mQu%p*>)!FdM*sh=fB$p8*EzZmGJp?B_=a-90$FI{S$LLjBU$(lxUj;9 zIBszmA*129W+YE;Yy{J~3u<Twd*;f=9Y}3|Z{SIuZ0cY+jRWz)tb}ITlr##&NYEYC z=%IE*Kowigv*k{XF8F|)GRMAlI-`F3SD9!P!qhNGS)Ep`PBV#qo)ZBA^+Bd^m9cs~ z$`4ZiX~slGCz}>yOr<2A(`*cu0IJN#tmUfz2jIWQi_h)_-V6o+5CjbX!1$lz6?QYU za&|O#F%~hmGUhil{M+J|*0<3&{a1%ONp-^!Qx*LOTYY}L!r9BbTxCjHMuUR0E(uH` z!b$*ZMdnB{b2vsb<&P6})+%O=%a8@~$fjbtfF@Z>^Q@enTOJ%V<CRnekz2@P*(BWn zCbTbLtoL3pIvQP110{Pmu@v|7nq&9FR?p7M)w}G^*B34TR$q-1SA?lX?tyyKq=lP| zD3b1?os1~fOzA+%;&o>T)Rdc!wX|@iq9i}HaFZAeY6g8xGZY7h-r1sy_<#YU6}I?L zwvf0ePE5PKbK>2RiJOFO5xNhMY+kt`Qi?Oxo&@xH$<^Q;Nb(&rjPBAcv;XtmSY90z z;oIFFl%lDq$o&kYQ;aSHZHD@W({Y1hw<-I>7f_X8wc?%hNDlo~Ig;63RlHNhw~#R3 zA*f5D_Qo`4_ajY4Gr{mLs*(Fxh(U%oua_u3r%`H!TI)@R!!iqV8IOhIOzI@=7QJ=G zV$(9mEVL(7DvPn0j%_cOZN|vvNg8*PHma`6+oS;PDz%iOFyo0n0e%$<#A3r~$=I0T zDL*{AREUGx&C2}?I9cVL`UcPyawTqA4j-4%Mr-4`9#8GX1jiJkKGpHVr1~Rj#zFaZ zqmE!<|1JCi!LDG?1^Ys62xz(p;Uu!QZB7!C0#piy1_9=e?^s@-sd1gs!h$;Q`TNtf z3N4Elsgl#={#U`~&}FNvH78MLjjavl1x*4pNVr338>%sfHu>bxo2#eZN2ee9q#*Jg zDk_=OBR;8t6=pBN0aj)&Nj}pzqqUYW(tfk?bXTdKbNQFSUMCyN-!b0#3?Z;ijzx$M z^Eo6Eq*NO!Y8K;84H4MHj_xwBYc|3>+D(PFj7ejhECG@5@Pk&8dG<)HwwO2~j7KV6 z0$s}=*D;ek#8$a*sxVlC_`qFkM0%BQQ@v2H&Aq@G9XCQt^^x<8w*=MbZV)@aPrrn; z`6r*&f`x&1lp)`5>-|-4%l&W4jy~LydfN;iq?Y8Xx>Sh#2Lx@FXo|5{WKp@y-x;)7 zl;;<Qz|a;@wP~yH(!0er%z<lyLwxk~5K2ICIx(q03AW??arZ^Re4=vD+%Qa;I&F4g zI?4Z}!kS90ccrTM|0F)(Ny9-x)u-w(Q0I(6NYylHaaesf-hgEvl07qa8t-ycTfDaU zx7ce8&_aJAsH)F$^4CN*dou!oK5rsAM1OQNDH3*Uz(&F7NYT1oE0o5oWkLM*;uv*K zt$dbxIX2IaJ4#gFKbn?$aS7zCp4~$VPn%r6s6ueAExSADz!%@`ZRT#}|J@axf)XB9 zJC_Y*Qlfn4E~S>_Y*-Nu3pcH-)p0(tP~3xO_u~>HpCdEfgyq7V-!ZZ{?`6v_b-vx< zuu|gm5mG6c@D{FYMLuzvG+A2T&6&`n>XM%s`+Qtj)5XdpyFOnz3KLSCOxaCEUl()M z3b~FYqA3FT1#SY{p36h%M^gBQpB2QzEdtM9hMBMRMu{<KhV173&yh!JiTXWL8LIaT zOjx!yF5Y~@2QX6?DmX7nm~fkm{Z=drRxd2qWGo6EcEsMotJG@|eCqE$8T1IdA2uFI zn)L8bboxf1{cvO<Q@CY#O@6OuFeaM}OS3a6yRyDk|7FFl&M9HVISd!A5ySJfXB33< zH6Ltk%G1=U2^SZIu+0}{BiC(|w$#xf^zkq58$yREuJUj#$?~IEG^NJE=l2b^_JBhx z+Y?~cTRocOh^0T{LyC78IFM+nKj{%WgVjn=P|8f&9pPIyl|H3PkJYSQp)5(^7|$-( z2j9D3tgu@G8h9loVyBQu^A&ug*qw%WMLijkRx=5$S&Yl{7%gc(JqLz!!&uGXuunqr zLPD-~Jf+!(a!($Jv3A~xOXDDXYyx;#rq<I96eLi(M5<|vkQdKDl#dvek6<wl%igd( zBCtLDygreDi)2j!{2JK9BW&Tmw*z-MpB$g4!?h9izxxVj*{Wcm7cvqE!aG-k<?B!l z_W^ErgCRVa$zc;t>|rf}(;S85&|A!|Aj}?fMKaju!y>_AS}#hRe_!&%8V=6+oPPtE zOOJ-Rcrf>hNq<InXW^Acyh4TC67d>@lG{{@$H?6ikt@!A2OePLe{MBIWSPz7{u(I} z$PXzD;leHG?Xl0FnWt+Wr<rd)0uIC(aO;XiGnyqUc^y$z?J9`@apilEzT621F50PL zR^-affr-}-;(F?Jexj+E$T?v|csvv}yJ`y-1=;3z`s9u;FtRFIE9TQisLKt0+W|T| zad(XQdi&&fvX1gimra6ziGzr)?_|StV|w^6ZSOyqK~(O4_g6yx?yvke8Y0pEC0kQ= zG<FcPwKkTrwY7A%`=^FTaYJT<51t!}$R)~uF;Nl{NrIfHaS(KU9!fZ0kB>krk*|<T zm_!{ku#RvfFJE^l5~Nhj`%<u{teoQ_ND>e3P~YVF@N$y<VvG03=NpJF5EN8CO5Baa zP^%AQ9{~YUAT{w$t5R2JHh>&L929cc=#-!*k)HZKDo8!#+t|?9p0z1KSDKclB<j;< zSnOn_nFSh*+F1`LqurW=nESvpS@FG>&M6~hN5<9~^DIltXKR$+iK<Ozh!vaHa$Q;G z>*h9k$|@Qoy9H}PSI;b(v>w`8(k70@sfa4nRweeiwZ-syP3zPSsyK_8Te9*(FQdm+ z84ZDah4PGehH72w=Q8bx;pK5juT67rJKb|ovD#COI^l6z0eBidn$!Y?T2;5sN+vTV z$`%Edb<%-Oq@NPZy<2Z3m;$}!9JzIuVK6;fJi>><V{U}bUe=tba9BbGLiTzA7eS}O zEs!1TshDr>m3q!Lr!2xXRq+l0LvZIR_PNYrP57E#sCvD^4UU2GVr*Rx`QcT}yQanF z3i~!-2Vkk4S%4Hd2baDvrM2g(&1jZaA1!vLi!I#5wX6g^&PE`0-TovM(%wuaPXAno z`a&j{ai=TsgKpc1C3|)tY#!4>SPBbMnchi}glCBwaNE(4`gi}JY0;`|m`s{HtaP@& zHxwCt#2&z9A7O+=v>za}LW~}G>_tWo$dsRX)f1L=+tZF5E&RBA#jUC|N9ZPa_&z5= zekCOsIfOh`p(&S8dnkE~9#(;BAh8qzi5JYT0nP7x&Hga3v`XFdRN|$5Ry#mq*AN$J zV)l~LSq}2d{EJ@%{TLnkRVn*sdM{_b|4!x73|Ux9{%S;FPyhfZ{xg;P2ZmMuA*cMG zipYNeI7{u98`22!_phwRk|lyX#49r%Lq1aZAabxs6MP79J3Kxh0z1E>MzLS6Ee5u+ z@od~O#6yMa;R}eI*a|ZB$ar0BT`%X4+kyxqW4s+D3rV176EAsfS**6-swZ9OIPRZ& zlmIH>ppe;l28`Kd0z(alw^r<%RlDpI6hv)6Gs?GIpffKApgx^)2-6jAzjZE0BtPBC z0z8!#C5AP${zTF$-Z^v%^ie8LI*rvR+*xc=>fa;`SRUSLAio?qL;jVFV1Bw4K>D+i zyEQ}vyG2HTx>W?Ul&MhxUXK7n;yfN)QS`foM!4>4-(PGwxW!^^UyKOz(v+1BejI*& zQSkV|m5=JF4T0k*+|h|3dx`ZKBVX7H4{5iakAxnD#J=9igW@LS;HE_8$lZy1l|$wX zn<8-$u=7&li+^MB(1y~Mz7lj7?oYf%1k{wT#?(Mep094qqnPv7*OYkQ#7$pkU5U24 zzPLEwAb<<WoR&Nlw`OCRo!3>VIp_uUE~+r5)jt(>>Bg48_{)twH$QJDSBrUS!j{lX z)SK$6dfLWt)c9%Cml+sRp*OHXB?e<YL%nKD`AAfR55^ByJME|HKb?>4hbYZQo!@=6 zBPTpi&6&atD*#Cn6f@5<>79Mq7o0^E!NH)bD26g}?@qg%*AYeE6Tec@F?y9Q8i}^s zz`)l`8>;h75!kL!`&*<Cny^?$4#8Bbz^Rj<UZuvxBLNOENOw?+Y)9a4NuYnKrPi1- z;aFNQBSLVm(ME4w-NKhLSdhpfirJ`XcIKUEjk6$hIOg92XpA)f7NifoL_0XapO0I} zX^FjDP!O(linG*Rj~U7sKAV?8wZu)jVnS?eAh3aj7BfEa5XRr9a?q7dp7&V}E4EJf zjO=`cLvj#rX~~JksAh-kp58tE`Wmu<Zzb14`_rEmRdp`mkfb9wxGje@y<REs#!wtA zx%z2uQnW~&@>_hsX1%2)(lWr|7!}@gn%MfwY8vN0=pMm3WesCRv5e*5m4z|u(zb<a z<hzW!8Hc+~5!b;%r;imxC73kEBD`Far0GlqU&(W_5t(`OF<afCTSd%Y3K%Yo<w1(U z=KKreIbU=DF>YCpuxO9$bY)hkL|}mRj{3dlRgNK)#PJp#vR=k<Ex81u)$5OX?%u|0 zOu&uBD^9m;wj$6`$vpi4irSYi7AFjEFC6nHIIqerB24Ul$z=YW;9^+`7`hM)@4yW5 zr@#R19VHAsm+%0*j5(Ws3B_wu$j)vHkR#XRdHfL@&dHt&>a^TZ(tKVI<>M~ekIfd2 zm3UDUNW*ZvS5L|SF334|YD>LJk(EqgPpVxtzwclUNaH70zWDVt^1+cz|F?RdF4HHn z@4~Gs`lj!0dWi2n#>7C@B$Q<wpK@Qa@7|8Xjv?fC!Jhr6Y91c`Ad+yRc|YkmvV0zd z@N1eZD;xjgqMOX6H0hOE|0p$ru9Ag7lE!O{qPw&bgtVSxMYdGBOX*H-97G5mQqqY{ z*f%6LYn9wGDgN@?to?*kP`;J;$YbK~a^1{wUHLzuTO%@P@|uW>f7|t{1!3mtrO1H7 zi{=I#^Oa1jJiF<s{+1D`W#Q@uEQ|^u$n>I!j>PualW+ncHJ)TelW$bv2MqUG1xK7R z%TsQfTn)7D3}XYU+{?Hq!I&fqi4>DmryMiO?!aN!T4fnwq2vsuB^s6fPW@u*h-JwG zNniJFR(RI*?5HV=tqO)lv}CRv_eNEBR%z}Vnftv0+<L2TR|d~&9c0$|63rt}R#`&I z(}Mb-YqN4psHxY)BHNtvE|HaJ{&w^r-nDl7*OHiSc(6#W0xj^B<mPz^7AL`As86Z$ zdTu)l7LmpYF0UcII-t&#l<w6iiL#=825c&`kAgbp2ju-#YuT1M#4B-*ktfQ<tDw<1 ze}=5f6VQ=TR2w*oj|W|g=La1WG+NxSwo+A(kEPn{9%(v>DUH^OCODH#&;{+aw^1vR z-c~|Mk+o?j-^Z+rR4s<fWU8E{OXgT6m@b4f&bk3mV#sq0#Hv!gtIJYN2h`5GX+ke> z-gNA5guTuab7N`{Y@eT&)!xF8#<YnYQKehlL|Kqf9>AeetvQ6d!W4BlO;0#0TxS_( zMm-A-u+h7-PjmOQHlh{Hxn+J$jh?uEtc8RG8tu->o<eV4;cW9B){Rg)FmgRhNN>g@ z86A%eUt+P8E3oLXIrq#K(nCF@L12>=DVT3ec6Vn=B^B;>D=O%op+0BT;T)FHZ`I93 z^5|bpJC_kB92`alM40Am>Yz5o1gxkIGRYQ)x^+R|TCK)r;Qyq6+~S9Uy9nr^nkvc- zxw~#_9eBBJcZNK0yFZxUK4h>u$8;4k-KpNTblRgS(y&u~u&J;O!aqAMYJp+(BED*d z^I#F7vPOEADj}Pziprs=a{%qgz#eso$j`At7p<W_8t?MLKPKsl80)I%mY2++&U!GU zrt?3swTZ-+h~N9mFFKg!wsEP^yexxyN25#GR-^SrnGl!$(V&k=GfGS9yMzwlubwo2 z{`EB>N~bDw%&ba-+4pI}T*?w-z^_~DfD~Z3Tg+#M#u{s&uRF^dr5RFZh7<|WNEG;P z-_SzXTbHc^yD$r;WJqqJkA7^(zN`nzQ5V16nG~Zobuy)a)(T@<ha)S<cs(qVX&ObN z2UVTBWWV+20tc%<OXgDKjf+FdRfQms@H1TiA|=cT&G>Ik>V!qOf<yFMm{;2;Q41`F z5eqDf$B&;Z(fL<ROep%u!{R=O48j%AQzT)Z9T7G=5J}J5^QZ{BL?!t=1BV0BUiUEH z03C*CZ6eQPeDZPJFt&p9ke_v_;IHIaFY`qyR7jL0zX#_<dWj_3?#kY#wZ?LT&*Zir z8WiG{n9jp;hfg4ZRrauCsvRoPJ?P{ITj5;tT82Q)(7JN8YEC#C71)@XIjYS9r>w;e z)?AZXjzDJg%BkIEY&bm&BczLuWY~k}3Zyx#)jxg1A9R`sz!_dCb!|13b*3PiA@(E6 z9HmG2R>-YrW93UMQO}XE4loI(*er9J*wDUd1se!pzdp<L$3aT<v1RADvUBMM+QQeJ z<z{5S)X%p^dzb8X%ro~YV>oB_v6^lQl}+!6e5MS`+bU#_b*a5Pkt;o+lOV4loyn2P z$3;z-cX>$R{6M4q%b}aMBF}6N+0RCE70bB;XwHV~JLO&!EB)Cgo9ta_>>Os1HNfaY z4PNu7BGhw`6}cm>glh6i^)Ja{rpLHix?C?u;(e&GI{?!E7$9hd*5c^iL?;6Kwn z@qbBE|3UMF|F$Ok>7YY?CeMzMes@CZJQ?&|R8v5M@XvW}jjxhjl`gzl;rvy6Nn9$K z;1TKGpUgZs`vR!t-sD~2<GqGgCoXc~OBH8i>ar{58-;2k`H(MIWr_cujtSCpjue(R z(a7R{q`G+;8qD8D1e?1zWv+pPFtk=k#>f`yqZo)3KwCBgABgQbq%hu4q}h+Bdyh?* z#Rlr*$38^Ru%m9FUTQL2Xy^j|f%*4H*{zWFRsMbs6@u{JM{48fq;F;QFV%6Dn!6X0 zEAr2G{RmY8;Jlmws#%7Hl_TvQMbLnN0KGK=9)1u=Vb&#V27UwM#U+)$hn#hlXxBxO zM~<3s(W;fe-0%mVWtZ)oN|h-01@5z=u(z!V>)I9-IepH|_q6NR_DA>2hxGK<NnR*m zWk2t+J}{L{{ATAL%!~{q)|e=iLSn4A-~C}h1q?=o?ha9+Eupsr*SeFGw0p-zn^-5u zu;>t-QX;H6(^FXwcBndi1s%qn2sH-rsuON7*ARP6Qt$2XIy3d#cn8sLh&7#USTFn3 zQm-o6-Bnofon2V;oq-v1@Ye@NuH$Z~+th}Cs>F7=H#=4PKLp%-!EwR&0`a}XL=br< zF>&?HNr}9ahB-EA7a({^_6`taBwmB~hJG)p>8r^vq0J_+o`sOq<{s2~2t}W&1f5`l zj;E0nmt?YRp{ONhti9{4&rvt5uoS0CO@%+Yv>+}ROQAGP3VLu^S4fe{ZRoGviEXMF zhM=I=Eg2~^5PIwEq{~Wt?inz13!axZU3knx_)Ey9<)z<=!TnCPHvs1l^spF`@INYQ zY|J1RWri-^D9mVY5Z<j$Ujv8AlCwzWydcK4C|+vv1pTa1iR$dG6=ZFyb~2D_cqt9U z3LS@qozPiYcF)#+d>{u+bXg#}3rUwSXX>&@PN+017W@!L5H8CvZf0wZxQ=UrHJ{Um z$Z;~3t<fSfV_$nKB$9GL7$e7eGk`|rFBnpk*l@Ms#aN18Lz{qD!dbS8_3AD&uT#ok zHo!>6ARGql*O1^YY(h4awy!h_brE6&k9B&5l;ya>jDyW5?o$q~=1iV!t7#8&QOx6P zhQIm55sij*Ef-G_?k^$AjK2j?=QQ?^=r{MDaGZ7`Y<Ik^MKRub@OW%3<1o)yw9XR$ zV+vp_%4EHfekP<b7G7B$#O)B9)Lf8$QmAE>o*Kp1uoZ=&5|O)D#xAHL)n9_l6-E!b zVV@8ny;`XU#X2((4cTmv5unmYzUmJ>Hm+Kvht&a+j3nr!sljTHUZn^0w@L|WKw2TO zRO>T!>jutIzNI5U_KL}vd00oi6$aJqPeJwq)lIr(2Gt#52i@sqCFaWC)pS$pYoRCK z<Am&vynz5ok1xL>d*$)r6FCClYp+n>gCqVF>x)ghAbl+h${~Mc_sQGk@+sR@b(88l zcx?*Usr}v|kV!RPfS%HK>Bn{7tdEV$CB5Z@=uy4>^(o(%@R|_7dq69s1(X_8szPZ! zSS~$LCX>-}F=io=YcY~9!vqo3&dh9_Mosio<F(tfcLSN-U)Vcue&bvsEh=lKD6ppL z6qI#&c+@~lX-+#F)tl51AhP=|DK)1x+fWoa?xN2jH<zYk=E_8&m7MhuZz-RhlB}ae zp2uQgS$=R_-5V00)NB-;DWBuTtVMJ(!fcu{Uh;g;m+zjEJ{!?s_s*iXMv@daoQ`1Z zI;?<lJc#B%Wh=hBo~~fr)9RCQQPzw#tL0c`1NxL`dLmHoc%e7WFdx$_=^QdjZ^2Yv zbegXruBz-cttz)ie=L{QV3DD2Jz!-4#s0>`zO6i|$&p;-9%+~sdYNrVE?Q8rS+eHx z4O$l|b3FUT#2jb(WU<`oKAjGQUsoCgE1(c>3byBNPhKeJ7f4S-hBRqRyePY)im;>H z)hyFuFTDqx*ZgXo$hn+u>TGs~=Bjqr3bhPmXG)v8){EU;N*58NKU5;EIZ<q#-eG>l z9%|JomX+b6M#jS2`B%~!+`EStMD{|y^P=`xPbD$o6;|!((h!+y%7Y{DuC!NCKDIN1 zER-J?vZ$2el4y~!<J6G}$XW{+?MSbe>-0vWjNRoC|ARB`IX@M&;?ZpULcAIu`zlH9 z&JK#H);Ij~fqoT{59}OI#ViA%!lPYyd@kHg*hyI;iMdCtw2&eLHOd1*N%2Y!BG*H_ zu@E?VbtZlI{7B{C>A^b3njh=KdF!=rQ!)oIjwkP{t^I{2q&<K(evUD+TLJYkvRec7 zYZ$&1>emQ-C1&U&fPC_viACTbT;(A3qRJeGINz^!0N26vQ~o|#pmjp-Zq46%+{X9n zLGKqhLh4`-(*oDHqHU~-45_+pe(BICF$*0jD&FW?ED=vn=t?p9X(%AH9+;6NcJ8JF zASkf}LfT7Z3u*#i$ml`gKIS>3jrTla--x##EDM{w{>Iu9qV!x95ECU*W_O`q>hcCa zswU!;H3R{}(A6aQ(B)lImTF$BzF;$V_?It*+8ZeiZa|b8n_DN4jUfI0jIA<yNEz-< zUAZU5rNnB5g&~PSflg90>6Q6*c0f(uq~DxrNm!$~G=Uz=qP*)?qc(}|7MQZT&B=Um zr{Lj_R7QJAlwD=CoYpjQsUyu1)C9p5CE)%3nb<t{qTHZCa3>)~WtP;@6(qGG`*qDT zS(zM>&R<;Z23V|80%3s!`0<bQH?H)~tkw2Eq4I%CK{w1nB~7P!a39`Gm_(f;5IclH z_Xj~YoDf^25IZFhTd@e;xP+73;-x+qR|XI^C>QpTt0Ay;*xLJeE|DP5@x?a!1)`g= z-1}G_LxiiO(*?R*{(yH#&yl|Seyx6*+ETayQtv7Htk3WPvI;U!@h-e$)gw9>pyKmB zk8#$3BF-ou%=`9_3)Q`0ttk$cymvULFS`Khmjes=2(-QY@eVjJ)rSD)z)1No&o+dz zrGItPZ$QuD;Nqt~U{J?9VlM0g{kx!4$?!?=o?um>#7tjMzrLfv<@pI&cp*5H>XPPZ zu8Xh<Y%l^G*aDwQBur}de;dit5r?efr|696x8R2CT@&l&Cx|39HUn<!vQ|CwedGQ+ zD*>&6y7v0pGDiQqd-~tBjK%-SO8$8kG&44|{09|FO5BoNkV6~JX>g{b#NHJW?gmM# zhbcS|M9fDc44(seG%$hK#va#4YL98mddGDi2qr;@CeiWO!!`DrF<%=_^*3JgoZiSj zdEv30G5`7ex`XP4#6cG;AQ}(|>CcCTGiom^pc*j-Mz1_oGp4iP*>N125YeWCw#L4H z*>u2Ih8jVRJ?rOj-7KbU7KXpYs2UZf)Vf}(lsM(oiB>tgqX2tILJit<W`zs#E>w_x z&7gq;`b}qrL{lEA3DaXDOi~HQ!^?xxjjVW|#Z+Ek&GKA2dYgO@zB2V*eY<n7t=eX> zx>@D06X)(FUz3xz99V3v*k7x|wxiFxv>=N$1Chfp>CErJq)gnf=P!u-QKrYnulzdQ zP56u!AH2^QVnuxTJjcQtlflq>PSm4C!$^fv4V_XsIO2d=O8|J`4bUDtjBchJ!14~3 z#mgUPYF*Z?k;Y)Igdx3yQg8L)M=c%}p3!P-0KOuXI+{*LXJ&w)$gzxeTyr`)h-Nc! z`$xa<>T2pbuU0VR?#FPEM44XDRw+cM6U1R2aLQpGHX40=4Er=lp&2aN#P1IA3|r+L z?5jaRyCgN)b(KuS+(x9rPLLjY&4^YY{0T2Ai%`f0p}sG*R!}{DSf7GdPJ=C2MT1ND zUJ@#y06`CNc9n?13R2KY1K*SYeV87wG%bjcIbn+AR8*FS<{?wWomTT5@`}~z3bFAJ zLR-wmE$iwwJ-Tn<Q5K*6H7Xi<7gjmiO=VIt?rKq7b!GrN6Ul@)bkLRFm0!xF9aqiP z9_Pg)EI}1<$M(ui^AkIKVo;qp+t%8pBvqRv=D97`;5VVg%UOaj{Ceqs=^8hD!q*o5 z{b2y#Uku~@H)X^>VEhl{{?+??DJ?DWk~VaX-L3-RLtprT2%z-GfD{UVBR~T}zymA0 z6VZ;1Qr%5q#+Oz#3)`D(%WVWWS4BW6%ZvAtt!u25FO@e{X`)_LH>p&pFzx(wvNEO- z!2$Z}`iynmY<d2b`M>2j&UCmRNB)9Cn3MXRls&PFVHzkzr;)B^BCMY~6lYY>0rsKT zm4}RV`Q7tbn)Aseay%@-I6ZT~PBsO?D|>kG*%(PGo=|gZ#0zsmE})xxtAvaCe&$1? z(7GyH&^jm!cguuMo@CPA&-lrdE&Aq8GIOuUK9jt{K0ldcvJJp7I`ZMx-EYj$)hl~) zFM!U~HxgO+lb$1cIK-nvz<5OPs(@d4tB6DUa3?-bJ98|dv-kIdtMS;9BuLc{a~_wW zO$u`rNyms<O+qXSuTB+_W%5p)Jq_HP^8*g_)!h=}PWkkjk27Z;>AeMH9zh(|w=<*V z&&B{&O0Am`<$iBa)>pNZ6cO`d^3B5%=gmsH(HYZw6!U(c@}#)19F}`BT+yOfamJY$ zYOmy2m^k+ADH2klhAJMLq;6>t3)NREUgk*cjJHg{NBkVhDORNK;v5362&NN=y*Ef- z$vxYTG5Ga{SI&C93^Gsu9G-osqbC9PbsC&@xxGlF?o{!rs9|YpEE?P8ix#yS`7JUy z%ez(_Q%I^RwPrW%rFF(+mE}rp#Wtg@^>O7T(@LFA7j{LNrL=XGDyB-|3<*mqLL_UA zUZz?ulF$5O59-WWZ!d@hRxC@4d6?okW%`1$#<5w9eh>4Cyr#xe5%VPG@TBe#HA^O} z1&q{T_TMTr($f<()ah%TXapiGp}`MAC7>0I=Cx*t+bXy+gMyk*#(A~ft=&4YBdQki zQ}I=c;etc@sD4?l`eYaksPtJnx5OUaZ6u;7p64DUuI`omrWjht5$8+cqb6Hw75WNX z@D(fl7tDl2H)H%QYyX3>cL0*DZPv8+ZgaP7+t_W}wr$(CZQHhO+qUig`^@>y%s1~j z6Y)pXii(P=SQS<4iS=aOnR(rqe#b*BR~GN+bMNQSnhcMHxh<oN+p_*@?ZNyQ{F31O z4E(hxex*(G{Iznmp)Gk__F1N9vOiHL^vV{PrPRnf8^HwQh!M`><eZ~9Id5FLsN8(T zWClYsF`O<sI`U$&kp#I1Sy1`gABIV;yhM^m^}tM|Raesy5y-{-dNa!|yaoL08X}v# z=8?LVzU@GDTGec@{th$%Y08sH!!r4Ymb6D^;y=69@L3iOE5?Gb@cNc_En3;Md`9l4 zVmfd<8t7(o`$ZKNh{eZ6&m|E}gc3K4jbKJ-MmJVcjLZ-V^~}_~4VG5H&rI_AV?#wv zKoSJ+qKyM;L{U|Ajc-&GjmVJ35Z=<e<A`nPrUOcwU`$QMY1WdIAS#&~!iQhz?0!Vx zbE2uC;P1zV_`0Ro)qnY@n*2AR@c_qQYG3uaG}MslD)yRHX`%&nhT%H%3p<IB=z6&z zQJ#?9X8{6fu4Ng}+LKglZ!a?ZzQV9%Z37zNYdyhWOdgH+Ak|q$qlV#yI;{lze|1(0 zR{wnjF&{!{`VFq=KczFKut~7<`*bI=QxwS!B7GqsEiWyVw&wML;O5L2I)|_-9m&!s zj|@bk5+hcIgZf7J*V7@0U_DS8!TdgR-a`;m+mep)T+1q~c#7$ZnmSE58r&o!6@W8p zDvXC3GeNj9s(m9|d`1T$9K?EtO~zc!7Z82^b6Aw(X^dvfQ+Hz?eHc}w0Axg#DE$nG zoGT^#Y#x{}k^mh6S^$Lh@A#m-#$3`V+LJT#l(yeygL{i<zi8TdVb0^sp+Vn$WI{<Q z>Vf6<CY86L9HFp!u$yM-M1NgDbONG~<QWI&+`0_2j6e7YN2dw7uYo7|);1uLRqz=R z7WV?4CgAnP>D7_zYs}@<K!DfX(WfX1Ai!~EE^8*KT!Co*K{>oo$eK9sZig1_lH0|C z&<1W;8dh6lutS+|02t0VqRfh9R+%!~9YsQ>cw-uGi!YMSo?19?Sty(u{GRqmTx8Zv zLz|nph}CNn+4a~dDzMog(j+NForDvDjLwub!b;p@dLHSBO0kjaI0CPZ)8B2(HNL&A zdr8Pw@u(POF1J*groJ~!1|E(Gm<U0SF<{bvqbm<z{6eP~UDu5*>nR3L6`P*3C;v?R zDw-pBC=u%}<}P_);mn-_cE}am&b1_WlqnWVzFS;*NhwoOb%+#0nI|H*Bw6_0R(=Kj z;7@eEqYkW2OvWkoz|yY1gZAJw8=>KShthS*ANzYdDT61^AK)>0H%LV4q3}hw?bkA$ zF$tz;<5T59v0Zd$)unmJ{vu_7eGDP6+pe(H&n^3E)g^rB?pn?GT<XDnE%*A{E#7oq zG^wO_f)9^{h?|RO1$KVF*JJ`JPlc&bhOtC&o!4l`CQ_6>9l1gztAUpR*+Kvt=FE~M zq5rZM&9v>ww1mzrK)vx*0;;?tnqA@Q;FBC@$2~=gy#jW$bAJUNIl_YpT)``*9nnkV zF!&XBK8(PeQfnScH*JaYqy{1bN4MwF=&g2)`!Kuo165*d^1Sc_d{I4>6V=>74c%g4 zXE_M`b@syq%jQx9VRp@ba!rY|MRhr!S3bN!1RT}^I(2gXE`KT57Y;maGA&dHM#`4* zy%<P60u?#!lJ{hm+I{teQZ&zA%?=v`TI>@6YB0A6Z^?fg!$4Gq0auM47(jE$Y4osH zhydBwQ-S~vMS7)hg;AC=MRf~AHZu|Ue*bk=ff`!Ol1%=|W-a+~l)QH04q^oeMZHj~ z8$8jQn(n1#O!_7sg1hi;{v%?nd&gK7<l$g#FetZCyif6!)lL5J_%)fl8&{g9&-fuI zz}MTJG%Z3cbXI$Jg<E5E0dl6)`j@n)Jz)^~Fq8EZW}-Hqi|_b2d3Rs8(yL<c3)rz- z6xoiA!n!^AcaS$lgcr%Ad1r!HvKx8#RJ#mI2slyAmPqU)^{RrG{K$}}>tfN3I{A0j zcg`ISk^Ir4G=(SvV$v}DE(nE+%rgFkT%cu5VR0Qa^H4-xPC*7Y*+<jZ^$o*_eeFvF zsTfD%_k_3XOEvj-<agB__e*w)d1E<m;`ZUQ!WT++G{8dbm+UF$SMwN72+DUqPSM1A zwTS#HfvDp*5>E8#xvyepS#xYE+FyIIi0|5$J%mKAB58%MgleT%Zx42e^L`TdA~Ips z=NvgHNpYZju?*J>oNcmd^(nFUc+-bu4*+9)qIwU^g?1_4-&-`uZm&f7F^1?@3I<Pc zR+jZ}=8fI>vJc{gnlh?no$<XHR=hHI%%?`ym%)e<m+sK?buh9+gMBvu!{q@xu@_Sg zL$w<39);`)8C-hm**vC?Zqy1NIpW&I7Vl$$s@COLjdoK=`O4y62~<uW9d$E)1V}mq z&1tG?e|CYuI;ov5(0@bx@$pLnnRPQ^>E9jFIfJ8i+33;o-!b2hD@}}{o}J4{l{44v z3Cd{3Lj%9^E43SBXmIvwsA2_8sXgRu=4=H{j9R(fYcCzOXriTZ51l+HcXr@)^?rK* zmc89=w8MW+txdobBh`X4rMvY#vuv0GIEO67sgL}mIw$pNW6s8Fd<Bov!}@g2V8>=t z@58{pFs^Oz&g}CPr8EL~QyUjk&}1qyO4;-6m0MRd4J9T2r5_j+YdeKP%Q+jnWNdV| zUJLU&d%m|g&3B83R^8K^WM{0at+=9UdVAzTnL+CqdcT#($38|-fQ|BJbHY4vk=ANj zvX?ek_oYp6t8bQz-T){|-5OGrv`IGd?>X*h(s{MvQ{j>fZbx<^-)&(j8(N+z^sftB z;V$0+Wd0oUR^&)Q+2bHfLt#V~jZT$UPU<McT?X43`{{xPGdu)fXen%p1BR%`j);!s zcQ>bkd#vD#zZJ&huG+-;T%sU~ONA?a`Va|T%I0yd%0*Xr3>p#slVg7Y<6o&Bx856S zg;7Q>mCFF?xq_m}VG5`(0fIX(V=yvQ;xjpwNhrLFMui8xdBw2aFOvI3t6-NG3%+d= z>1un%A{1+tFrn2nu2%`-hiqYhXDga3%{ZVkC@ROtTcA;g*E@K4i_G1&^P#Pl_9*m& zwBVKqZhrf4<CZn2jxKjiiI5NgAJti7cg9jZZMx)u3Vl*fh%q=`I#Rf>bhw@M)78cm zBMB!;A)H{6<Kn{rpK!2cr*s82Q@$}Dj(7rR*&p2Xoi)!3DtXgs`gx(6&=g+hePVA- zfr9>h6AjEv&|DGxYRmY|e_ARf_dMIvm*-i4h<r_8tvkwv-mtv3OW%+`67Gbr1Y*j9 z1&T&I%Q7}RZ_tLx5Xdau=2t~nmnA^llqFC`c`kZjr|ST!83-3^#QiGD+g(!P4^l0_ zP|$Ys8$BR6*YL`x-QRAEV-A|)Ue80PXI-%W90G95r?{o0Al{DMWFSAm*&2tnm~WWR zhB~N%h%v2*_wF<)WBhV+&W<{-{1jc}Aoumb^X+%biz)LbtdgCsCEjHL4sZSJ%spEh zwgQ4F)TR#!&1T4=RYeE5`3<M_dH=EAM06^oozPWr&lokjqVj@hez~UoCV%h@e;2)U z75g~|x;*@i!%Rx+mB#bq<~0f^N0kOCtCREd`XCl#6_i?3^?89#>R#IU_#<!!sCCgP ze<}OU<m2Sqkyn~b64uC7PUsbeDGv`CeW!m^IW#FfW2sYmw6ilejtm>A_QYP@L|sHs zo@Ky_Bx6e2??_k;7vjibD#pM*T7`h9V&s(moOn_x^N|9{gkOtFY~gDqSo+7meUjBR zK2jiOsA%PwD|1*KC^m(-WZ5j2AWi;81kCi5t)KouHKt|R6m{m!!n|4YN3yyBo0mSZ zN^yj9>I9Y6dI&$!T7&$%3Ccxua0-&DoNJFbCV%1;h^-U&1Q+@47qrKld+QNGOrh{a z27PfD|L06XuL1+ZMc{_7rB7bd&WD%*lbypj>|K|<#2#t+qPX<E^hRp}5ifDWr}U>H zTm`5QC)ktLW5+G&4lhvX8DgOK)|mvQ_b^HuJ&=wP%Z6%;E+Bx|#|Q}vOoGR(jK}sD zk9x4A-V%Hs#G>J5XldT-W&|Kv(!mEi;J38jdK>L|Q7~<_no&|~Fdc~yhC~%VqQc2e z2|pva(YaxgaE`xa5=u=WkhtI|f`XRHhA6|>1`)hDgYzt9kByS$l*OQ2O-a#Iq%SLz zV^&-mn{^KrM6&BueyiV}>&)9rr)de2+DkV8##PSmko(<`nqPVr^n_V~UoIi`_yVdB zzcj4`b5QijKNrR%0AYi<`{NDb!y1^#Pv|K2N8<&wlO7-JDa5Yp?eM)pf>PbMq@)Wr zvki0Y1yLr2WfDb`RBPgq^VC(KH;ofR#9^i$TaMi9J6p5TP5F8<&ofnvL|`*(;urRO z?0k?7WiOd&^v);ux~R9Hznc3moOxE+O$lYV0Ku|hENFV~?Lt!QZlMNp1%d#^Rv!pC zfq`*V)n<`Io8N2XGBOjLYB}#{g#>o-?Hmb6$VyvSN@nI?3{y-pdNvcYe%&%CIeh?s zWfdM@$o~R)P|M>ElHW0BAMI=ozdH-Fle#Dvq-bpmPg-!rDY|1*o|1dvDh9{`{gt%n zFemDyrWMrywXJ+rV5r%UR~0T*75`i&rM4=%7}ulJyHu{rZw;C$r+nn@cLyLgh0d-A z(3SS5tW>ZK0in8bOH$vW>HIcipgUXYGUq49#>Ixff27cCfWz$0vR4Dmq}CBw<~4Sh zDe9adM$vVItE_)3FJT5Bgk}V=1g+Qvf5+<KeZeKg27tmTqE9gb&&x%=tpSf&2MEao zUC{VNpb0ds0kEy%dt82E>hpxwh78gHe$<|r1^Nh?B&_~xSq+nVdY+~dc4GJ?e5EpV zXs-H~6poV`Kh5kok2qSUMD<MdZn`+nJNYMw{&G)!^_(?T4R_K|kG_&kKB*w~M<(!- zhQZMCoK7`vb~VQPn;h4Wbt|7ZqMK$e62u$?R-P>?0&WXKs7T0?Z-J8zti^WD-*_fo zhAqM(p+l2*(|b>aZC+?aK~^_VCZkP0>}TxdEC-KcmAx*YS?wTK?cW>PjS+NxM==Wg zg}e_*NcH%2(J=+WVL+;P)kz0c@48^4ZuemowCO=rriJFSD|#7D2oO{}$kCbL0#0%2 zQe&D2wwJ3%d|+L`bE=&9k_~(BOe$ZFap$YMGL$&$D0=mJ9n%He#RRlC3f=|WyrI0L zA_qS=<Vgd!^sQRNl;o#=j*2#}(jFc=Pbq)IH^}HuM2WfsZQ)UbZ$S&{*oOS@w8ILR zRS_=vsZ=Vvsel_;qaI4VVF?G4!%(}yJ9vLLtOY+Am(uVlK1?*n&LcLmEm7jIY#;R? z_}|tfmWe55o05Q+CuY#3(HB=;YRs1LyxEV4H=K1SVp&1_TRsjTe;iIff4w?AtlNHB zNMqEX>kzzw8f_QiJ<uGSKkH_|=yZI~fIr~fJr3_YkhypY(dCTuY)5@*ykUN{nPNZ= zTeU%bCW`RsT`<**6S5_K{prH4z?S|7a;AA{o^xN}hu@BBsCCv6e(zZ4{chs%Cfc%K z;|90`6xnOi$c?>Yg_b?xA6UgBS0tT_Y$!9>(J-Q|m=O+8+wIPlb5i=-aU~kBf=4dD zd6Q8*EoKqRCcMNO5q%nez-osz1XT6PZ+r7r7A_{!vpDIfE$$yCUU66H>HOUO>u7aE zs*>|KS24COy<^3O^xXssCI`2iF%;A&<Kxv-{GflzSv6^-_`6rn?k>7{j1UDk9dvv< zsUbj2HMoFr%{j!bRrmyt%jM|4U<OHrC`kz-+@|l{4Z^UxanM9OAV-o<n@~_@M{FGp zB3{v>Kza#}%V<gr#D>f*_fEvi$*6J-h}oRdsdinr_W1<aeI;E(BS}I<tGvKo%aVl9 zT8*N*66uB1#vc&pIZOW_e)6jzRk@!n4%w5IflFM&9gB4pN3@HP1cznSFcKzGbLr(5 z%;-ZZvhr^v5@#b;>-)p24zB*p9tfDdUa27+<E>yi5W`#8+~eE_NyvNZgCP48jF8P; zgYS#IP!@sLe^SeCy4jwre}sC*A4Vk3|EzFISR4QEai+j{bL%-B#Nlt4WJN3eh+Uo) zVtaBF&A%PtbaaH`A~$h0I(5#|WARn>4Hbxy+Jn-$LdJWL+&({?oGdxCC?@gw`D44O zZ)fV$Yi@4u-zGU|!cfh6Eq?2C3Nn%TL2ZoA1+5g5O#q6$QGS|1C!;H{)PU?dDlSGU zLGKxOa;zm!C-Zghet4U7l(%LaEQnKF+>ECNt@`F07q-JO?%%X~*k}Yndc#f*iq0<E zh-aX|Fu{GY>`hgW#iOvymYI0Ur<nK88ceN)<(kWMl$~V0V>}T;8qZ+%f1paM#v7e! zUS~+CMQqEbYZ%Ix+4iKAGa>>DLya7d_5zQo_zm&bP6F_75Qk^L7A%?p74r#_+3V6R z@m)%h$SZlQi)PpLLYyya^FulLkrPuM%+!YnWBCX|f#M*ph-`6S5IH3F;Os;ZZ&cDq z<~WF?be7SQre3OHq63A%t27ee4>e--Q*N)lFkAI_P@Yoq?Bd0s)IIqLY)xtXU`k>x zfQK0;b2n0v{oPhQju4$`uD>)Syw=X_l}YEfVF8)awhULL-sJNdq;z8~(wyAEW&sDx zxqHk8ufaTXHNnIUP~eE&k>D!g#IVt<k6q){kZ+Xa5{E*O4m>73wHY+ugJwtuy74u* z1qC32jRV4EWbz*0B5d5qGm7FB;V0Z>C63g4n6hW?!BfHU=<o!#m$<U^6GCf6@zfb2 zCK6(EF~y7{8irNw(TEqZa;=^EL_~#5FA*W{6Ch;E3Y4Bn8%0+V;vUKD8l#|Tf+?%! z$v>hqZbuGx&ccdij#|lWok<JeWHyPdKD0NJ{;sEc|6?4_+6oP>>4#{m^Fy>{`JdOS zjIM(Tuf4sYrJltP%2vW!U)Mt5hd5_vs^{onYW=T{?nF6taSUF>uPLMY@>8Y#vd&fU zJg$MqI>EOkIj}Gpu%?+k{%zvX7zqvMeuMm%YD6eLoHxL?e6eW>J~|~Z&lHB^r_Ag0 z{*SlMeG(r}i;4UY6e1TDhAnY@tyh=*e7>7?vlwq>&py6<k}1K8x)%|myUzlL62{)~ zcC(t-q?)Y}2a+q3St$dLT)}P{#}C1S%{Lv~>9o*=h<mOQg+m<h$F++m)45ZV^MD;} z14~gAixLHFnCUb*Zv-g9fXE7>IE389P!iE)Fe1v;HN5fVGS&&jBzQk*Q}Rb%{FF5H zt;vL@*J)TU^_AGy%>+&9)+R@9XQHe9%Cr#w>Q$NM0~WAiktZl>9`I-Ypc0UjVU1rn z_FPNg@88w2iz;NHBJ8)vM$%1oe7QzSs;NxSieG5h->Cq6`M#YqU;tx=1hYym@h%fi zzWLOcEgsbZ>jW|mkR)qpxv-Z}J6iTzy?L3sZiv!nbZ3a;A~Hu3j6-^%FcrouBW^*9 zwOO;eD$2J8edza=ZDF&}5X#=B9O(;A4zyM&5yTvxuoqjP+FZY!ZYI`_D=;czTJF-e z1-$=(BE%9~*+c%p5UT&+n27&>tc8D77L`o(F_e)w^~KRuv4^AdNE-D~2I(p(SCPRP zc{V^gm}JdYd(~~{max<jT;W{{qJ%=B4as7XJjrB86YBU^HBAa+06(X!_1K+_C|9c_ z)?wVPyNchhSe;#;C%M1xhq!-b3~m!(+EIn*a{?eN6C_xT#3bwT2NJCVt0F3LVDSR6 zuGR{Y2kwq&MDYwtu67ai7ll=VMeQQMdB}Z*@2ApoA@vsDrh++mC>0nhdPp5j3){eJ z$LuzR9V>9)451K&?27Aps3vsd_bU(1EDOA~g;@vOO2Ty`4MFO9u=`!_wEKPQp>9L& zzuUbCBGHhsuxYBy-^Uw`)=n<g=_6ADtF6^Rx#L$SiwTMLhKAeg$Ir`Cgx|~CQzRQP z$Wz=y+MlL|L*&gbKc>5pSF5)!a6qfH$^u&=0GA(}B-Ixjj|ce?Bp(~$q^7BqWU|H8 zKU!?5P@+8*_63=^7)|h<=`vW)2%PZF(`Q0Lr0x5QLjWKIQZB9)OOB_ISy!Mx`E{lJ z1=1d&Ic*{{_h#6sNH^Hz)~vB7gCTbuUkVrOm(pCye57-0<dsb45#E2#1+L^YW_jPQ zg|{|1r?W0<UY^icT@rM5xUrN4-Ga9XU0u_nfIv?(1uMbrC`*n&(*!`9nyVmbS_=f& ztm#Z7_qI6{SDwi8TYXWlf2RJhh;ePSIHox*bQFuoCD~m5Rk*v`1f8!iXFpVs${-fy z$0c2AP?2akzba<<^d<SZbCyJ~xa#1j;me29{-lz*roj;A<-tdU;s<sg)#XHxkMhZ9 z+8i0#C#i2XPgfC#@#J$TB(Cd_z^H$s?1$3twT&=tBNuLe%Fl<ptJ!ehn76f9bc;XE zGYEqyVB(x1YL77I?c#HWf{)93)ceY}s>NUsKiFMeA#@NBB+F5<+s{(H7mQAPQx`OR z8xRz&uf&f&-?8paW&Q%EHCq$Lv~}lCIW%s>Wxj&$Majn9D~*<r5R^S?hRD5q0~zZT zs*IT7`7B7o>{Yn8jBZ3b9-fuz!82Hn?&ZI2_JZYAy$kb_?<bYK2x3_{G^w#>7m*?J z7Ec<Xr+(5=w4>rbL2*)gJ(Wl`yg~c)vC1w>dR$LezB90-T0%EZo|KuQOirNpKJAd) zr+w2F#9m@j64vevMEx_$M}ESx!oajKsI7|Q#c-fWRsS7nAgMlxf$l`eoBx6_u1LP` z5wVEEAYNPN*iXKJza7=aP+z_r$z;5})S<oi+}-~^-hbQc5A1fqvyb6yUd6CgGXp~& z{!K_DqomY(!`}Af6)K8g57Ew*!8H?)fvR?Q1-qUyJge=3IfU+X{+Zbg*SGbTXB`6_ znB-fU;%-e~>+)<Zxm)3ukS-Zw|J@2{{Btj2|*FTy-<IRp;ZZg%-llvq6UA^3q{& z9-1NEWMTQ79rE01H;IvFc~*(*jxd{v*|<7%6lCMnTfDTRZCx;Wcs|m$@c3O(heLDe zz7X)KqYewJqpsVoSuCn{7x=bLQ>QGWl0SrU7qL5T>MpzjZPVq~an6pv29s{gIn1Rh z$*Vp>0p=05JN|HRiyOCbpgpZ@;9Xj|o3DNV!%Xn6t3hE>(=2$dFuEx{osGXYv`m73 z@j>86*-gsSS^3m<oE3c-)n~5N*se_9lLX+^`1AncyC%QkMGrmLV=Ho6!+4146a;OE z=`t$t9k^-$9aX;|lxOSwN9>R)HB6Bj1fy+E{@9e{bcRLU_iAqDzdQUqG)+sqNE`h1 z$3w4loJ+!{F4NdK!E7Vu6L}j5d=VnffP!j5b(b5(u}{;?o9PB`YLsrEsOeE8IUM8F zj!}~kYF^$l^i7CS$AnS+a4#EnWySE!?hNnzWe>=ETyc4WCXpNzZ9R&vLWR9n2)aFS zeT`FE>ZzLpjPr*qdk%A3<`U8cpr3K~?abpqM})l-j}Hz+9tJcw;_-BzCtzpYoNVk^ zd4xI@9~_|+Y_6S*Kx+?A$c)OqC718Wiat0Sl%qFMhix0?j{gw1XO9$zQhjjoeDj|S z8hS*$R7Ol=9=Sd-9s*OgZAC1sMC*(iexn}3CMYJdNZu8^S5)5@Bxo7ayS4fG2D@ns z(Y9t<TvhILu3uTgNy#qP3#T@k<{6-VswRt1u&eW*57dPh$?Zc_!H*7qqO83%5^W=J zUDb1tF}tG{zti)_rTId70^zJ-pFwgc_I^4(>_4DB(20CAx~=eL=RM?RRc4|4V{?Qe z=>g3K7H^2nxwHm|*N+zhk9ET-=0ak5wZAxM<)DFY7|^q+@a_=>AXMj@vZG11mH%nQ zn9XfRt<p14uRBgwWE`}!Ge7riPu`nI2MyttnjsO{6D=|e6fC%I-Hd12iyv8n7o-+$ zd+FXqK4mJ>7)!V&u0~v+`DaED;5~WX_cQ6~@iQ$)`#<lj@~%G+U&|lF!;kNPgQ=mt zh_2O-X~DlpnvqKX$@JBXtHGnBngM{GLk_3fWvC2OkgG`o3B4oYC4J1N)=j4j*lbx% z*i-)Wx`^MG@VuGqMH^0ii~B>bKdk&+uvYtZMGQ??&<Ml&ykYNkykYNsyp{g>zRmpw zbc5donS&q;jPQE_7rh5{ONJKBM;cxKH>r!f)K=VDf}bfc1B4Nv3C}__D{B|kU<cyu zF9k}G7xqV$0Xa_Uy)eXayVw@La<2}I9(Nb*FqncC;#r&}eZ(|BB;TVKI}bcIPfIH= zrzm_jxOTq%g)}FA$YLf2v?%r_U19<N=>4Q04E((6!W^q+&Xb=m`c#S!$wEEp4py_0 zDJO?v%A16hzF;#-Lt+DUyec?VXUS?%21=wBiJ<}TTQMa&n$+5wnHr4sni_Hb`tFO; z((K<Oi*SVDnfmxN(dJ3`C_=~LISLzk1=8i3J_I4P=m*3i)?tz0;zp?bkDyV@leHk8 z8Ym0~2G-&oe2JQxq&RM7jLy^<hA7?C2iK)XD&n~d11tW&nRZb|%1aLc{0q4frPQfe zL3eXNXW=1KO2n&WluR+J&Gk#3SDjeG1^E&4l@t0}!D9$oEGr}aNp!0lE%`)CXuC(U zF)}q}K4Xr)Z7s2kOeDq(-Vdi5-1lz2Es6CAZoUOkBn}=jL1iw#i-FUgmQok$$f^qQ zLlb&t%@DyGICCfIGjsKz&&lWLZ)3?nkxjPC-MEa|hJw1LSCv`|#aRhD%hmxjW!IZ7 zrX~}toQkL{6T7B5gPgRCsq)F0b;NW_M|KEQV=D0>g?Xh0p)JZ<LKDKMJSb=0FP{C4 zDb(+v$X^5oi(e!Lk6Q}&AU#U=C_F0nFgz$`R9u~00mjhDa;`{j=p?NM_{N%;!=2q} zNRLjMj#Mb~mq@X_xS*6*TgM0pa3DpadTKeBztTzJx&+q7#*~GwRtcSch}eXWn6yaj zaHTycG$->nUc=-mE(Ls`z5)+Qr8;F0R92sj9yEJx1kK&wQ8S2S`)h+Qk?^jShBw0n z^g^Pht7xCZvs&|5W95{bypf4acXhX`O_>*QyEk183j48^Ws>JcasVrhs5G9;&2dyi z%>jCf;J1W^x5i(=Cvt|^PAWSdNG}XTJ@;UD+R!_#xn5!VD8@`C$I>Ipes@q*x>0`l z)z8=i*VF~+bxTYjaCr)lzaDau^|9V&q!IlGwQu0TKbn4oBljDL$D`d(xUR1D_M2H5 z_D)E{)YMOgPe9j&Ta=X`w!K8L8Fz1tOon!uWan9)huounS4Mh4dF)BRXPW~rZ){=b z8GKrX8h<5U_7;gkNu2?Vha=mHR?g_-tDJ7e(~<p`5So+xCj_-OKdxm*zb&kc2OZP* zS*dMJml5H=AgV98Q*HXN{iwX0%>;kBqw^DncZb0-heR1$Eu84i7(X`&aR*AQIwovW z>fz)N@L0uBeI%!;>fF*(y?a<c_!g>B?LspSl*h;#V3|hH@lSBCC>z%=##r4vBD?~% zIcaMD#Ep&MMR|QloYSVm4m`6&D~o=K)KUR!2dn`<yN`auN<s+X&^0ReqACJ&1&%`i zS9AJ&$N9ZQ1((R%+~P=Z=oBq)CTZ&h*($ex{G*kzjI$J`=0_pn{>e7}AFYi4ni=M| zwlXp`cKoTc{O?pVGTu@effshzIQL;~Uran3$O8b$6lS*o0s<dgL{S2X9~gc+hAQJw zq&2R+oY;$8l90IT2Jj^}g25Rw!7x3An4zBGKKt|X>T!BoyZd(zz&P7axA%@Nz)_qI zkD$LWxQoOtM=CJA^aux0eMxT|$TTV{XcUf%R6YWWWpb~~Wr+7tk~!$o(-O!M!{#H? z)jCw2taNz0WO)=*Gud<JaW9@fpL3bl$WP$^I7J6|S#A$6nMZmSNyA=+P(gb_ljw{( zpw$3VlU2o9^;u=VQPT<2F$?i*b$!3|=NVHi+<=nB!2{$_ZQWc=G8(7B;yip<TFPR2 zE%GD0>3!7Hi9?DqB;9JQ_pLDASj_PC!c^M|om%q>Zz+S3oK5Y^V&l+!?6vHO@6@c? z%)vqVE`pRD|ItbFC1kt4ApdNC)&9im8NW=RUr><p>@up^y4&I8N>~wvL%f(S2W%NN zf&x46sN${5Gh+I9cd>g-O|x3@x#@hdvU54zx*WtnC#5%quWk43w{;_G!4&;N;wy-O z?urjbDnKfp2u4gknf&*wBJS`YfdzBa#pf^Lo9ei}Z)MCk6MP}h0OYrd8`j<XJ`}!e z0HI@HcE57X35JKili58J7T;t86BZwc4YX1Lws-ENID+Z{zZ+abbPM)lpp3$4gSdHe zY+yBlF;38gng@uH-O8X-xOu*vxG1TCQ1*Q7Z!J+#_K+^F@~!OO5Fa2BIVYrYj-*&} zQ5{3U5obGRh7eY4kqC+XCCGWN`Z$q9BtXdWhc15e!SG{9lk+m783=*fX+!6Y;@X## zKKvSmh#?~y$$_G;1|lov1u={fT%dgXH3}Y62TzFS&!Oy>VipqsRTq}lh>h#|o4yiA zbPQLKXatZ+L=I$?XEGfd7x*_lf|=3xKLi)yj}jQ9pD+OPrv;Mqe+~uywe$sD4D}uV z4@_J6*&E>)?K_L=^<ZCx9>f9)ZpbIb0tyI>qF^OuZ;8LrA_T9JRowWUXNjyBVFxj7 zcFv)I!ZI!9%3&ro1=#}qZ!W@`!*%Do@xlC)>lS-KJPYY3@3mXj^ZUgyXXo8DiZ)0M z@ORv8NQ5xIiv%yy7Wuv<gda;WPv83Mfi2oK*ls5MR^blRR%H&dG-*n(J^fa`4&Kxv z{IR>M3l7ZnaX8M-u4s`LZ2-*e2V%BIin4U@4b=3ps|#~L^v#DXv3G<r4$LkBhj(1C zbl?r<boS9M13ec;-?54><iwXNu=74-#U6_5BaxOTYe03)+cZNzBz=*qSJtTXNK1(h zd)L@OHJQjhyuX$bt-mU;^35ZxR>Dk8H#;lK%qAV<%I5Z8dd3-sIMfqq2WY52;$Y7| zC@8Z_G%EJ3tOhCq_Ad3l4=IN9=Ee$7k#R%^@JPd7SnqL~*a3EWdfPj^Ft)B}bgnkr zBT1I)!g2ha@JU#wQW1op@1SkuaGVJcEJVhstebVvoHV+n`EI?;^p~M~tfk#K1CBi- zF<+3FQvDXkoVE)E6Bj9T)Vlo9rjgCj>S}EH&DnJgn49L@7ZaI=<x<;pRn<=KT z8T)QyTh=O!X-f$Km9us?>v&F?OY*>NLOQ-u43cR-0P{LGZCyKsW{^hNC8iDiqJ{~) zNqU!S?7Gb=jXSc_T>xTosLbq!#)VKVs^hKlReb|!_v(O0B(=A8tA0Fic+K)>Lc!(J zge-eb*cuWjJCE_q)D}kLQ`X73XAD=didg`EDAk|<!CB}ip9-sH7-$E3o;#ynu|z(_ zJW@g6JNly$0rBNIfH}-MdIvmxv(o?)Dn6kkc-3X%aHp8r%~g$Frzq#~m!ODbgAR!+ zoMp>uw*rjJ1Yj*bj<;`v&<aSHn4f_YVQXq??gA_7CW)csCEYaU)8a!nrY7-vi%oc2 z2$LliRrO;6{{&i05pc<71XA765|}Tlu|8!ah?st-nGC}8<Jk8N9U04t@U4ms5N=P! zX1(G!MxoVR`)jG#xwjOhk&P1#_G_@y5E_M%IUGuv+~QKwC=swM0}(W3vTD*=$?+?u zJ6Aob)p9~XWcJ3Ef;@cYIxz6b?{=pV2<uw05TzUTb!O-G+J!3xsJ(Q;wd%IiCo1e9 z1rLnv+#$_6*PNKfNYPFeGk7)4Onjo75mYh+)o$i)t~h4Xbf(J?ue35_f<#I1a_<E8 z#IWl<cgjn2rfl{KY^3V`b4AP^b45&nW{5~fPQQHes{MCD!b`HnKUCG_FTb^9V~0hN zxD7-NF~KLZWNrzLUg!|cI|mK|glJ^zXiN7<{tTHSaT_u};t?blke);ZWYaw!8v=p8 zph&zBA)I-%5xLgPQyR?miErfL7kglurN;N=Vywz{%h^U)elh`mgLEt2vTJ=}3zy0k zj;EOfAra$b2YM2yZbXSz7yotU@QfDx;2p%dB|-8&l0Y4nMe~-uRsN71+E)Ak{7$H; zo{k6+h|ZwD2ps|U91C^fDlU$o<ChkWsHi6UYv&)Q8>pOnps=(g<^CaeJRd*q!NQ`O zTAcA*KCphxtD>M<0l)OpWo@|W=Vs)XFpM7C;96VQR+W3~AXoqC9@yN@7J9kuboR-H zHL8|U?V*D#Jg&`hR95a1#ByH}mfw|kcIP#b2%C}r_nxhIoWdo%k*DB;N)%#~P458H zR&1-?mh?}HxGi(-dh@nkK_H45IB{y)%qwup^p85vZeUpqh|G;9wr%q$_*4*|PS(bw z3$<2M;y;*(WAtHSM--PRyA1<)1Xe^(yuRRaZX9nR0oP5%Wg)P(ak|_q$^7Cd)NP#f zFt*;;hP)je2EkvO_Juc*@6Fd}(xbH@+`c?h1(9yjJzcLY^!{hs3;2?q^IfrF`+D{7 zeAjrrb~tUbxms|met4=I%jCVN6O3DEeY8_%NiNb1EvTu>AI1J!n@36jd$2##c}B>0 z4L;|^v$`6=K#^tk;MTA+ji{smQT)gaODj-((|WI%X2JbpJ46#0RZ&FMJeh+Z<&>04 z)cI;7Dm)CZ1Q9H0Ge@zDXKAsB9dZbg4?1joh3}_)K2k;c^(s6)kl-$}hLll_T0$(y z-4SgpruNv<L+aH!q8IS8MzY-gg?eaOL-SBc(|NiekyEP>#}%R(l@3!%tj5l<!T1a+ zmzd1#!RA2v;r2~Stm-6FOWHj8**5(k!_c-){Ogo@$~19ba2$cgu#Q+WzJiQa_~uJ9 z--DAXeBY@UCoqOU>!d~Np>{BXo}gF5QWAP7*n?JW-N~>|I~-Sokci&_Ho87f;<jMH zf#SudKQ=r{7b2n+Ec|5w;>meu+(2@Yz45X{^W92m`3_^%9FadE5^cGO72ffn`$&G} zGOIPIF?FsLh^0eater8)<@~LjNIyP(W<U$h2l%YS9YU1AkliE19yN#0-#D!bNwB$c zlcdqBzq8al#RLPM6(ys9dr<g5yEjE>7F~ackhd7ase+Gfo@-RBG6$Q+CeDbE-eiO! z66k;0^Ze3P9kEj(yiZ!_vx)K5>+Jrl2af_iKMbiG*Z6y})9{?`w@LyvBpEEC99HEm z94J&4%248p>c%Nb+Y?Mm9%w8P;5(?F8nINf&_*-><^LeQ6{hj_UPeUhLmtxd+Vmgt zX+WF*G|x;d1!gF0D5?$*b6|tDV#m<_?(f{b+Jd?J92?)y8t>gZ+-KQ+Bj*PJW__xR zdf03Su)GBsi{L~F7m?zTiiu`Wk!YO=QO{H#)PP2?loJ6bfRs0oKxO3+aYm9`#}5V$ z`x646$<?I+_|&qB9yVC`3(2AonpGM(C=8yTG=zFgghaCdFhJoFxA6^cH4AquVxU~U zp$tBySaago1O>5C08JvW-c>mV&jy+a+V^zH9IQ#Inj?BmB?I0~jhx7qLD!cSQ9{<) zCB(xvh>|7z&?P1A6fTeZ=vH4`HaRJenyQMrBMl$uNuOX#!uWTr0YsU$pvq9H4wY>t zl^X-E=|ppy073iT6Xv?zU&~*SO<KFj!<^Vw<Y#jSXZX8Re&4&_0RQ)Z)Pi9+<bTv# zv3`#KaEtm+8zriL*(g!{FAGMSpJLX}1pI%gEEJ?;(_)g;WKEJZViKdGi;`2L2jt|F z6r&T8jfVjLsE_=d@_+kJlKuDd+vxuEXBqz3JyKcyJlp@<xBSyO^WRSd^Yh~0JfHL} zO#hqf<l+W*6~|AuB>z)S{s$uTKR(W@_aA<f`VRcomX<%Fk%Xz0;ZN4&^dlqvmwc3{ zplSUdMl67k;pc1kO^sgs+zHWg<kCg3@N*`Nc$IK-1H-zi%a%IHQ2hDcecO37jI#qc zJJIx8STQn54G+4<TdeNat@cM-o7~>sUm!9<t2_YgY);SuHTpcm_dV`#E~;3pSgu&W zK`x7r8mjssM)t)}Yq8t4Xi6AW#yBwUmg)^I?cyS3yXqb8V}TeKBss*~?SMgg{U}nS za2@lF;!4X@i|c@7Ekw~DTG8&AJ{Kd;Q<iv^vbrlR6OWDG+0`Bhd1mE`rEuw1k#Ir% z7W)y|_j1YZQm0sfKoyB-7X_Y1>UD9D`~`uK!3`Buc{%2B4{J%ioRlMx&#kB{e!Avb zJrlj#<)~p=4r6CfO9_3Cn1xhg=x7nk+LY}yn%fvBEBY;q4p`CSxj7W<Dru1=c41fi zjgF{FvXK1BA>fX^CU5+@tJWJi(W&KcO*jj5x;xDLZ*AxFvIAYA@P8yW`o)9#pos(U zSgS*I-N9vd=^11lccI*yNQxzMgJ!_I?64MNHZL9-U_DIfm>8g{k^fj)WeFHM8I_z& zZ3l@3<|n0jQSo~R0*Qcqvf~?+vNohOl*bzy=)XeN;2a3p1~0V$$gAWoVuI=*iPkyO z;E~luur&+0{@(mshrT+g9pcf!^T48w$vch$Nigsv6ylw&q=E-ICa#nDgi$8vmBC($ z=yLuLM0U-^2^S`{_ZwTz$|kB|ZzUr`AM@J;{X1nZJEj`$4skl+fss?6#-GZt`JdU# zvVUW}%8!tF0rBe>`+r}#|FsnVkBs^MUX+ze>dHSpWnWVCqdl~T@Zci3NHq%q1q0&Z zjiRz*rIA75MSd&j>=Hq=uts|mK)cc}S884FYT9`Ym2Gbq-?zNU&7M-!u<)j1^s21K z7oJaB$L#M;cjw#E-oI~{yJTr2o((;6binRCTJm*%J0nr<VUutll)ppFy@>P<k38sr zk8`FBLf|O1--H6-a9#2>f%?1jgigQI5bI~2dsFN451~NyCYYvfVfu5!YwE`!Uv%`& zB-2spw{|p}vcNP<;@k3}sV|3_r|H|Z4JC9~&KtI*)@JhM?U=mg#m<Bq>3PjRVoE+M zVYM5uWSO==K5b<g9k#9ludk65?GmDaKnQ7`*c2Y5HVx9Eh8j6Fcv8tORPf=Svlc1h z&c-6owg(lb3KC4yE*VWPV$~bfsyA0s)yp`6-6<R}t{}`PF%1)GY{2!#sW3=%sbm#g zuE`pUD#yk)R48lq*c1at(x!6fCRVWJU!)EW#3_jhNzWp-#!2$(m_p1|*|roRjSubd zj?!r;^FTD-7ij=rH1TeP`S6l4;g81eGy3Ho9k5U?A{+?So0K7mQ5Z)-X^pt0b%~?* zMMVSy>E81EEz2?F$jdRB^ec45FWK&Dz+e}E=Op=h#{z^;qey2Dx+2Q2qzwA-MpAB% z6U&685w0+}tjouEmcVXOF$U)7w=8u*B7piVzASTr-X|xfrQR1uvc@IZr$CD4MUVF| zMre!R*v|cBT}rB>9#r~c4@(}lBCp$9)X`O$7f_9s)8|{>$Da!Go<Jm-tOz&ASh&&Z z2DkZ2v>_qr=;4rtnr7TgXUpffMV9akHEvEw*Z&g!2Env6(!b;)$Zkq!j9UGy>Zopi zUQ<$5Ex<;<A+9Dl>BxM?&1+E#8>B$er2c?TqH!q^=LX)1lV=@=!xtMbm`$gt70@|} z8AM$V_n1o@=*E15EncO@{D<SVX-=L()z8Fh8{LsQU1^I&WmONXx!p1C`IWx38^d(* zswUB)-7ssxAUa>Fc)hEBSA@Nbk=GkNsF#}_mBtmF20k$-)eOP+G`q*EAP^>>5d@ea zg6^gb37{ol+=uYC3->5=jbqd}&J|19Oh}yYviQ}E@&>94`r85c>mo=XKA{q~2C*8q z1(8IqD#!fuWdW8DT^RfX)ssdyOzHq^sC=mmY``qcE8^g-<WoQ-{q~4g?&D$m<N<fG z6_vZ$?+PM;;DMG>o852h1`FBL)_0fHqqzW%Y(brO+X5H!1sl*7|2>*^XZQ^Um1qp- zj{+=uY~SxwTj1)2rmt7luK=kSptJD<xtPC2BM1x!fzBf^_W{=aF`W1sA0W%%^FQsf zk@IF@C*}h8>qqF#W3sech+R{=RBs5U1mcd@_EU~~8?dsmUjsf7tKBg%yZYVwFEDFu zWWQwnb~$%v)IaYXT;h~afPZz{<k4e=a}VnP?~?q0c1nHOnoi4AC3l-rj=%olW9C^o z<tqHs-y;6AfBp}9=fB;ac<qcGEq@%$e(2MNHvdO$OpKir1EfO?lzwB#Z){Stq&Vxl zYET5-P=dgR=-cT_x|%ml5i)`wohYe3EZgY=y~!OQq*81EGqR0$x4U+h9(f-=$M9ib z6erag53odWM1cl4&VbB%0y_)-;`A)g5)eFjlphpa;Y5c=q&`f6Q}Co-u|$qeL7$N= zNKB&vM29ZjBhC&Fbm&9yL(ndpfkeU*o`A%^(i~$c(zC!tA)nAAo-050;VjSyqxQw9 zC(O+){IcVn(b~IAr%xe$H8@i5AM`N_C0<Ncf=zg%m;c><G-Q2FqhI{9jl)HOBl%5n zYYEo8GksGdkVUWV!BZVP(xfB;(jhoFI4;e*N?l8}GXT5RK2xwIRje%}va2i>4^@br zn<wq%L^w{;R*Yph<{KY8UNx}~%O804Jvq#G1!7H%A=5hlVJIeNt{9YD*L(;1zazE! z?Y%d&pQ~d0b5;H$lKMvg^lw+?ACXL?tfY8953J|>($GS68Obz0BZLqKb0MyvEEp-F z%XZOu9nt29ll<E{#|z+x>>hI<yaa@%iqp|#*K<&6_I9=PuV)tL8Als2n>Y!o7Ulpi znv6Q&d-<Y(Z@m_y{RB{=3rCK_Q1A|NffEjDgfCNrqN6`kU{-{Idc?~aHp(O%q`I-Q za-lk?1GYP>;x1Q#smNV37IAjmqJ`f>4;j)zs}@5Ggb8NHQ&r9}YcFk1=s0qSmfDIT zL}IzQfY+Hb7z3YWw>3^;vPtIw+@lL;+6f0j=R`K1?Rs$3&Ft1)@NM5zV1L&`Vbl&7 zswRx&Edg?U7fqYMBpWQ6jO&vI*KI5odc0(9&B?LUS$lNhs$&T-QLab-p|8suK`a9N zU;>Q)dneC-M2!FT|4RScQqNRUcScY|-Hb2FWK7ixX)w*zIKVgM!)R>CsoYSb9@Lsy zLJk9)H;@1=N~KM;fxCA80PT1w>bSwB_El6JKa7XzdPVs_qfTy_HegHLC>RgUxX-lj zs_$O^k~(_!_WA<u8Gj*;uw)_G_dxxfVJ?W1q-Oiu8uBy`bt`lSmRj%zf;yZxu@;jT z9Stol!nxmsW^)X}R8YhXOt~+kIxG;buZ(3hv=@<IYom)8L|lkBh>Dl_zRBtc0-mj? zs$_XlVRk8UA;TzI%p`NZo^_F0EiGU(u~@&bF!!jgly!a1es#9LBez7Usio}j;#J*M zYwchj{qF*wFL`?T^AP-=5n(>kT+$T_0iGHp4PM3Z+@Rs&k(ghDz;|7e>IBW%Q&>Q* z*|!8m`k0#8(2SfZzjS1JdAS)iL*a3Q>Tt-uHB0^>6;<V$nh@W3O4j^kKfIo8_N%CR z{emGs#-(-)EaqQ^G!Z0Sqp<SvG$xv<fPN!2CS(P16m#eLL5F_uH3~L{j`LM1#iQYR zs@(RuU-RearN`#}XAP69W^ZQ=Y0gz+q+>1Ac&)lXvA#A+^~TF&^<-Px{Arzw?$8;b z6(xcC)ary#!{#M(-LV!}WvwJ94Y}p+dl+)^9$xeZPD9+g#b-y4E)=6{dZvMSy(4bs zQqd@m1o^6YxMp0{hxGGmxj9Cv;|d+QcXE|*vQbI!0Pil2SOuAXlwDZl!rN-01kujv z`f06S5M~gsjn6G_ql(Z9v;Hz>hvm)t+G*Reo}Oz2DoZC~IJYFxV3=*1bcDI#V-ehb z`yS4?O;M_uUKUWRm9-0*%jA%+L}L(ouJ)NW*6>k4H0cLNq(fNgHv4Jnoecj0zTR!} zd#20Z0rVivt#5;(=aRdj<I<fS%aM2UZ3tz;_4Dg=;q4{lQj8JEIPH+}>Zc}W37m&` zO8hf+O$5W$AK*8A8`$z*=vRHy=*QmoFlAg=(s#RhNTHVYC1}1K@hC|GVLZ=F6-*0x z{+sO$vPen^=y*Dt6A!PzJ!}(6LIqT()R5jys9m(YH-ka(Nn?~~Rtl-H*pP{zU-MQ? zlXus*&2qLymA^@KO>Y@ZjhbR)e1(|kVQ~2STn}<nr}~EMrrv&o5vmQJl(b{lz1B=? z`G(`WrTO+e2Uxb3yoO5yxCIAx;BLwNg#ZCF_3#K2DdT<$;e#miQ|jt+_}8+(#-}ea z5Noz5M^J)`U(f5XiCc)yo-iY~fViu$R23efuG=@d8qvm}5`->zH$Hv*3wW<D6X|ct zE%&!$z&zmCy%tEksP)#cTtLo~A*HuY!2E|(!a`BA4w1;r2i+eco4|K^0L=$7Ism3A z`=6O@-7$#cxhb$h|Acl}m$8^MgNIQT!uxPAZ@3D?n{oy8!4wRmFbdmF)t5K_{204B za^`0?t%RF&&2^%f<rZgDVU3u-ETAmop#>t5KBjg$eN#@{G$fcMS8-`5K^IA7m_aM6 z`$)$n`bVh3x<&!)d?X1WLQ9uG9!?;qPGiS*BaH;RE}RifZm9eNEHWtim<ZHESjbbe zo_<btIr?F(=O55waud-trgV4(CJ(K{D;FV}vsPiF!Xb(B^?^Y>)l0DD^SyZww8iac z7r6e^#bzT+IQYWSF&Kq!LAalh*r_;Wzi*>jtu~LuXq%d^sr49_?y34lr!u2w+EXxL ztvGKYoa^y*IC%Ypz%YnJV8{reNW^fpBHc9m`O*l>0iqm+au0Ze=X^~VrnQF?&PU+5 zvDnPzI3)KOpigkw6k+Ys(1~ggta{l}hmoJQoMZf-VJ+IOf#vtk(!25;+d@FGwm{aR zAx2bT?D_&PU}I*Rt}$?_UtrnE;npz+3Wm#cQDminaPZX-ZsD&rZgNMlOP>~lPs)5- z1VY9g@uu8tU)@>Vy33Lo9Nkp)j+fdu6g^!Frwn87+^Rz~KEqI<wPRV2ZBv|i8Izgm ze)kDGLS{?i5iivw>ZNvGPU)wR*jLB$B}I$TO*f~!7t4654oLO6t8V2r?1+T_Q&0K0 z4682u*_{u6j(?P@{;`Y5=-T~Y%Kr<77Z}0&gZ+aQ{5EN9gm5}+3o-ZC$|VI0^CJnl zlu@4piaXoYaQOv8RMg_I3w0k1bN&6lEJ=n~1W@$^LZ*+5?6;J{!0RU%BNqm{<~-t- zYBiVcsKMtWrxI-wsbMy>B;oLhCnBi?O$~EZ4$9!UcL&30S4}6G<>y$P0t(I%#Lna} zX_$_w@IIB}3veH9GP|^0P;_>@eR7vav@g)kd<ftEA?>8j3{^_~v_K#JRObGNy!PKV z%zyn<UZWp%Mab07-a+0`?_Y2KXFu$q(zz6ZEbNz*I*XxtjskB7fl@%z3?x2o2y#L= zA_TAK&30XdW9~)VC4QIR^e&`M9xoBy7sIWr2Z(+~y?Ty{4kX^~G^@SQk%#?i>gxUd z^s@D@xs>D?9|0^XQSe9+5fMBr9-1rL2ipylxZmKI{+KW<K}0~b_`H1tQNx&ML2BoX zN)d!;YxO~?(g%{Rg*n6teo3edOUs6yMCGSv85YQj_8|?yOq%sVsKjiWi{Fbis}zQA z{F>oVU3B__h9-y+tCNq0iyqW8C?N<_=wTWv36hc-;u6_5$-8<-iG^wVX{rs#%*o<0 zP`zZD%9FKz8kA)Pi`QrR2c(!`3^|x4*s*D2BB*E3p1pCB6wSJ(K~r=?GY2zKWbkSM zk97>~<lV6dz^c<E$dvN)_xy<&)XvisHKU-_7Ds}6<ToedXiZ$KipXkJ1MH{k>}>cv zb$Jz&BN$J`J1%`SPSlD!*ydwZh|}u@Dsp<F3<71X!?;wa=|y=_=6N1!<PL5EReoUm ze6V<owj9uUm<X8hyb`-;{ORgus34kHuDR8xLrGo&oDJ9{5PRfR;KN2GF`Cd4IDp%B z89D7^0QL|eYULlK8)-=5QMuO=oJx`sQG*lzA7$?tooUx)jaJ3BS+Q+bY};1Fwv#)y zZQHhO+cqow(*5)}<Mi8ozVV*_*S~A+z2}-(E6K7f*pO2uhSzIe?y_BVHdJ_rTt0I& zEDtR_){j`(+y*sr_ORi!s1OxtK{>A<j-e#;zHD$to|nOXyu8fda+Ai?Zen(W6J@PE z-(-@b!SL@)X_H%Vd78&!-Uny@4o7RBtO8wR&sSpGi@DsaNcX#lJ5G(97z}e>$4$sz zuve=&^SCLUwSd_bGS|G?7q|}mlM8;PN?3s*Qn`LoL_I|_0v+g4G5lm(&>D&~sR6?l znI)Ws=bL^}57Jk}tm&J<?wp~3>ypgNPrn=57ljDoPx5vC%_rIdlHBI-9tCQd3ccs7 z8t-*ywH72aUrR7)OSDPqV2JeQ%}`Fj)8^<7+S({A|0d~}AU_#mFK*xIuPXctHbR_6 z0>4#tdv;L;zy3>@ngEyuC~{UEld$Xby%R!P6GeG0aQ`p@>*JR7p_5+YHPKN^V4fk3 zP=|o0bY4goP@xf7HieU5*Pudrp}QZK@B~{n6cMl7DMdWz@t^;~@D^eU<>!6(45Z(_ zk$+hp^uOOo|9MRR!MG0pHBKn;ANR<Y2Ti9vO+(2qUR4l3DqG($!Xcp>0%BC@7!g<f zx&~8@&a2eR+!w@m+O8NOlGy?HonXc(ooV~IIAFuHi>ZmJPZJXt>$m&mX8a!}cI&=T z^1$X1PVvlD`DVXD#eo%T9Hq`v^hcCB+%v=fj3To3%Z<jfl#{wGHdcn6tI4)nt}GUM zWrG41a7EcawE?lUuFtoOg7%~3NZiFRRO^q@n!NkzwCXYm9Z)XgTAUK_k>Wn%=JZC_ zoex%j4<fH!1xm*SR_sR)BLUK7PW1M~CNY6HQCGzk_fDVQ^E!{M59uO+&)PYv&m>J+ zbQX)n<fsyw2pf9hmWtAYH8f0jZbbf*6yp<%vB{E#6Gd2T+!0)ZLG;-nmE-H6zoy)^ zd!c-bMxSGPwTf1^w|TLST83)8eYnGhrvAJ$&P9vAwb?uqXkdoQnrWz>1VtYQf2U6; zl+lO7)ctA65@v(JWy3f!Jhj+syx9tcQ)P2qi3?*W-Zw#Ork|#Fs{k`fVV_!Mn!xL3 zIk}JIQwGd7Ve?#cLD_l3;B&IP`k1Ad;eT4RS=pW5A1<B+;OgEnx-?%3>i9B3J!lo3 z!WN4Denb)1o>9t<EeviDEih*`m1+W?r1s`FNLGUFWPT##=gQ6xuk6>u9*MQeIgR3$ z0rD%TiSRC-!526-Q_<1bGYn58#9j%95VT-muFHVK2w+EN#G8i;i`sA@UJgGpB~}7x zXT$xV`dKsMX!X;9Ku-Kvd`_&(SCYV;p<-2TVNbPS!mBJ-Wd&_+BDCO7!-z<HhH8*5 zoZItvE?zcukf&x77_&;4QL2%h0tR%rsDKIsju8veS*I`^NUDu2bBOnjQ}BMZ;Psiw zF80VD=wSW<+{^%I$mYMd$_2y2J3qe}*L3I~Ke+#|t@3}pOajIxHum4Ev;Oy|Nnu?C z<#P$Gf+&2TB_*(_0FLFSXYWRwUOF*onx>tt23Z4X=cs@kswD@}xU^1g^h~pu=^6pW ze8CszeDle6mmn7p6^EWdfD|dyNB$<y+i8XkUnUQy&*$4Y^bZHuUxpCjWGAt)h`ofO zGJrr5Om!`|J*X;sPhzxj94ervS{Te__9}4Ofc>Hf%@?7eA4}|ajD2dy<hC37C(YeV zShbjdTF=e00;;4o<;8i8MX~B73zo%=G3+95(MGJcM52c{eXJ)`0CxP=%`#$?TRCiU z`kG#h%DE<IKZU-U&C*z#lPZnsDALq2OJiHE20*R(d%@l~g8D4}0?kL8KFftc{l?vB z&IY6OrbcC1BtWJ{ST?S<D(a+w-wJ<CIAf}w9%f-OuTsN#H`Z!FI%*mNY_k<RoYm^C zkt5Zo#Jjqvyi8pj-D;eks#Rt@f$b4)d!V;k1C>BKnD5ou30#)271<>qDF}GnvD)t$ z2fj&M*=&%VGF>YIAwtb!y?Ie|YWR?x(Xu<S<BqqlBHp8mjA@U73eN$iR%gpFCj7Ce zP<|>T5a+5#3i=W?qc_A~KjWxnJccu=Xz$PiiuHzL7#&Jt#VEx6v~-8J%V@+^q|MYi z{c+eNd4k(vCCT3b1G%D0UknFNZ?%lsqRm{_Bk#15n|;|H)9O&HOroVE-FG(hc4&ZE z(2P$V`Y^c7#KE)tx3Id<0tT%cp7~`AFs#cqf_JH!mS_Fm3^W1T!JXma96S=IrQy{} zb0%%7OB-G)J8g)5WpUWTd10Kg^gMRt${vh%)nB};`vmNAbL>TCRA6}wIE<1qWykbg zPcCUTMV-!d>owCDM3^BD{hCpJcQE*pH$gV#ErC;Wx|Pm9SnipSi4GEzX%cltZ8sf0 z4GJEGTyuxoh}YL_<o$SGkk|NqUnJId>^g{rSCj(Mn9xB&ZpEqiyz-a5H?)=3b8E8s zNV4xhy4<lFeqUr7Z#Q^6vSB=|(Y#H*zuJADM_Hvj0*A@}0+{muNU{Rp?Ya&h=|E;g z^Shu+6U6FpA1a4^0N0qW@zcFtFSvdc%!D6)>dT&cqJb_1$w&<_Ly*<nn}fe8JQZGH zizPmlZZQS8Fg#nsZN)ocv0`-yw%yKfBxZP^WgMA=Si<F#`Y|*G;<QDgv<r{y26MZ2 zkk<374T0i?G$)G8jsy|XLx{wAMa8pFib|cNxxgPkz6T8tAYwrI31wK}Hvd)&6}dVY zetJAdk6O(@X1@}60&@71Aj{>)afAyxX!#R8gU)gG)(#SXrbXZnoP4uq5;X(XFv+a6 zX>3lBn@9^3=&!a@<q#c?@b$p(nU~UoepO~~n$dq1a~deiHKe~^)9df+MdaVPS_JhS zjK4=q8e2P<JASX{Q~b^VTAO}@-~UiP{~x1Tp`!M;Jrjk;<*in(Sz$alj4(vmj33RF zp(wCKS}JWJx*+g57x!$(IeEf5)MxOkC!8+jMbGmIAM<v9>Iy7C*kVuccxvO@qV6GM z%IEWSgV;mL3SA>lp*KOzvB5IVgDpwgX_;?gI5<Q}&|T<>YK6==zNjtGgy=}3pI7Ml z*K=k&-d*&<ErX)jKkCLgNaZMlw0@Qf73m0@FhQCx!MlXeiFiF$#k(5u0X_&#J_k}} z{<+ZFl@NyHd)XRj+woJwiTm88>zJ{n?u+*PW8qBhLLy><lmBL@Eceiy{rPVk$Yo^j zY3Z29U8%-VmR|h=AfNsdOrQ*Ho4UHHwQVwlWt8>UlMZiEIK|oHw$2r<n9LI1j8ays zjp$yYLhFUd`=xXzfkWMyz}u#?zl2yAx0*g_CI}SMABQVTH9J;ClnnuXS0lw^V(FNF znoYuRP;5tgv9!R?Z6OP{OL3$O#=zcQPkg>s9WFwD^(_d8L4@aT5=s?a8<Ckkz5kY+ z&!+e4O=qApdWVr#!w{afUU?6)L-lb`R~sVZ<?yuUKpNJ%<f(A!sFgclv59*CO?JB` z{vnk!5gQR?UTfl*Wawu62$Fi)+B`Ceo9^|LQlFYqYKicG>c%PT*VUVg&tO4QDy2SY zjm2bF%vg0dwTFqL)$eqaDox6HxHo5b<wJD&<$KMD6W*98J5qUf4f1!tJA|C{QbG^> zNFgp5r*h$E+lpT*h%KuH+&3V2#-tv2SyzkL$JGiwZeF>fbV(hQ2BwSr_!rt3?1T{# z<Qw|+BL4Wn^Y0X_q_vHU^*`|MpVv{*QQy({A0W7?_U3}Ji2Jo+6u)W-2H^*Sj3Oc} zR_BIv<7cpz;t#?K&5D6_+grnB4aUl3XTl2EwXR`x{wDwDhaXzPA9GL(B!wL1=*G%m zpZw#82icR|lI`n>3+p)Tl>z*Z!>MQQ>u0C#>Grq9WuFghUm2<38IZ<^qz{5X#CQaF zf*+9#(YJ9s#v$mL$-q)RasrGY`j8?J&3!QZLlA<|;QEREfPSG;1T6Zobq2^_0kt5q z09VRDG;Z8JCf6j{ENFc;@3BBW=)L0zw=Nv`9rTWlU%SG*pCtHSWjNhK_eeShOUWc1 zguBW=S8?nd=TBUyH^szUGwHcZ_085TFwz#|m8>-DLDz_i63t}Q{&1Hz4#&BBM00Rg zVBLmTo3$&AFIBXyzJFV$-LXKdTj9!w1s4u$sTtwJ%L#eIW7Q-qMV*+xeM-%y0(?Xu zYf$T);aSqS%JCFk#=-}_oMlbLI6SL(vsS@VW3P{axttW?Aj^|nTNjt{WwB<@*PDZT z83dbE=PjR;JkTlb_0}gc$vw%DL8IuHL48?t7bk-p_2$2S%@_`iYL2H6r(tbXtG6$H zi1#UpOr)gY$kAjz^D_2qA(d?Drx*fE7c<PPDJ_3{tK3<QFt=3-{ZV7W@$<lT=wEDD zQGzVPbW3dA14%;AztGF(+}pOM7#3*EC}F*dp#Z{-3}0$x&gEEF;_`^!8!7_d97jAB zQ!u1UY@v`!)Z-LPYn-R!aT|a&bx)7i<CuM_7wAhz+KRhr>iOz|S65GQ?@VtM-pB2z zI4+D&hV8ICIAo>$0u9M+c}S<ADzaMS_*~>*w#r~(Y`X!*Ot*s<>_$|Jy`<huD#Y7+ z>Jtq%-UyXuOq-?62R=8(;>I?z9KdCKML;#{YLY$;T>XZm?=UMn_|2rJTDP1Hb8<Fp z<aUbnsQr#8qC6!OWw`~&osnw>tg|jxd^v+7b=!NmtTqBeh&ZS#8&>3NHz5w>{Y4R_ zO^gPq`R-cbRMDwPNbP_#R>)zaj_`d(XF|e#kUT~iLdsnipk{POw`}Y61ZAD0nZ%DK z`9$<-)~~Drk;!X=k_bh1nq3~u>-~rbzMYZ?_?z4aK6~P}R|Rp=V)u!VrbLFxIW+2b z>QCbRY0tN4TkELh&c0Z?EZk3qPr_Z~pM`RmqbUOkJ-FMoK2VOdHC4y-G}8eV+DZWk zX6jN-&=s0$n)ykYm32Cz^-9AHW)kRCfBXP_Rx{TG3mN7#g=+BS3*~Hwshl1}_t0Tr z@>%){i8cncHw7ld83d}Tbd$lY)kp&6w=djR4OnT|iOe!>@!}5DO!8*$5^bG9=g)2C zhntFe*FYJuTv6y}J@zbU^Oo(_A470wLp;z+iI}Hu+#FvD9GC*|JoXx#vUsEWFMWzs zrZu`29dr4^OWAsvC}BUpF4b3865d`bCI=`twM+)7OHA!s+~FKJo5g*Z3)bGBekB6l z{^OH$w2KE<?zf&8@k_6yRIJr}hcudOqE1~y0Eq*_fPs1cky+8)Sv7i7LpNB?Om!yx zM;fItNi@4ZrQ2AmE|%j}vPtG!AqRwCI|OatCMqg7xAqiaR-xma;2N$7gT8N)?LBc= zp8?k3Za4&tOui9P;ck++*zS@zNI#38ctVf`1UBcj#6^)4Eb(s~ezA@KN;{OsJ&dI= z7kRp<eD#c;PN8~45^8*&6`&S`b?pNIOSf9++RLBl2IrC^ZIvz4&9}tn`mbiLP=}&5 zuY?D^V<dj#YMg2~pCAffpw#IigWKuFHQZiWsUA|c=JzlvDEjb_8g5a<Xzk4<#_%DE zF$3mxpI#NnrZXhGzpGznI{6!mc^m@Bn{tya*JW&f2wN;8bO0l6uXzO`KU9)=^-?HF z=Kxryb2RjTBxwy6f3^PwI5<SAjYT2gBQA1~?-{DrUO?WV+PIhp35dCmysUAajtlYY zuCGd2N?^){)%p8({py_ti`FeU(0qDBeYym}GD$t-s3WZ=8h7>i*_gGoh!}k-;;t>d zONzdN&YtPqo8~CDbOb*JqmAK3!_<<xsDfx4-c#JdvbMn))W)>^zKpEMCm1_Aw;5Ap z5mLu5wB~x0{)K=s#@QHe4QB^QHDEk8EK5<Ay(@pqF*Jbwp!5Y!I*`mx`WYm-xBVjE z8RQd2Rn^^h5Z_Dz?INEMZWqe!(w$wZ>WS~XtNf1f;f+>NG|?7@i{z{;oEixJ8NF5> zqrFoEMY^>gJf2r0h7)7!AZa0;Q)Gm-_udiHd6-r+nLkdP8Idjb7YZHg0a|P*pi7<c z=@pcCpP<<n!yO~K<?yqlTpxc;D>*?SHZmWTU_)ek9rzu5jNMxZ1-PQ*8;dpg0KMZ+ zvg<$xcKwT1PCU?+SNM$wAHJ2tf2-A$Hg|CNMu7i3u;2Rm|Lb+l{H9sv<-UiSxL|KC zp<+^oL`w;+0@uOD5|ltr1!It<>CyM9qAyLPU7^`<<=sZwJj}lcAO#Jed;j1|xZP-) z_$diC9(R?o{+&~-z0B_J_6ANFjEe%X=ZqU66Q?A1(h!AWTU?EZ3$shuPcfd!pqaK8 z!fD0;=)T-Z(rPPKxo<FGMidLA)ctW-X3++;rV(Ke0uG$ksjb&kYR{O{wH7Rr=z+UO ziDF2??3a;}T(WcHF2Q3o4MUVOIS-i%U{p0GVHLafuvs%RsyNa&boS>I++8v5w=@#2 zMjXbSXl5Z|#_JGO8fUn|tFn|N+D7@TQwqfCT14gR8eKfo(XD8)29;&w))lNX3C4^C z4_yvO`*Vokel4~CYWw|m?mdP`6}1AN$VtBqzG;7rd!*;vK*TA97s|PqHCZ{xFnm)~ z9s2x4@urFRS56_BvH!qM3*$k#n1pR|IB6|zmWY+93=<3xqmsN1=9s}qAI$)aN{!JH zA_;b-#~mdM`1_d@qW?<#VVuI_28>DS-W;HRhS3j+m07d#0Xp|#ZnIhhr8t)5s_EE` zT3JNF4UnQUH9EOWEO^G^5&wflY#veqIXg;kE-My3<3l<9gfNQkP1q**CvbxQNd9i4 z?}rC`rg%nf{cI18sklEK1$F*5M?}!fAVS$8bbE-G#XWNyeA8y{>>3X2v0d-+Oj2Nm zDM~hDkKQMEUONW4)V08yH^lSkurW|St2O-qg*X|7z@2eK@Q#PRzc^?S&VF!iHkZ9r zQ|_p96s8ueJgP3de8T?u*X4X7*PB1c+u43Z4}DJ|zhVoT0A8Fiv)KyX%2cjV8ZN3c ztL2<cM_koDKzBCbI<+v(4|2eaodkp75tK?F<m^qk4|R?V<yYnl_<v_wlt3hT%f8Eh z;Jf_)Ep+)`b?>5YZ~Q;dWu@}E_5AmW*7O3qy%ypGR;@9T0t)F($+h1UowgLH!l=2w zK!qu7u!lkB2db9ff@F80U3Y&HLxo6uuR{t-k=~4><flcY+saI>KaMap`91+%-=X4x zPIjb`(iwV6mt`gQh|&>5t)M7K(0ED|DJt@k5JMGy`CcbL;4X9eMpYv9y3t4yjy&B0 zXf?}(|7;DEY^&|$+8O=?lHh`ed24Gb-U*!6TTaZ0@pw}Q7YzJ;?~UHyTPQ)J#Zvh? z@zWJEmhvLkp>o(em;{^vHcBnExu;CTR9eB;(I!)lr!hG6E{)ZFyun7Nb=JW@0qs@d zEkQlh4xOnd+KSSjO@HD@I=o=|<+>iix{rdun$Lsk$f(=9m_IWJCWN&~H&6?b*q;D~ z_z1*N#2($~+O|WY^B2XDwT~$_Z>S36GLjfaX(W-3%cth0B?O@ffccd9nP^2UYXi03 z4uGbbTuq5S<T#9jUus3ija01(<T6!rnRkkQO|oX$rb!AX-m!OQiJwL>1&7(wk?e{h zVAQ9y(!U+Xu-73g-D=uy!XCaY0}{*g46Aw(uj3Y^`bK2@ecVX7t+Z{Sba#VZYI$;U za)t(vXQ(p)x&2Z1>e|kteyh;gzRHrGHZFI%Py~Mt0qoEdxHKWd^)3)GmjLTWKW3do zAjEvy9GP>k;}a@@mp%Hf?5FySdRRTR601M)xPFMIdDtwb#x(F{<^lxbF(}O2M7WWp zl2Z1I|46W47x`fC9WM8*U=}&;9?~EtEz$n{MNV}j<ykf&X&JA^Dx1(YK_|Geq6VWt z>hKm(Yw$~vO&R{W4Hb*>XipJ>;XH2Jpx|a+wMXI;lt6wo3Z)Ljs`DHXyJ)$LIq``b zD^gxc6cys%uUQ7+5cWzYV*7mU@Rfg|8&gPjCfdIbLD}~qVEcDktbY!{zmfonO8<HN zdtWWh%5&mWLv{JWY(fPv{zeFcpq-^w?=b=lL>n{L7g&g|Bl-aN0_nVe5{2&8e+`xB zMjki8%CJ(<YEO@QO*vfg96xw}JpP6D6;2>Aq9@AD?tZ1GGLZ5Aq1*=~L5L<yEiUH3 z6-h>@!tSX&ponNexP<A>Dz*N=h8YKH9L-P81rF9<S!RySRe994+co=4a|ff6*=But zS~Yq(Lh*7f6;06YagZLR?VKjsR{j<>{!7(z-F7_b$_<PlsVr(;4!g=*5A)9^qjDds z)0=OxTV;FJu8i*C490-Fo_wC_H`MAAqruBn3Ymv|K<ZcW>>=@tomyjdThM!y<6Bae zY{vdG=_1{p8)N}8ioS;C@(dr@R_)}T5C%c>V|b~c;5LhRi;iAu8)R}ulL@=&s@Zk6 z>}ySWoQ>vDwvcTPx>kHaVbZ+SX}@rki*GH~J4<nV#NhW3SXO9Gsz#^&a=$>+^t9PC z=u|fHt=14)lle{6cYvOX)mZ&GBJ2{g$@KN8b~e?65RAYOh7N;tzih~EAExjN@1q+I z%{fZHMf2P&Y=78aW10S)9?~lu7_`s|<`1A++aoC^NWXxm+jurhppAHvH?dRhvT4g} zhq=&!vD%Yows`SWp3<?__@pggGK}{3Pe@*SBiOjYI3r?3CQ~s_ViG?B_h(zOH-P@! zA%ZXB2EnLnc-{`YP!eG)qes{QM_}^>OsVWit8a_qg>5DDv6w@<i?tMckfVKSCB8V} zXB5E`u-g;UNE;5LsCuh2`m=v##SX7IH)Ak(O3n&5u4NoELA!Lj2gap!qDlyQYU(QV z1L~;{)Zc?NB9lHN_0I#sIF`8365a|AFA>3>Lm9=CAtDXgJv-m&d;~GjW^oz$Nk(#o z1@_a2@uE@10q#}vxN(esT?KbwBA8PA?NrPEpYyT)cg5-dgKbER+m`sAk2Ta?uU_9) zg!RR|*tAsgGaqGH!bakI{!w92PLLRFM>=soXI*OIYUm4;7fv+@-Rlppk~yYy-;f~Y zcJ%Gk`t85CQyCv0$GhmhL<<5aHHdw~BEFM9lm%|p%#Hbwp&mQodTollzGque(8vY{ zR52gtrQ4dcCO!$xA&Ru#v!AX@CL$(HRaHtn!s|1duc@egD!o=UGEWK_r5cS7tNhs` zXU)qVDM>CVNreLwc-GFA*S^Fo;8zo42_DKC(|j8o_}K(;FZ+tK^h}zcEzqyTWWgS@ zh9q-VNo7ZrCv?L8M>F4XBPFc`LGn%7C|ap&BD@1pRflYD?8kcG=Bv?7FhDcF#Y3#* zBRajkVLtbCw0g{{;BLZUXNXE4Z14wHVE*azZ*o4JS@ma$C)d8`c`ZbJk2~_fGvavN z!>{FFkFc8!sb3(TVQQgHCSQ14xZrpu4#;GuWJm0@kuVUqKsRotYGY2ARIOEe##N}v zbX>=47@whw*!`#5H)A98{>QVNI>*K~_FtOT@KY!+UcqjB1B4c-kBRlkrvGYy$QybV zF8{s^o4$h=|CZeN&(Hsd7yXB2N>uui`3|dpKDi%`*(GRz2+1RcH;9hQ4`lzsvXF{^ zASDO;(yU6hckQ&eg3FKILw=zn1_~wR^}Q~zbJj$#j2DQXx|*2syq}!7`gpznAoJzm zJ{9JZ${c8jVh$6aDWuQe$D)R<=VV3+B8O&3?z7tEs@|;vc)&p7En(D+ufG#Db6+i2 zG_pH>tN{ti&V+3C6i?=zx8Hu>Rb89an+j^Ca#Z|_`WR}?UZ%#yU8jLIFGa^8Qht-2 zPIzqsHkga9<B=E<%BeMwf@jd%E`4Fc`6IcC790>3Dl`Ym)3uh<jg<VIQy*nww`sw# z$VW0mia$@&kog?)0mFRNH=Kv9DRhpM4L&qSPr<4k1gB;#(=lNIN3{TO7`kaC7Z-2i zRqVt03It<<BMf`fP{Wh`rb{9DDsDc>-Nbi}_SsrnFPardtK(KG0R0Alo=5;j>-W%a zv;YBaW_n*32D(HTYQ0$f1D}mzt}0b00pREwqaDs63=9t4-W0$vOrgWA$;f-Z?&gN` z#Y@8Jh((?U{Aty(@Y^H#kv>kR!#)il7cQQrqnK(M8+N!FX;TKysz_yWVeZyih+bxz zPFhwq*I9wiJQ<ayh=sx`ASYa64a^);1AIb|c;eKn#KaEYQWgL=N{_1d;GW{Ilk_{S z6od55l?jHZ1!g2utp7lUSiwwo-mEaR0FF9sJI5p*{N%5HE&dEETrAQbx>ZaX@R@Fd zhm)M^g<jf0GU8%9zd`2FezUzMSFOTsFyp&Q5qwh8E8%co;c{E4G;n(7=yD4}OtP3b z>4J!ocM&Sr#Je(})eKrZfmJTtsBOj#%QhS~p?;xq0xat>K!`S6yqJ+fOHe7RiPEXH z=n0VtGLi<r&KQu$p(hH~Bd(Ue3{$Qy=_C4oN5iK4c6ABgweR{}`~N@C@c*s}WGYSn zhbHi8;=CSY42_ygsqwpFM!|^US6~8y7;+q`veX~32i62>buH)7tE89ep3(GVosQpm zp|j;a@eEz7Rpe-uw=-^hN9oU9&rT-Yo*rL_J%lQb4~8PawCJ#I-}SFFF?tvaaBG!b zTBym%9f;9t*5>+-4c`T6gEj75YQhMztT$#gMLkh}wXQgjGilvp^{t|I(d@IA0>GVn zVpcietfni2yDnL&wq|Q@girp$h%7qMbnk`ys)1-$xqmNOeHiRAOobh0h4dia@LIh{ zy#XGd*48bZ$YIF~Nt-&b2;LJ)iLy;M0aw48LMd|`3NK3}exvO<d?E}*z;X2!V}H66 z{k^KhgA%DKJ7C9snK;Dd5v)Q)?P3b03>%Kva$Hkbmypq|qc`#aotE2e&8Cg`t<RqO z7|cUi4Zl-txj$cED@jy)&~)ott=l(9skXbhjrjT{_>oXsxK7lp#v2NQs4T)#v(*T` z4V-l$BJ&{B?HBmT8)3|K-<zm?OhY>ss)<qqV$T;0QqDePXGrX*n=$c(rUBM#M%7Ge zIWENk`o21)P_#jXW-)~E)I{kioj-g;;f4_^#ZwQU<_@rNe^~1UQpev71oH{za@Qzx z2j_M96?FxbSx$UlRhFzOp5&ilB6Vc)#9vV${dogkK)(PACCrVtqRbPD96qi8nbq@4 zmT;U!>Yn$YH3|v82T4{qFo{drP++b-XdQ8sW`iIaxs@bhmv(W2Fxcau^uSMsEK>Rj z73{pi-93B=GkRE^q(gv}Me`lRD$4u##NtahUMW~WV<_G(mZgpxEkT>ktO&T}AiKv) zYPQQC9FaFTI5u-gy3R1+TJ&fCfwY)wTXYdcPDt(be=m1EX>Vna?{aVX*1{P79o+jr zI=)23ZJRl{?>rL)3bcdo`T_?kA{z$wVkc$<DU!6*h>8Dd{}$~`4ejC5hO@{QnXc#T z0QlFBFY^6Xn)J<I{AmrxqTTnI*BR@dpZE9ZzQ7GuM)LKsf;7>?tY@wU`ojVNF&?|( zbnfCK%xS|Q_1F<weSfCouXg_$?UcbA>^Kz7K?C~u(8lI(naxFtb;QU!&?z02`H&FF z!mkS)m6y@=PwvK@>EsMeD+WefGIOsvHuV@0?F+bwogS6kg5}ae=zx=nP;tE?I({Q9 zVRtg!inDjc7#8DG$VPEZA`5Im)BVEC9nv_2iK;;wK}ioH&CPgGb<CbHXDq(lvora2 z!V<&;`*k3^xo>exUQ@(Sj9_!r)kv<GQy;l4&5BxidP|gi!Kdjx2RN`eZo9uOu$j<X z@kk@0-GP+fQd(X$YocigU*uZqXV)}OSaPp*U*f<{ZRiWJt9f4ruI=qsF-u1Io2G=A zxt4Wroe_f7k9DiSz1HcSp!(Vd5CzlJPF{Wb-bUgAv+_A`ij$zM(2@RVD)$|gkc$eX zv_y`BQ^ibcQy%pU{`-hEsUcM#`x_~3r9FrR0l8{lM#>XCJ%encU1>SYu&bJCU4kM% zu&#jOS{6FHo~6ie5+zx|y)N0k&eb>APMu|luTQ!uedH$Hsv?C|)pDP8od%Zf@L%DB z?d11_^zWLo_?E2r{+*gqwzl}c2v(iS;|kx#LLQem@jm+B5D2$HA>`r^fywY7wJ~#Z zlu(rd>NV}eigu2Sg3_d8bT4$Y1!1Cz(0o0K*t*bc)*B~uYR<An0)cV_v>T4w>&?@r zUBxz}*FN1|;CfKaECVr%Gk{uFjmY}Z+SHu@@koWD{1&W1mY<Cm;?p5}fZuOKr%A9b ziNHXw!0W6VB$7$vBI<gct9Ie7c~sCzvE!O1)}s`O1=?z?R{3GrRRPnGfd!f<V$^)` zbVgHg&J4|Gtwq`e`A_dZRrF5i>!%e<_Q}MIwi={u_<O`~jV)znH11DX{BGhDbB@~B zjSCgl=r@M#`x#$EWOOtv=2+bDLHf58<Au(A4EUNezsGw^Pdi?8A8_+S5Br_IW(xPW z(~XB)*D5etMlVPgE>m2rB<#9V4J9>?*vl5oRZfXJTmY|e!7f;(GLTw$3dyXdC-ur& zs_ZQKr0CpVi2L-7ErFzqvnpB^fdXWKiYzKQQQ2%ZnB1O5i8%H>MR9pfj2#q3(f2sp zVrO!56^9YP@>1p*qBZ4b(z8B}iwWo#QPzJfZ2n5J5;l5WWJQ<IBX*k8hhg;q0m7}5 zYiU1hwU^dFU3+G6FNZCON*MU%1-gDBi7DU@E>I2<J@U*<a)(IH%`1nxmS~1fx}A*p zCdZiH4q;r^4q-avoNGPr=TE#!tn}M6kdl`lIeV6*D@WCHkb-ku334Wy$+vsYzfadr zd{Ebpi6AU%ur<dqiQAN7ce#-hF)GA{w_1k>))jQh@YnAnpn|kj!GlSHn`h1%4Pf10 z#$`L|cVl)t_`K}u(j}W>gTh}T{@E_S>wj}-5oWCtG&&=!2_|H?_mnV%zl1v9mRA+J zCMJ^31?>7-WTFszA&y6w3_lSx!8<+n4o@pN{Lvn?<(T0BQ29+UM7(g`QwA~LQZnP4 zU<-r)B?xOkj>kLd9>>fmqNQU{&&ZyHsS0l7`|r20kw*Fg+V}Ep%kOXy>A!Ju{=wRr z>gIY{gR!3yX{l`P-^*cF>v;4mcY)877@BGh6?uPPO0p)^#==jixyOm%O^2i+HnD$i ze?W{vh|)s_^3w|j@ozPP_FI*1=|dX1LRy)u(_anX@r5O@{4qT2{jrrkJ8^;;`Yz`p z>!R$W?6kPNC|ix|@r2;3ey4=Td0YGEQ<bHAxfU(k>?Ht>j(7H!;<Lozl?nE%cvtrC z3oP$)?mjfG+lxZK{&yVW*b}FB*7IVRVG(CJ5Jffog+z21V{~yK->}2=V^6W0W$^`7 zI4ep!?~O!v5~B<=*F@yi7{w_Ts5@e*KyKL4voF&)g4EC{VF$Szr8e2F46~Y@w1hMV zB%|OUt0FB_LN@$5!IPUVer2bGG~Q`Jtd_L+EQLyuIkjw*8Ta0}ElPt!T7GJ#Kxo*& zonOLfp)?We+vTM-Y)^7ym3oj2<t|LQD3PdJwn)pQ?9fJAe*nXhRymsCS&@X*ol!cf z#gb9nRPi|OS@;apO|8_8ZeFJ*$^<%&gmWl%<_a=aVS-sbs?bfX=uER*tE^HotM1LA z>2{2xeP&!pdpt(j%`AtU70i5Ar?K>M$lchY5>M(Uj~|*+YrLz+Z9N3Kui`=?Fe|1= zh!)mB7k+gDHRK;^CKd1GKRWJjSI>*YMszDj=op$RO-x?XI{$YHU5cHrjt6NIvle|B z#L$juDFK31N_xp**g>|YiJyMW_!Wp>UXUE`c<JencEzSf9*vU~B$LVX5Q{llM5D<R z)Zkud(UsMLg(&@;#81h|CbNl&v}Gg1v7b&{0Srur+tU8;5uuYC^qZRg4CTue<+__K zjkQ(!gG($<=S!7p>*Np>XD~WQ6<0EWeTxkBn;XiVq$xQnv48#L<uz9edBidE=Sr~s zwF^cqpc+N}L$5Gsv|?M^dOk7XMApi!e%`AJ8(uD6*6LZTR9Hg>m*K9f1Q8ZhUc3t@ zaByP4iMp@`I;U1fwS$bkGAwxxx!D;{Fr(r!oG;(WaktP|&V_b?=8BQmip6Luj5$0| zhc~53_*^ZlbQ-2(Y8FF)29@X0^xnMcQ5Se~#b*hLhQt+n2DLTSmsT`OMuM0oSz=k* zm^XohSF%XMksLI`ycclL8ia^bIX9+^&a4uqXvT>sPv0wq!P{{4E3DjB=sm@V$Y7%! zC+sm1RYq9hN$~{yN{e7VltX_cA)c|!n;*q?dYXczgf!fg(noPLrn<H#v<5pv%a3<b z7EDhz|Bm(ho}5a61*H#b3uuAfKtNfnPNCGOv9!w7{8_o^=NuRXrVt3R1tQl$#}rF3 zCkX&)4XU<=)R=s?z_x~I55?S!%N*6s<dtbE&hv*theJY~2FW00;s-D>nxesgD==To z8kL8^Xe6-n;aMKLfz8PlRF#MSv?4>??F%vaeY|2;u^2((FqEY{<}^6LdJYlC1ZqB3 z2{oA5)w({3mp4GtYs<#=m=-G}^`WExESws{F`1^KHG35pCaemZYTNP4S&coDVz1)h z8*Z79OCNUVzXp0;MeWe`E?DxliQF|%2gv+p-JXPDdv`g^VtVM@?JFJ?P6J_C73sK& z0ASccOU!}Lgai6b!cl)%Gh6~G=;U>AUOIwkc2>p<plqp!-!7yYUH3ADrk5)8H&?b- zO5;ui@?+C9sw_BLo%v69_<@7ak}GDZUs%U#;1tR0auq73mV#?)Ot^ZkWu!8J&PxJB z{1kL%IoeI&Y^RhnOksi@<kVwP7-U0l=zgVprJqaBUa3J_5Cx6wgNc_Z*u!juX~Jyy zV#97!h-~*>3YGZLOhFEDwM3HA02;!~cRX5T<+xEU;Np547z(7<S_2$Q0L@yHG0Tw_ zPQ@);EUVUHYR(u)u_XlB_6&$5Z#OWZkp1+<b#pO+j?k3B8w{N{O4!;0E0q-+j=Oy{ zhk%QO7J~MI;TXw7MnT$SDhOPX@clx#!M-v^!7c(-$~+q^`$R2i*M_CVI*mcAmLTN_ zCe_x$vIx6uFs;!uOJQoXNKE@k1^4%z28bX{<spd6HkB%-15Nu*0yc8d4RTcs`*_dw znDoOxg4Vs4fDOuK%sX5X%C`-$!8(HGaTj&9)}Df}NOZ<2C+!Jlw<`bnV0AQDZn6Z6 zYq`lxzy^s6S)^kPQ{ASe6Hv4|ht%$BG=^Xo*|SlK0(v;82MQw-F=ZHRM}QB#QL`4E zFM-E_j$jwvvzdLiAKM`~U?Y1l3&=tcPj2@p6)ziaG=vlTC+y!`Ez6OBJA~&{Yuwpr z4B^{7gF(HKe#*h2R>REiT>>AxDj?=02(=YF7$%UbodGTeWgW)mhUq%ohVGsscH}xZ zFvAmi7P59!*J~lG8ifrnwf6T!fOnxnfy+8QVkBu4a81qdeDe<eJCQgh8dhm;#0Ziw z7XT9OAQPpj66On9)$&0xfSWSf{EjIRPQJHDUxGSHq>pEiW>$<4BTR0#DoQW#Xh48w zkOr5#77d`5aa;OS*H+0?*2SoI*}r^XC-_7qOqyh=<N5cfYW%D(!DFy!p~U_?sZK#K zD~9ZJfxs}7<T;KY6yV7_jjb>csx#Lg>hkQ;q_?!}lL-SJD0?H4&BRTO`(T7`&1=fH z0g9@7?8b;wGwu11oSm{o@(2a)+v}dEcFaqdFJr`Tp%QNrqmIDFSa17nefwd?;NaEU z(#gt`FJTu}HP<`XFin|1%8^^}AmpUB1EQQ$c0SzBm)=_Eg<(8417DwupI)rljtaNr zZ!AN8cyEV!L^3VFlg#OVE8?Kq_gdBKK8{@L9YI6kM5O`k4C2vLnrurQ>zRO>*pd){ zz3B0|ccsUkB^<*IiL?N3Kcj2iHMHJbD41!e)8V1H5xSTc=e~^O90+yHjLh1Wa+A!h zsoiZ6;mE2e)6``%fiuL#d5-M={fwoxF9fU!#-A<PEw!f?Y3>*n=IWKM&w6fl-e<0p zdsn$Tzxt~Hkl3`0vvVNwF?<Nq+~1R0%6RKGrE0P;<#d}Za%)O$$Iw}cE<@p{q)vU` z%?cQ>#PRg}gj1OfgXZX(wfV=*t!t0bR$4n!F}W{m&0LlNF>A&2Jm-taK&Yln0GU5z zg!R9P+|Jc4c&$~?;e0^r=y@EmV%*K6r^IyM+Jo+v?U}Zaph@_=ol40*wb0{(PeHbw z>xTsnVu8b9`43^L!`Rw3ZM>{%%-%P=J3nCihI4UopHu_=f*oEV;eU>t>SB?$kzD<z zc3bb;yp1{-j6LMu^6iI_K3?U%wm410tgqS`Mqa9{qqi1S&{)j6<>v;~WH^`S`elYG z*-6@0jA_om<Y`pTwjy<}P0U7o7%357^tsAEV#czco3fhb&Ql6<edNE?chZp6ts6T} zn|*Ib$ytl$i%wQrmYk3CC<53awRpGsylu6Nv{Clz1$nI7zeX(B#ZJ3)`D=k_&#`B} z`qOpnb=Qjb$2QZ5Ti;$sK;;x(3NZZ9o=g->I-bj}^^@vts~0>)LPgL8s+ErVUw*UB zn`>FfTXiWa>Yw|TgrdG!mqU0}+vBytAJ2b>*|<^jXExZ(40s1!Ut^ay;5%C{%nu$2 zbZvhO{fsa>86G*RgW~X&k394u-+}H!zIo7Z&};6f5()C}?n}|IG45FpuWdi9^=+;x zLEm@I&%xhMM?DW5^0LP-2JU1xXOkf`?vdP!_h6`9Lce+3LqXD#@fSzqSMJfQsX>po z@MJYcqzFT;M4JJ6KWrV@<4Ke<jW-V)bSx7-zvV1I!M=G_aE#9$Sl}Tid}LO*=J)0+ zx+j<M@S`R!d!(ob?&6&o$!#B^Q0FxjmE`I;9I0BQmYB@#D67LKK~d6BTMD-q*4he( zT9mDL1b^==*@*1(<uj*M?v?)2RyL~{ubNP-rSkFXXpZtz!5MY=ES1nnv>*#febLn_ z>w@cZkC(cLHm<6wz6*Xncuo@WbSZYya>K>a#F$Q|dc{UKB&?WBzW0e+N)Jg&82PLQ zj>?XA{Sm?dxM?5gAqP{{fM{M1+0cp!ZwQS$68d&|B}{jputRd}xdt{nA9Q$@l1OjN zwPBRPEZM+OjDqt}$}*WW&=}cSj4W?1h_)37eOx+ZRA=B&{?i+b>yYDNWV}UbYk=)Q zP>aH+hvg2lDxPoOodbaFV4spi`Gh}cc6QhgZ_BsdPLKH=`oZCekYCCWnS}93Y+G@} za!L0GzeR8iHDvG>isJs$IH~dIu+43%6sAgXN?`AKa`S4wTD&sOfq!<Oez8ANUPqDY zg>yL+ooa`CK*a5zP0v<5_Vz--GC62C>eyW3Jv6(Yq3-K%NWL6Xy!!|CEm|)Mz%W>E z8o}p}6cv@1RSD1*Et%D)=A1BlM=CzT0YvvVP&fOXK}KZ{D8k`P?nVeeRZiT)*pEM% z=FU_qeKs+p%;7KvQdJQe#e{H?@5!Jesxq)<)e46sH(6w?SKJ)^FkwkxQ^6~{Jy>!L z?-0%cPaPB9Qg7@EGm^=Q4d9)a>IGPIM!an+Kj=s0)XsqsL{vM{mxvH33e!z(xV#6{ z`Ke{~DFS`$k{wC!l};Mz_P4M{A9wg2cg30(J!DExlI6~DOy0jNOTs*m^C+sdVS>|8 zKQbY|-cZxXWaaYAPh&a(6n8nM<Q~jV7H%>C$E#4Ax1dG1^7U`<hJ>kbyP)eNt<$z# zeKqf8_zvmg@OpT5%}K7@-KjUNJ3r7^Rf>FD;loeDy{U_?lNQ`5X<QbN-f@Dz4^)(> zXHyC%i3!D^8iGWLS`tcKhJXqJ60@d+&adg%I-N)y%VpG8B@euw1mA7gj8|K<pv(RP zzr(!V@!@B%_aIaJ0gjCz$_1)gI->2kPH>G~2^m))x1XKx$48W}sSyxP{S^wVRF|HV zSk#xKrLp;$DhJ9vDqaY%EILEM2Ie>ubBPA(l^rv|ENJbGe@9V+j@`0`*N(IrXNb+t z205{qs|n4g|1uYbn6-A<23RGq1$3<Li#1?IZ%?py?1U=8=!}ghoFojpLekGmVv^L? z;9I0*^B<W8o;Jo~+Os(vcn@t746WK=>V8EW-~7xP9?syH(BlAPhezomNa`j4br9Fz z)=~FT)xlItaCuX3-KK2-mJdlf2&(s_-7;NWiW66eC_FeWNyhAkMMLJM8Npo?+Ozl3 zBevk_Vd?ByzGrXwCsVhv6s(Tp+}Ppw3y4LwYlS3-2BbkP8R^(QNOla#O~s?%vbkoe zBg7QnQr#UJByEJVsd2iM+}^v!s~<Pki5#X^j#ewCz0)vEZtY&Pn~tBzj=p%fD;h7u zVz}Wn$~box>Q^P|b?a;Rxpn}(?tsFwEWKETpFp4?3BvCi5gy4)HQYE#UD<JtrVm2l z7*86KP&2s%1`Qu*dto@Bteu@9*C}Rs4Q&m38}p@MGGb$MhmYy{Rofnx)$v+NRHxH# zmZtydEWY5^0qr-x2S7QY+sNl{2){*j_rJ8-{^&15VW08l+uF;rQJi&wpzA)Q`H&r` zcL_D^?nl~clDwsB`1(M}Qm(;z7oBrU)G6><7N|{(C=aHd(2(eQrshhDxlelF8qM>` z?!0>eag8!)0GMz9P1*xxHa$t6>2EWBNqBCD`#9Y24Ad)Tu`6xK*_p{(M;4Dbj0LQy z%O9jFpEv&AJWr7I^R~32?HCc~v6<%wf!D(hX9T6A8GT&3cqG%Ov}t_I^NJRnkCk?) z40aie{3tP3S-krhh($@gBH7JJs$BGY!0`02RLo%7Lxm;5!mS%1%yUC9v`4f>ieE4H z#l!OqX^|s43*g(cuhNd>V;JW(jq>3?_#5Zu!R`cQIIF)&sZ$kIb0@Y*8LZGeMsTds znrK>jN8=W3HoVhJ8%0!N;w!@&QL5YHfg-HJ%tTy__Huju0)K2$Wl{|%)5`w*z1p=m zqk(I6-12zJ=u`GR8QMYSslPAtZ@0EflK#cS$XoUTvUzAD5C{~PM{Op$pD8|ftE~PX z{g+?P+@KCOnx(#?cP%8e!)k;X?=ysdA>^SgL=k26OVx%=wa~L|(d(mYv!{8dcze6j z_h|LI<1^Y<o?RX9oc9=~qD_4`-l$f50?vt6bw@wbFRJejZW_4kU{9-!eQ-}zkSTO- z4?q5eS;7iG<Q@IyV}E?JOaBYA^q;K0(SPN+|6`Kgf2p{t<}TQ#sNN#$BX<MgXC%(? zO45d!NrxD5KW-J8qtav8n-uqkhA3#HDncuimdNvCk((1}<;+%dEzMWifFWa0;`Hp* zx_WoHwqJ&_b22hgj=fBYC6`(lM2{yno~OLBpSO-_nO=uG`93jwe!kQCJEu_IA-?D> z5rl?QRzUbq<^7^<3Nrw4iZW@%LvB%uj&Gr+rJ~GIy%hkFrYABRAUnS$q%D0>;?e0F z*YC*NTZCx#;`B%J6dANYbnJuKuiyJ@rPo1!W(yoV9-N|E*bi?ZPSQpCp{sJ6NZ*CU zkKUycUA-@@e-CT-x2UC~bWalsYqBGg!6Ar<im54aw6HX_BZuxBSePpwH)Za=AL`76 z@ifC4okp;C^sJa@in0874j8WIrog-qd@d<#3=0@~b)qM}O_^R{|7b2QOH$gzeu%<t z?}j`U`z}eI-o7cHQVE~eaD~~eKx5x72c+)18DAAk^uvl6Zz_ydKixyREj26aNu59e zdFYZZqp1-jO4S;|Q=Y-Arf1j3PV%O;fO(#xgosF|5OkfsDGHZ7hB>FWmEw1t)0(NT zZ%ah9P*p#+ogxb4pG<{n=s1{w6yf)5Pnc7k->i4J$D=#<?M$I?U0K?hS7DJ{XmYL1 z$*JUANc5!G=*N2^dUlbO>oy!(LeDbH6emaBR=LFm?bmTzLCYIaUSX9i+(Np3Ech~* zZHTPZ`qMW7@!C0m)ySk|8>=iz9uk3a={c)1BmX_(iy>YbGwBzbB70ITRD;4)n5Re3 zv3feudeh@Wv$Z^3LRkfij>W8`O&Xe0Gm<P9kBEPZ6?L=1+A3nTS%Do>Itv={wt<V` zl9VjgxJc7Rs@2vI6jBy^6GX@Mo7DBpv^8NF%I4Es8Hd%1D4TSGS*bgvsf0_UefSUO zlhOpCjKz9kL+Dras$Sz`H{46fK)!Q*kFUEgzP`l_I}Oh2auXo8ocZOEi0?dqgdyha zlNHO&ThKff+&&cK=C9Kh9W|qHi<9BcG;o~1SX<G+Sa7?({@|=xQR+!ugb+(NKRxC8 zHC;9PU2b_`w};_T2Cj}792$9encork6mAWh`b?IT--Y^RZ<#>BH*eWd&MAov7wPat zRX+eoZInHV$FwzpEE#?ASl&^}UDi!0=un=cDFEG_WE^xJtRnhKeVAkBcPLe5t$F(B zdMxkAZQBM_DexyTjp?KgPItFnTep?d7nJi;%7+2_B3wz#V@$6<-6N=m@0Eb_ma<*2 ztl1m5s--y1ew_AvXWGOBMlS{P^oSw+WJ3-`l?LTUxly?Y@u^I6d#dM}QeckO61;u5 z*oLSY({aV(R;c;E4J-16B^vd3ZXp@#!TXInjaahq0>{!8;$%ZPqW!!dTfeZcQFyZ1 z>`NnKReAcFyh{VoCo(Ecg&r#L7$AT&J50!dWuZCSI$7O<R^@nZTC(dU*s~-ejq6b| z=7#&<8Lf_k9e&8qp3BkqB*I_sr_t!>;2*rs6tQS_bbKP5x$#Btj|uuR!tp8n*%I3T z#I*o#zgxZ75dLNmV{k-117H-Xi89zDKYCfrph%G{*9i8aW)#fi>{Od&bOn&EF~ftt z+7Pq>z)@g8x%{iNrNriHjL8#Tcz|$oqk6D3K2kKbzn0Hlx!8<i`tSJshb+icE8n|p z@)xG2Z!=;3@_!<)1YuqPB6(a<;dfaEZaBrUcB2H};q~)>MjN0IXyEo3x@M3g3*q)7 zf=$>mM3McVz#U|myVoDXx{f+xFGNmwCa95_dZ&z|Bvtyn?%{DPH&dD&SoE3s&_z0x z;~M43AnS-z%h+87s-#;(dqrM5{(uxI-x``q{p*WxUWkEWpcdlud)Nt*NWi7ZdDIrC z_*E;|%V30~wZFY1*p<%<Jk#jCx3s4uJ~7vKN9oQ>OpJEBchiO-F5;>!XwzZz1kddp zLZ#w8zx>=scB@Ztd0c#j?z|9PpBNz*-EK)g4%Ib=AD#i#u%c_fz|}vELP1yJH;%_G zBIz&kcdB@=G(LXklqV+FuusvJHyD%Dgh&vGat^kil{edhO2WkgZP$cFd57ALEfGEm zA{ooH`(!1zw_6z}?LjLUIq8nv7yXTl)rjW5#`YLa&C~01FLasqF-bD~i?@MUFJQU& zSK^=jJ}|QE;-6WsfAZ7xKB+J(n3l$B6d_yYh*tf=XlZKuwE1eZmsuk&H(f!fH*$*- z=8VRBrHYD*9hKoEhI<&FNX$4HtbcL+-fc8Vrj^C=axFkI+|CN6am>_(t&OL%n-LR| zXL0(#i=SzkCh-Z&b)93uyM`NMyhTR&m(~3<4n_DN8BWx=fa0lu|1Wo@HZ_;#WnRA` zFqhUtg=`xdz#g5)lATxmS6KhH?*TGIn9kY;$7<LVWZR956j=3fth1qe-()4}Zw$qa z;8yJPxinL7tqQSn6=zjLjQqO@7}}N)4z@~<GPN|c!IXsknq<)jo0s)p6bSoeBe6}? z)8gz9hYn98@<n3eF!cD9>BRg7*A5X&9B*MBPkOrMH%aA`I`Ybng+8#5_=~W4X{{&s zp|@|-*oP4uBv0IA7toH!!d(J7dy@Ny_DjwVaC~P;D|)N5{HHp?{K9H-kn(a+Nk${B z{~CaG+Xi)9`xa=0zdbJ0|5IlAA7J1gd)GgZAo4rry6_u?XS4cB)X(^@9Ed(@ps{>e z$;(f|5Hm3q2K9j6W_=e0u=dNMOQhZ68_T_L_>>Y5@dZ<#gj*R+J$2&S-1*dXk7=Ic zjqk;++de;1`r?`E$jeg1i2Mzpa9gs94gq1K#1G6!EvdaUQY3boUDqWoRNM3Rt;Ks? z|EIDufroPI<M>d>lu~1>khSb`Z}t=!`zW%eR6~<(n0XDNNTWf@b}bdxZX%T;np@o~ z(jpSKP@+_Hy(&v?mP+^bo{8~rj4|)&GoP_^zP~ePd(Lw_=l4G;fL^t`kw|tiVN}*L z&USsIm7Jk{c%)>R9*x(!@`lVOub%65yrN#sRP#t;S$u}Rid7@pCX|9Mh#q$0D>wVy z`ks^`e)vp6hryw}6~U=;H&Wd3y($#i=Gfb3f0I37m4Co6CP43!Z(x-N`X5osp1tms ze%c3}6kDxdVi;xvDg5Kk=TLkvqlYWfL@LvboWsVW+U`h~6rz383{`x@j1I34O>A9u z(OF!w(7xw%ab7W5$HpM}K%Mf9$YGm+jk=D;r>mTjH9CcgYjXwbLtab1OI>AUy5g{C zP<EL+S(2fy?AM3gen;uP$g=DpcOBb+jj3wGpPx*i$IF%EQIA~w2Yb~!ACk({bG)90 zbX7~HUIl^sVnHyzi+Njd8+yOE-5J5Yd}~r<Q<7xd(#%k4`zY~gjhI6I<L_&Sl+)5j zZTHHq=-iPMGZ?QL!aH=@=iHkHdo|sC(Rpc?5}(w#@rxc!y>+qH{X$!n|DOCvC7Z1h zLb#ijLmCEVe<tV+)Can0+8tPK-@)^|drMlkteoG(iKAxy6}b_=IDgp}rQ+e(VqvKM zpiXgQ;`5^Gk{$yz*Oq&v6GH_9!g1HKZYI5L?iRnhJXtP(T`l>mlBALG`lx+>j-CJM z{h@xv#Js&KqkRhBOy1ko*g1^9E1Qrp(!v^?%anZ^SMoN$#p>Wa#eciXlWFTD1ES($ zH&V4-ltR*P33%k}#G;=mJh;o#As5=>+aU21_EK|k|9@jb19hYPwg}y<lI{MK?5sg9 zbib|9+HP_6bxZlku^ud@Zcl2fp4{^=!JQxD;=e<Og7$>m-xdxYfL#h6fHhz<MgmE` z1kWID41cpzY<AQdi$pi`Eyjj#wYyW$U$Zz<BDhE1K3=szL1Nt0@U)hH?6O6I->qHN zYkcGRSE)zjf>t}WM{V$3mj0`ekRsBM<`vXf`EFyewPD2G@^lO3*a69qCC@P{(GljB zE`En-IER~AWiM9AR!j4{Uk=#yOt;C+#-Op<(;EA!y|FJxLO9WFXBeaS><3EcaP&*( zzo~{Dmbt3xpYxQDABzsC^mB-j_Y4fixsHDJ@(yo#wk?L1;9ELcW8OHntM9o~DYh@8 zuPLcd@fq&(3&k|dQ~tzN!->&}k}9$L;?Dn7wRQCA2?Hg$*v-@qnn$E{Tf&&2xYXs+ z_LD(>AN;Ua#b*3^n-u!hwIU%`r>>7{oU5eb3t#wbl-7!T;3rgjJ92pfS?_rEApy7Y zS9*>cy#}|gS#39hFKYTV!#^#)X~5`sPNONB&!GZCky=_LR?Jg)3KK5)P-{=pn-RD7 z|KV4UFm2h_XU&_LWA-qv&zCnd!%S81{Fg%;N=8@A{_{GzS<i^srr*Har$4t%;ZSrl zZigT{&g_(j)_06WVw&48`d?!_^=&hIp}h@bcQ;x*SxkJVrro=vnbIx4C}7sNZ0oXi ziCVg@CU(^ZAK?;{ySuV}{?z>aQPzz=BLBF>Q^P|%BeNnwjwq79i}r|@D4J&`6WOqN zeY4<!j<3najE8lWc^zKTUAUJkPaZJ{Oxrm`Ib~p~;<{=3-Ah?z$7<|zmv&b2Nf~;( zE&o{nFY~wx^TI-QHNX4d&DOORr$TP%I>?>G@M^Cmc%VrU_17)(9zUH(3Np8iJ<QNg zjtXO3WgK-qqNGeA<M!(kG|Cp+II9VLc61G`FE}|`opun*=a`2w<E2~VN#3=qa}lBT z@L2m__C9*G^!~a{`X&Rup{3UzmkE`&Q0{n-H41sPW)uVn>wT-!F6ng7(=exsw5C*3 z$^`UBU)w+AjcY3CzPctu1(Qyh&@|3*@)ERG>GdpMP7qb49B)w7x`l3AJg7h}x;0XH zOs6_OLo-O7?~z)8VTm_**C=p9U)bW;@Ae%!8vjrG)&fz`lo;@0df-oa--Bn=Is4xK z#g*H=;%p+BqtiVPugD@`558mx$YcUuh-p4BSDQ-0sDU59vNdxwQMcM|u4!j8JDY#` z79(TupPA21fk;WyiB1KNgrKIg*_v#(GB<N@)UY*&3Ct{@fB#6}p}wia6#f-_&2*gQ zlmoc!%*atam1DA2Ic8)wz+_@dy$4^;Ft?owMKA}DuGms^0}RO3V3O5j<p=L{sucJs z8^AUaDTo4G|H-y^p8#;|lIiu&vfqP0mJg5G#dTnXqW~I(8ElP}=u~+i$0dAn(F3Es z?f;D^0K6yQCC}o5cRDozv_2a&7Wgp`N%#Zvl~q~MQ%4W9Ry)|Dne020R63OmIu9ox zmT(XsOblWPfD4jWAb~=`fk@?q09GIbxctr6&|AboC&2;9O|!}`0Gx9<$pL<7m`QMu zH*k#h@kHEDV1*sox$ABN7DgI{lAWbM7UrnHzQV((xPp9uX#g*#oi!_g`T?V!LxH)g z4_W>2B@A%#i?(d?zypHcFT)lO%(98W6yOD8?n5M)czS{wx5WqGz2>X%<bIl37^v_V zP~o%tqSpqt0v3UI5C+u=xJz1+{0TS`$uF49zG^Z&b##kCClL}up;TA}2k&&MD)^R7 z)l8zNf~_&f5qs{}Zi(ItfYS+Ha<jN=K$l^|wPN)__B?%}NVhW>9Wh`BayD<VHhW$G zB?wO>&NpQEt}Go42UWTnwA<_|%>>Wwvn$^e4><WSxu)I(Pe1lWt@tKfMhCO6G2qI~ z`sjFLPH6VDkJScaBv8;zU@iikbvn_hrcP{WIFi@A9f=gMdL@Ggh1w6MFuiFMv$cm@ z*uv~U;1?4Lh2ZZ2qUtK(NS=5i7R(KSJ|4k{**iRXrL5b##lTdw8;oG)ZZRv-sS~>v zR$*TaG$<A@!gRv3Wx~s`S&@O^62p--5jx=@Tl!T02Maqm&L)h8BNrm*{XU$~v*Q@T zR5)l4Lj65(dKtqhgbxg40zfbOk(g@*R-#kaQsw~XU&(O7GGq2kCgwH%0Km=|X3S%O zaAr7y4=X#JnmRW#D~QVc%WfDCM`c0q(jjxo#=>)R%LWU<(G(D&=EHM@W|V)P*a|Qn z4hw+b3E`aZ&|L|Ph28KG?7aw1*qPfsFcbDhMwm-!oR~lMl;&Nk!8XJQb&MP8{HDZk z@nIuXL@4_N7sa1zs|pLiwv~uL@+mF^IG9+%O0bI^qVyq&3ni{R?O;vVhz!xpO5sA2 zlPwu61)H)UQWF_mNO7=eft6tY3q<K_78gpBqs4@+8wM-|y9^*w-*dT^0`m)V`kpo( zghk+^+la`DLas$7$LkDZ8(0NCBaEmlJIA%k<f%#a>jn5ACL*xp{QoJiP>sQd;1H>C zumXmzaWkg(sYz|Yx`GcxA$*%sF8G{}N5KsPpCLiSqRSQ*W8W6=(*p?eRqY(+kLsBF zECF0j_>T|>v%g_sCZ}r@ymgC^g`4J*x!=fzKLNa*i0Hg+o}&Y=W@mJx1uo<878fG( z+vDkl-FzEfaG9BzS*t|m?iMT2se)iLW5(_odEUJ)I~zW5%Y{PefPe47&D?g75rz66 D613UA literal 0 HcmV?d00001 diff --git a/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..94920145f34e --- /dev/null +++ b/samples/client/petstore/java/native-async/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/native-async/gradlew b/samples/client/petstore/java/native-async/gradlew new file mode 100644 index 000000000000..2fe81a7d95e4 --- /dev/null +++ b/samples/client/petstore/java/native-async/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +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 + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +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 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/native-async/gradlew.bat b/samples/client/petstore/java/native-async/gradlew.bat new file mode 100644 index 000000000000..9618d8d9607c --- /dev/null +++ b/samples/client/petstore/java/native-async/gradlew.bat @@ -0,0 +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 diff --git a/samples/client/petstore/java/native-async/pom.xml b/samples/client/petstore/java/native-async/pom.xml new file mode 100644 index 000000000000..135ed128d122 --- /dev/null +++ b/samples/client/petstore/java/native-async/pom.xml @@ -0,0 +1,214 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.openapitools</groupId> + <artifactId>petstore-native</artifactId> + <packaging>jar</packaging> + <name>petstore-native</name> + <version>1.0.0</version> + <url>https://github.com/openapitools/openapi-generator</url> + <description>OpenAPI Java</description> + <scm> + <connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection> + <developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection> + <url>https://github.com/openapitools/openapi-generator</url> + </scm> + + <licenses> + <license> + <name>Unlicense</name> + <url>https://www.apache.org/licenses/LICENSE-2.0.html</url> + <distribution>repo</distribution> + </license> + </licenses> + + <developers> + <developer> + <name>OpenAPI-Generator Contributors</name> + <email>team@openapitools.org</email> + <organization>OpenAPITools.org</organization> + <organizationUrl>http://openapitools.org</organizationUrl> + </developer> + </developers> + + <build> + <plugins> + <plugin> + <artifactId>maven-enforcer-plugin</artifactId> + <version>3.0.0-M1</version> + <executions> + <execution> + <id>enforce-maven</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireMavenVersion> + <version>3</version> + </requireMavenVersion> + <requireJavaVersion> + <version>11</version> + </requireJavaVersion> + </rules> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M3</version> + <configuration> + <systemPropertyVariables> + <loggerPath>conf/log4j.properties</loggerPath> + </systemPropertyVariables> + <argLine>-Xms512m -Xmx1500m</argLine> + <parallel>methods</parallel> + <threadCount>10</threadCount> + </configuration> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>3.1.1</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <!-- attach test jar --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>3.1.2</version> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + <configuration> + </configuration> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>sign-artifacts</id> + <build> + <plugins> + <plugin> + <artifactId>maven-gpg-plugin</artifactId> + <version>1.6</version> + <executions> + <execution> + <id>sign-artifacts</id> + <phase>verify</phase> + <goals> + <goal>sign</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-annotations</artifactId> + <version>${swagger-annotations-version}</version> + </dependency> + + <!-- JSON processing: jackson --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>${jackson-version}</version> + </dependency> + <dependency> + <groupId>org.openapitools</groupId> + <artifactId>jackson-databind-nullable</artifactId> + <version>${jackson-databind-nullable-version}</version> + </dependency> + + <!-- @Nullable annotation --> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>3.0.2</version> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit-version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <swagger-annotations-version>1.5.22</swagger-annotations-version> + <maven.compiler.source>11</maven.compiler.source> + <maven.compiler.target>11</maven.compiler.target> + <jackson-version>2.9.9</jackson-version> + <jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version> + <junit-version>4.13</junit-version> + </properties> +</project> diff --git a/samples/client/petstore/java/native-async/settings.gradle b/samples/client/petstore/java/native-async/settings.gradle new file mode 100644 index 000000000000..b8b464b291ba --- /dev/null +++ b/samples/client/petstore/java/native-async/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-native" \ No newline at end of file diff --git a/samples/client/petstore/java/native-async/src/main/AndroidManifest.xml b/samples/client/petstore/java/native-async/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..54fbcb3da1e8 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ +<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android"> + <application /> +</manifest> diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 000000000000..b805d0f4b425 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,358 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.openapitools.jackson.nullable.JsonNullableModule; + +import java.io.InputStream; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.Charset; +import java.time.Duration; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +/** + * Configuration and utility class for API clients. + * + * <p>This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.</p> + * + * <p>This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.</p> + * + * <p>The setter methods of this class return the current object to facilitate + * a fluent style of configuration.</p> + */ + +public class ApiClient { + + private static final Charset UTF_8 = Charset.forName("UTF-8"); + + private HttpClient.Builder builder; + private ObjectMapper mapper; + private String scheme; + private String host; + private int port; + private String basePath; + private Consumer<HttpRequest.Builder> interceptor; + private Consumer<HttpResponse<InputStream>> responseInterceptor; + private Duration readTimeout; + + private static String valueToString(Object value) { + if (value == null) { + return ""; + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + * <p>The value can be null, in which case an empty list is returned.</p> + * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List<Pair> parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(value.toString()))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List<Pair> parameterToPairs( + String collectionFormat, String name, Collection<?> values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch(format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + /** + * Ctor. + */ + public ApiClient() { + builder = HttpClient.newBuilder(); + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.registerModule(new JavaTimeModule()); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + URI baseURI = URI.create("http://petstore.swagger.io:80/v2"); + scheme = baseURI.getScheme(); + host = baseURI.getHost(); + port = baseURI.getPort(); + basePath = baseURI.getRawPath(); + interceptor = null; + readTimeout = null; + responseInterceptor = null; + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + * <p>The returned object is immutable and thread-safe.</p> + * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom host name for the target service. + * + * @param host The host name of the target service. + * @return This object. + */ + public ApiClient setHost(String host) { + this.host = host; + return this; + } + + /** + * Set a custom port number for the target service. + * + * @param port The port of the target service. Set this to -1 to reset the + * value to the default for the scheme. + * @return This object. + */ + public ApiClient setPort(int port) { + this.port = port; + return this; + } + + /** + * Set a custom base path for the target service, for example '/v2'. + * + * @param basePath The base path against which the rest of the path is + * resolved. + * @return This object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get the base URI to resolve the endpoint paths against. + * + * @return The complete base URI that the rest of the API parameters are + * resolved against. + */ + public String getBaseUri() { + return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; + } + + /** + * Set a custom scheme for the target service, for example 'https'. + * + * @param scheme The scheme of the target service + * @return This object. + */ + public ApiClient setScheme(String scheme){ + this.scheme = scheme; + return this; + } + + /** + * Set a custom request interceptor. + * + * <p>A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.</p> + * + * <p>This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.</p> + * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer<HttpRequest.Builder> interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer<HttpRequest.Builder> getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + * <p>This is useful for logging, monitoring or extraction of header variables</p> + * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer<HttpResponse<InputStream>> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer<HttpResponse<InputStream>> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set the read timeout for the http client. + * + * <p>This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.</p> + * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public ApiClient setReadTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + public Duration getReadTimeout() { + return readTimeout; + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiException.java new file mode 100644 index 000000000000..f5427482e3a7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ApiException.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + +import java.net.http.HttpHeaders; + + +public class ApiException extends Exception { + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Configuration.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Configuration.java new file mode 100644 index 000000000000..acbecda489dd --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Configuration.java @@ -0,0 +1,39 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 000000000000..ae89aa614543 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client; + + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerConfiguration.java new file mode 100644 index 000000000000..a1107a8690e4 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package org.openapitools.client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map<String, ServerVariable> variables; + + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map<String, String> variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerVariable.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerVariable.java new file mode 100644 index 000000000000..c2f13e216662 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/ServerVariable.java @@ -0,0 +1,23 @@ +package org.openapitools.client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet<String> enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 000000000000..3fc1152250c2 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Client; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.function.Consumer; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.CompletableFuture; + + +public class AnotherFakeApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer<HttpRequest.Builder> memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor; + + public AnotherFakeApi() { + this(new ApiClient()); + } + + public AnotherFakeApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Client> call123testSpecialTags (Client body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/another-fake/dummy"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "call123testSpecialTags call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 000000000000..6c2fc4767796 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,844 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.openapitools.client.model.XmlItem; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.function.Consumer; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.CompletableFuture; + + +public class FakeApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer<HttpRequest.Builder> memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor; + + public FakeApi() { + this(new ApiClient()); + } + + public FakeApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * creates an XmlItem + * this route creates an XmlItem + * @param xmlItem XmlItem Body (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> createXmlItem (XmlItem xmlItem) throws ApiException { + // verify the required parameter 'xmlItem' is set + if (xmlItem == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/create_xml_item"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(xmlItem); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "createXmlItem call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Boolean> fakeOuterBooleanSerialize (Boolean body) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/outer/boolean"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "fakeOuterBooleanSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + */ + public CompletableFuture<OuterComposite> fakeOuterCompositeSerialize (OuterComposite body) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/outer/composite"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "fakeOuterCompositeSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + */ + public CompletableFuture<BigDecimal> fakeOuterNumberSerialize (BigDecimal body) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/outer/number"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "fakeOuterNumberSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + */ + public CompletableFuture<String> fakeOuterStringSerialize (String body) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/outer/string"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "fakeOuterStringSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param body (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testBodyWithFileSchema (FileSchemaTestClass body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/body-with-file-schema"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testBodyWithFileSchema call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * + * + * @param query (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testBodyWithQueryParams (String query, User body) throws ApiException { + // verify the required parameter 'query' is set + if (query == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams")); + } + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/body-with-query-params"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testBodyWithQueryParams call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * To test \"client\" model + * To test \"client\" model + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Client> testClientModel (Client body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling testClientModel")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testClientModel call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None (required) + * @param _double None (required) + * @param patternWithoutDelimiter None (required) + * @param _byte None (required) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testEndpointParameters (BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + // verify the required parameter 'number' is set + if (number == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters")); + } + // verify the required parameter '_double' is set + if (_double == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters")); + } + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters")); + } + // verify the required parameter '_byte' is set + if (_byte == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testEndpointParameters call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testEnumParameters (List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_string", enumQueryString)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_integer", enumQueryInteger)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("enum_query_double", enumQueryDouble)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + if (enumHeaderStringArray != null) { + localVarRequestBuilder.header("enum_header_string_array", enumHeaderStringArray.toString()); + } + if (enumHeaderString != null) { + localVarRequestBuilder.header("enum_header_string", enumHeaderString.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testEnumParameters call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters (required) + * @param requiredBooleanGroup Required Boolean in group parameters (required) + * @param requiredInt64Group Required Integer in group parameters (required) + * @param stringGroup String in group parameters (optional) + * @param booleanGroup Boolean in group parameters (optional) + * @param int64Group Integer in group parameters (optional) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testGroupParameters (Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + // verify the required parameter 'requiredStringGroup' is set + if (requiredStringGroup == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters")); + } + // verify the required parameter 'requiredBooleanGroup' is set + if (requiredBooleanGroup == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters")); + } + // verify the required parameter 'requiredInt64Group' is set + if (requiredInt64Group == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("required_string_group", requiredStringGroup)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("required_int64_group", requiredInt64Group)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("string_group", stringGroup)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("int64_group", int64Group)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + if (requiredBooleanGroup != null) { + localVarRequestBuilder.header("required_boolean_group", requiredBooleanGroup.toString()); + } + if (booleanGroup != null) { + localVarRequestBuilder.header("boolean_group", booleanGroup.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testGroupParameters call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * test inline additionalProperties + * + * @param param request body (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testInlineAdditionalProperties (Map<String, String> param) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/inline-additionalProperties"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(param); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testInlineAdditionalProperties call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testJsonFormData (String param, String param2) throws ApiException { + // verify the required parameter 'param' is set + if (param == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData")); + } + // verify the required parameter 'param2' is set + if (param2 == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/jsonFormData"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testJsonFormData call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * + * To test the collection format in query parameters + * @param pipe (required) + * @param ioutil (required) + * @param http (required) + * @param url (required) + * @param context (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> testQueryParameterCollectionFormat (List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { + // verify the required parameter 'pipe' is set + if (pipe == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat")); + } + // verify the required parameter 'ioutil' is set + if (ioutil == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat")); + } + // verify the required parameter 'http' is set + if (http == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat")); + } + // verify the required parameter 'url' is set + if (url == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat")); + } + // verify the required parameter 'context' is set + if (context == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/test-query-paramters"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "pipe", pipe)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "ioutil", ioutil)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("space", "http", http)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "url", url)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "context", context)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testQueryParameterCollectionFormat call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 000000000000..8e69ccdbff5b --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,112 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Client; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.function.Consumer; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.CompletableFuture; + + +public class FakeClassnameTags123Api { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer<HttpRequest.Builder> memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor; + + public FakeClassnameTags123Api() { + this(new ApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Client> testClassname (Client body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling testClassname")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake_classname_test"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PATCH", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "testClassname call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 000000000000..6315984a9f2e --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,507 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.function.Consumer; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.CompletableFuture; + + +public class PetApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer<HttpRequest.Builder> memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor; + + public PetApi() { + this(new ApiClient()); + } + + public PetApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * Add a new pet to the store + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> addPet (Pet body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling addPet")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "addPet call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> deletePet (Long petId, String apiKey) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'petId' when calling deletePet")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + if (apiKey != null) { + localVarRequestBuilder.header("api_key", apiKey.toString()); + } + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "deletePet call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * 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 (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + */ + public CompletableFuture<List<Pet>> findPetsByStatus (List<String> status) throws ApiException { + // verify the required parameter 'status' is set + if (status == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByStatus"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "status", status)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "findPetsByStatus call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + * @throws ApiException if fails to make API call + * @deprecated + */ + @Deprecated + public CompletableFuture<List<Pet>> findPetsByTags (List<String> tags) throws ApiException { + // verify the required parameter 'tags' is set + if (tags == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/findByTags"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("csv", "tags", tags)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "findPetsByTags call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Pet> getPetById (Long petId) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'petId' when calling getPetById")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "getPetById call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Update an existing pet + * + * @param body Pet object that needs to be added to the store (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> updatePet (Pet body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling updatePet")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "updatePet call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * Updates a pet in the store with form data + * + * @param petId ID of pet that needs to be updated (required) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> updatePetWithForm (Long petId, String name, String status) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "updatePetWithForm call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public CompletableFuture<ModelApiResponse> uploadFile (Long petId, String additionalMetadata, File file) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/pet/{petId}/uploadImage" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "uploadFile call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * uploads an image (required) + * + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @return ModelApiResponse + * @throws ApiException if fails to make API call + */ + public CompletableFuture<ModelApiResponse> uploadFileWithRequiredFile (Long petId, File requiredFile, String additionalMetadata) throws ApiException { + // verify the required parameter 'petId' is set + if (petId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile")); + } + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/{petId}/uploadImageWithRequiredFile" + .replace("{petId}", ApiClient.urlEncode(petId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "uploadFileWithRequiredFile call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 000000000000..16712948a944 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,240 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.Order; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.function.Consumer; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.CompletableFuture; + + +public class StoreApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer<HttpRequest.Builder> memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor; + + public StoreApi() { + this(new ApiClient()); + } + + public StoreApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * 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 (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> deleteOrder (String orderId) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{order_id}" + .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "deleteOrder call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Map<String, Integer>> getInventory () throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/inventory"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "getInventory call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * 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 (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Order> getOrderById (Long orderId) throws ApiException { + // verify the required parameter 'orderId' is set + if (orderId == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order/{order_id}" + .replace("{order_id}", ApiClient.urlEncode(orderId.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "getOrderById call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Place an order for a pet + * + * @param body order placed for purchasing the pet (required) + * @return Order + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Order> placeOrder (Order body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling placeOrder")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/store/order"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "placeOrder call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 000000000000..733f104d15bd --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,450 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Pair; + +import org.openapitools.client.model.User; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.function.Consumer; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.CompletableFuture; + + +public class UserApi { + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer<HttpRequest.Builder> memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor; + + public UserApi() { + this(new ApiClient()); + } + + public UserApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + } + + /** + * Create user + * This can only be done by the logged in user. + * @param body Created user object (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> createUser (User body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling createUser")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "createUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> createUsersWithArrayInput (List<User> body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithArray"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "createUsersWithArrayInput call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * Creates list of users with given input array + * + * @param body List of user object (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> createUsersWithListInput (List<User> body) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/createWithList"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "createUsersWithListInput call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> deleteUser (String username) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'username' when calling deleteUser")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "deleteUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + * @throws ApiException if fails to make API call + */ + public CompletableFuture<User> getUserByName (String username) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'username' when calling getUserByName")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "getUserByName call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + * @throws ApiException if fails to make API call + */ + public CompletableFuture<String> loginUser (String username, String password) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'username' when calling loginUser")); + } + // verify the required parameter 'password' is set + if (password == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'password' when calling loginUser")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/login"; + + List<Pair> localVarQueryParams = new ArrayList<>(); + localVarQueryParams.addAll(ApiClient.parameterToPairs("username", username)); + localVarQueryParams.addAll(ApiClient.parameterToPairs("password", password)); + + if (!localVarQueryParams.isEmpty()) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "loginUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Logs out current logged in user session + * + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> logoutUser () throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/logout"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "logoutUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param body Updated user object (required) + * @throws ApiException if fails to make API call + */ + public CompletableFuture<Void> updateUser (String username, User body) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'username' when calling updateUser")); + } + // verify the required parameter 'body' is set + if (body == null) { + return CompletableFuture.failedFuture(new ApiException(400, "Missing the required parameter 'body' when calling updateUser")); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/user/{username}" + .replace("{username}", ApiClient.urlEncode(username.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(body); + localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(new ApiException(localVarResponse.statusCode(), + "updateUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body()) + ); + } else { + return CompletableFuture.completedFuture( + null + ); + } + }); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } +} diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java new file mode 100644 index 000000000000..0f1223c2bc61 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesAnyType + */ +@JsonPropertyOrder({ + AdditionalPropertiesAnyType.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesAnyType extends HashMap<String, Object> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesAnyType name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; + return Objects.equals(this.name, additionalPropertiesAnyType.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesAnyType {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java new file mode 100644 index 000000000000..c03535ab9471 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesArray + */ +@JsonPropertyOrder({ + AdditionalPropertiesArray.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesArray extends HashMap<String, List> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesArray name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; + return Objects.equals(this.name, additionalPropertiesArray.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesArray {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java new file mode 100644 index 000000000000..4356a4f8c1eb --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesBoolean + */ +@JsonPropertyOrder({ + AdditionalPropertiesBoolean.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesBoolean name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; + return Objects.equals(this.name, additionalPropertiesBoolean.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesBoolean {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 000000000000..fa85ab77596a --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,480 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, + AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 +}) + +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_STRING = "map_string"; + private Map<String, String> mapString = null; + + public static final String JSON_PROPERTY_MAP_NUMBER = "map_number"; + private Map<String, BigDecimal> mapNumber = null; + + public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer"; + private Map<String, Integer> mapInteger = null; + + public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean"; + private Map<String, Boolean> mapBoolean = null; + + public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer"; + private Map<String, List<Integer>> mapArrayInteger = null; + + public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype"; + private Map<String, List<Object>> mapArrayAnytype = null; + + public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string"; + private Map<String, Map<String, String>> mapMapString = null; + + public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype"; + private Map<String, Map<String, Object>> mapMapAnytype = null; + + public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; + private Object anytype1; + + public static final String JSON_PROPERTY_ANYTYPE2 = "anytype_2"; + private Object anytype2; + + public static final String JSON_PROPERTY_ANYTYPE3 = "anytype_3"; + private Object anytype3; + + + public AdditionalPropertiesClass mapString(Map<String, String> mapString) { + + this.mapString = mapString; + return this; + } + + public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { + if (this.mapString == null) { + this.mapString = new HashMap<>(); + } + this.mapString.put(key, mapStringItem); + return this; + } + + /** + * Get mapString + * @return mapString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, String> getMapString() { + return mapString; + } + + + public void setMapString(Map<String, String> mapString) { + this.mapString = mapString; + } + + + public AdditionalPropertiesClass mapNumber(Map<String, BigDecimal> mapNumber) { + + this.mapNumber = mapNumber; + return this; + } + + public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { + if (this.mapNumber == null) { + this.mapNumber = new HashMap<>(); + } + this.mapNumber.put(key, mapNumberItem); + return this; + } + + /** + * Get mapNumber + * @return mapNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, BigDecimal> getMapNumber() { + return mapNumber; + } + + + public void setMapNumber(Map<String, BigDecimal> mapNumber) { + this.mapNumber = mapNumber; + } + + + public AdditionalPropertiesClass mapInteger(Map<String, Integer> mapInteger) { + + this.mapInteger = mapInteger; + return this; + } + + public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { + if (this.mapInteger == null) { + this.mapInteger = new HashMap<>(); + } + this.mapInteger.put(key, mapIntegerItem); + return this; + } + + /** + * Get mapInteger + * @return mapInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Integer> getMapInteger() { + return mapInteger; + } + + + public void setMapInteger(Map<String, Integer> mapInteger) { + this.mapInteger = mapInteger; + } + + + public AdditionalPropertiesClass mapBoolean(Map<String, Boolean> mapBoolean) { + + this.mapBoolean = mapBoolean; + return this; + } + + public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { + if (this.mapBoolean == null) { + this.mapBoolean = new HashMap<>(); + } + this.mapBoolean.put(key, mapBooleanItem); + return this; + } + + /** + * Get mapBoolean + * @return mapBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Boolean> getMapBoolean() { + return mapBoolean; + } + + + public void setMapBoolean(Map<String, Boolean> mapBoolean) { + this.mapBoolean = mapBoolean; + } + + + public AdditionalPropertiesClass mapArrayInteger(Map<String, List<Integer>> mapArrayInteger) { + + this.mapArrayInteger = mapArrayInteger; + return this; + } + + public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List<Integer> mapArrayIntegerItem) { + if (this.mapArrayInteger == null) { + this.mapArrayInteger = new HashMap<>(); + } + this.mapArrayInteger.put(key, mapArrayIntegerItem); + return this; + } + + /** + * Get mapArrayInteger + * @return mapArrayInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, List<Integer>> getMapArrayInteger() { + return mapArrayInteger; + } + + + public void setMapArrayInteger(Map<String, List<Integer>> mapArrayInteger) { + this.mapArrayInteger = mapArrayInteger; + } + + + public AdditionalPropertiesClass mapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) { + + this.mapArrayAnytype = mapArrayAnytype; + return this; + } + + public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List<Object> mapArrayAnytypeItem) { + if (this.mapArrayAnytype == null) { + this.mapArrayAnytype = new HashMap<>(); + } + this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + return this; + } + + /** + * Get mapArrayAnytype + * @return mapArrayAnytype + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, List<Object>> getMapArrayAnytype() { + return mapArrayAnytype; + } + + + public void setMapArrayAnytype(Map<String, List<Object>> mapArrayAnytype) { + this.mapArrayAnytype = mapArrayAnytype; + } + + + public AdditionalPropertiesClass mapMapString(Map<String, Map<String, String>> mapMapString) { + + this.mapMapString = mapMapString; + return this; + } + + public AdditionalPropertiesClass putMapMapStringItem(String key, Map<String, String> mapMapStringItem) { + if (this.mapMapString == null) { + this.mapMapString = new HashMap<>(); + } + this.mapMapString.put(key, mapMapStringItem); + return this; + } + + /** + * Get mapMapString + * @return mapMapString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Map<String, String>> getMapMapString() { + return mapMapString; + } + + + public void setMapMapString(Map<String, Map<String, String>> mapMapString) { + this.mapMapString = mapMapString; + } + + + public AdditionalPropertiesClass mapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) { + + this.mapMapAnytype = mapMapAnytype; + return this; + } + + public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map<String, Object> mapMapAnytypeItem) { + if (this.mapMapAnytype == null) { + this.mapMapAnytype = new HashMap<>(); + } + this.mapMapAnytype.put(key, mapMapAnytypeItem); + return this; + } + + /** + * Get mapMapAnytype + * @return mapMapAnytype + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Map<String, Object>> getMapMapAnytype() { + return mapMapAnytype; + } + + + public void setMapMapAnytype(Map<String, Map<String, Object>> mapMapAnytype) { + this.mapMapAnytype = mapMapAnytype; + } + + + public AdditionalPropertiesClass anytype1(Object anytype1) { + + this.anytype1 = anytype1; + return this; + } + + /** + * Get anytype1 + * @return anytype1 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype1() { + return anytype1; + } + + + public void setAnytype1(Object anytype1) { + this.anytype1 = anytype1; + } + + + public AdditionalPropertiesClass anytype2(Object anytype2) { + + this.anytype2 = anytype2; + return this; + } + + /** + * Get anytype2 + * @return anytype2 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE2) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype2() { + return anytype2; + } + + + public void setAnytype2(Object anytype2) { + this.anytype2 = anytype2; + } + + + public AdditionalPropertiesClass anytype3(Object anytype3) { + + this.anytype3 = anytype3; + return this; + } + + /** + * Get anytype3 + * @return anytype3 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ANYTYPE3) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getAnytype3() { + return anytype3; + } + + + public void setAnytype3(Object anytype3) { + this.anytype3 = anytype3; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && + Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && + Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && + Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && + Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && + Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && + Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && + Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && + Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && + Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && + Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + } + + @Override + public int hashCode() { + return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); + sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); + sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); + sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); + sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); + sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); + sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); + sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); + sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); + sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); + sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java new file mode 100644 index 000000000000..2426e7c974c4 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesInteger + */ +@JsonPropertyOrder({ + AdditionalPropertiesInteger.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesInteger extends HashMap<String, Integer> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesInteger name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; + return Objects.equals(this.name, additionalPropertiesInteger.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesInteger {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java new file mode 100644 index 000000000000..da407ccdc473 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesNumber + */ +@JsonPropertyOrder({ + AdditionalPropertiesNumber.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesNumber name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; + return Objects.equals(this.name, additionalPropertiesNumber.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesNumber {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java new file mode 100644 index 000000000000..5e468870311e --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesObject + */ +@JsonPropertyOrder({ + AdditionalPropertiesObject.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesObject extends HashMap<String, Map> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesObject name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; + return Objects.equals(this.name, additionalPropertiesObject.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesObject {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java new file mode 100644 index 000000000000..ed080254966e --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AdditionalPropertiesString + */ +@JsonPropertyOrder({ + AdditionalPropertiesString.JSON_PROPERTY_NAME +}) + +public class AdditionalPropertiesString extends HashMap<String, String> { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public AdditionalPropertiesString name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; + return Objects.equals(this.name, additionalPropertiesString.name) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(name, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesString {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 000000000000..bbadf265ba6b --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,141 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), +}) + +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + protected String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + private String color = "red"; + + + public Animal className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + public Animal color(String color) { + + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getColor() { + return color; + } + + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 000000000000..28d19953c345 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) + +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + private List<List<BigDecimal>> arrayArrayNumber = null; + + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { + + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<List<BigDecimal>> getArrayArrayNumber() { + return arrayArrayNumber; + } + + + public void setArrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 000000000000..5eeac9d8ac5d --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) + +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + private List<BigDecimal> arrayNumber = null; + + + public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) { + + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<BigDecimal> getArrayNumber() { + return arrayNumber; + } + + + public void setArrayNumber(List<BigDecimal> arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 000000000000..df57098053eb --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,191 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) + +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + private List<String> arrayOfString = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + private List<List<Long>> arrayArrayOfInteger = null; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + private List<List<ReadOnlyFirst>> arrayArrayOfModel = null; + + + public ArrayTest arrayOfString(List<String> arrayOfString) { + + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<String> getArrayOfString() { + return arrayOfString; + } + + + public void setArrayOfString(List<String> arrayOfString) { + this.arrayOfString = arrayOfString; + } + + + public ArrayTest arrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { + + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<List<Long>> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + + public void setArrayArrayOfInteger(List<List<Long>> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + + public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { + + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<List<ReadOnlyFirst>> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + + public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 000000000000..84b3f05703b2 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 000000000000..7ce0ddb21f5a --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 000000000000..033e97881105 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,257 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Capitalization + */ +@JsonPropertyOrder({ + Capitalization.JSON_PROPERTY_SMALL_CAMEL, + Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, + Capitalization.JSON_PROPERTY_SMALL_SNAKE, + Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, + Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, + Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E +}) + +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + private String ATT_NAME; + + + public Capitalization smallCamel(String smallCamel) { + + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallCamel() { + return smallCamel; + } + + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + + public Capitalization capitalCamel(String capitalCamel) { + + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalCamel() { + return capitalCamel; + } + + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + + public Capitalization smallSnake(String smallSnake) { + + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSmallSnake() { + return smallSnake; + } + + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + + public Capitalization capitalSnake(String capitalSnake) { + + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCapitalSnake() { + return capitalSnake; + } + + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + + public Capitalization ATT_NAME(String ATT_NAME) { + + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Name of the pet ") + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getATTNAME() { + return ATT_NAME; + } + + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 000000000000..484725c76fe0 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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.CatAllOf; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) + +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + + public Cat declawed(Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/CatAllOf.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/CatAllOf.java new file mode 100644 index 000000000000..3e7b991436aa --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/CatAllOf.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * CatAllOf + */ +@JsonPropertyOrder({ + CatAllOf.JSON_PROPERTY_DECLAWED +}) + +public class CatAllOf { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + private Boolean declawed; + + + public CatAllOf declawed(Boolean declawed) { + + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DECLAWED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeclawed() { + return declawed; + } + + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CatAllOf catAllOf = (CatAllOf) o; + return Objects.equals(this.declawed, catAllOf.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(declawed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CatAllOf {\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 000000000000..868ba8750742 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,132 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) + +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name = "default-name"; + + + public Category id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Category name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 000000000000..4de7664b26a7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) + +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + private String propertyClass; + + + public ClassModel propertyClass(String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 000000000000..02b0aac2247a --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) + +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + private String client; + + + public Client client(String client) { + + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClient() { + return client; + } + + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 000000000000..78044654d500 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,106 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) + +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + + public Dog breed(String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/DogAllOf.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/DogAllOf.java new file mode 100644 index 000000000000..dd42595cf202 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/DogAllOf.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * DogAllOf + */ +@JsonPropertyOrder({ + DogAllOf.JSON_PROPERTY_BREED +}) + +public class DogAllOf { + public static final String JSON_PROPERTY_BREED = "breed"; + private String breed; + + + public DogAllOf breed(String breed) { + + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BREED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DogAllOf dogAllOf = (DogAllOf) o; + return Objects.equals(this.breed, dogAllOf.breed); + } + + @Override + public int hashCode() { + return Objects.hash(breed); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DogAllOf {\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 000000000000..86526adb3fa7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,213 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + private List<ArrayEnumEnum> arrayEnum = null; + + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + + public EnumArrays arrayEnum(List<ArrayEnumEnum> arrayEnum) { + + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<ArrayEnumEnum> getArrayEnum() { + return arrayEnum; + } + + + public void setArrayEnum(List<ArrayEnumEnum> arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 000000000000..e9102d974276 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 000000000000..51a1a645a109 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,370 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EnumTest + */ +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM +}) + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + private OuterEnum outerEnum; + + + public EnumTest enumString(EnumStringEnum enumString) { + + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumStringEnum getEnumString() { + return enumString; + } + + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + public EnumTest outerEnum(OuterEnum outerEnum) { + + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 000000000000..cfd62fbce628 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,143 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) + +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + private java.io.File file; + + public static final String JSON_PROPERTY_FILES = "files"; + private List<java.io.File> files = null; + + + public FileSchemaTestClass file(java.io.File file) { + + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public java.io.File getFile() { + return file; + } + + + public void setFile(java.io.File file) { + this.file = file; + } + + + public FileSchemaTestClass files(List<java.io.File> files) { + + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FILES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<java.io.File> getFiles() { + return files; + } + + + public void setFiles(List<java.io.File> files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 000000000000..72ed8740e4d7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,516 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FormatTest + */ +@JsonPropertyOrder({ + FormatTest.JSON_PROPERTY_INTEGER, + FormatTest.JSON_PROPERTY_INT32, + FormatTest.JSON_PROPERTY_INT64, + FormatTest.JSON_PROPERTY_NUMBER, + FormatTest.JSON_PROPERTY_FLOAT, + FormatTest.JSON_PROPERTY_DOUBLE, + FormatTest.JSON_PROPERTY_STRING, + FormatTest.JSON_PROPERTY_BYTE, + FormatTest.JSON_PROPERTY_BINARY, + FormatTest.JSON_PROPERTY_DATE, + FormatTest.JSON_PROPERTY_DATE_TIME, + FormatTest.JSON_PROPERTY_UUID, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_BIG_DECIMAL +}) + +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_BIG_DECIMAL = "BigDecimal"; + private BigDecimal bigDecimal; + + + public FormatTest integer(Integer integer) { + + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public FormatTest int32(Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public FormatTest int64(Long int64) { + + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public FormatTest number(BigDecimal number) { + + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public FormatTest _float(Float _float) { + + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + public void setFloat(Float _float) { + this._float = _float; + } + + + public FormatTest _double(Double _double) { + + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Double getDouble() { + return _double; + } + + + public void setDouble(Double _double) { + this._double = _double; + } + + + public FormatTest string(String string) { + + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + public void setString(String string) { + this.string = string; + } + + + public FormatTest _byte(byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public FormatTest binary(File binary) { + + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + public void setBinary(File binary) { + this.binary = binary; + } + + + public FormatTest date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public FormatTest dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public FormatTest uuid(UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public FormatTest password(String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public FormatTest bigDecimal(BigDecimal bigDecimal) { + + this.bigDecimal = bigDecimal; + return this; + } + + /** + * Get bigDecimal + * @return bigDecimal + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getBigDecimal() { + return bigDecimal; + } + + + public void setBigDecimal(BigDecimal bigDecimal) { + this.bigDecimal = bigDecimal; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password) && + Objects.equals(this.bigDecimal, formatTest.bigDecimal); + } + + @Override + public int hashCode() { + 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(); + sb.append("class FormatTest {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 000000000000..0a3f0d464360 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,115 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) + +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + private String foo; + + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + /** + * Get foo + * @return foo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FOO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFoo() { + return foo; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 000000000000..3e72350aa8b1 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,265 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MapTest + */ +@JsonPropertyOrder({ + MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, + MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, + MapTest.JSON_PROPERTY_DIRECT_MAP, + MapTest.JSON_PROPERTY_INDIRECT_MAP +}) + +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + private Map<String, Map<String, String>> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + private Map<String, InnerEnum> mapOfEnumString = null; + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + private Map<String, Boolean> directMap = null; + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + private Map<String, Boolean> indirectMap = null; + + + public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) { + + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Map<String, String>> getMapMapOfString() { + return mapMapOfString; + } + + + public void setMapMapOfString(Map<String, Map<String, String>> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + + public MapTest mapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { + + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, InnerEnum> getMapOfEnumString() { + return mapOfEnumString; + } + + + public void setMapOfEnumString(Map<String, InnerEnum> mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + public MapTest directMap(Map<String, Boolean> directMap) { + + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Boolean> getDirectMap() { + return directMap; + } + + + public void setDirectMap(Map<String, Boolean> directMap) { + this.directMap = directMap; + } + + + public MapTest indirectMap(Map<String, Boolean> indirectMap) { + + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Boolean> getIndirectMap() { + return indirectMap; + } + + + public void setIndirectMap(Map<String, Boolean> indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 000000000000..07d314691a97 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,178 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) + +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + private Map<String, Animal> map = null; + + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UUID getUuid() { + return uuid; + } + + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public MixedPropertiesAndAdditionalPropertiesClass map(Map<String, Animal> map) { + + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map<String, Animal> getMap() { + return map; + } + + + public void setMap(Map<String, Animal> map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 000000000000..dd99468a0059 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,134 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) + +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + private String propertyClass; + + + public Model200Response name(Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getName() { + return name; + } + + + public void setName(Integer name) { + this.name = name; + } + + + public Model200Response propertyClass(String propertyClass) { + + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPropertyClass() { + return propertyClass; + } + + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 000000000000..383cafdd3a5a --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) + +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + + public ModelApiResponse code(Integer code) { + + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getCode() { + return code; + } + + + public void setCode(Integer code) { + this.code = code; + } + + + public ModelApiResponse type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ModelApiResponse message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 000000000000..b62e13a90a0c --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) + +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + private Integer _return; + + + public ModelReturn _return(Integer _return) { + + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RETURN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getReturn() { + return _return; + } + + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 000000000000..bd625c5f66f3 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) + +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + private Integer _123number; + + + public Name name(Integer name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getName() { + return name; + } + + + public void setName(Integer name) { + this.name = name; + } + + + /** + * Get snakeCase + * @return snakeCase + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSnakeCase() { + return snakeCase; + } + + + + + public Name property(String property) { + + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROPERTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getProperty() { + return property; + } + + + public void setProperty(String property) { + this.property = property; + } + + + /** + * Get _123number + * @return _123number + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_123NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer get123number() { + return _123number; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 000000000000..5ca72a169fe8 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,103 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) + +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + private BigDecimal justNumber; + + + public NumberOnly justNumber(BigDecimal justNumber) { + + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getJustNumber() { + return justNumber; + } + + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 000000000000..ba4e395e94e9 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,295 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Order + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) + +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + private Boolean complete = false; + + + public Order id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Order petId(Long petId) { + + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PET_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getPetId() { + return petId; + } + + + public void setPetId(Long petId) { + this.petId = petId; + } + + + public Order quantity(Integer quantity) { + + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_QUANTITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getQuantity() { + return quantity; + } + + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + + public Order shipDate(OffsetDateTime shipDate) { + + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getShipDate() { + return shipDate; + } + + + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + + public Order status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Order Status") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public Order complete(Boolean complete) { + + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COMPLETE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getComplete() { + return complete; + } + + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 000000000000..d4d9ac6ba110 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,165 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) + +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + private Boolean myBoolean; + + + public OuterComposite myNumber(BigDecimal myNumber) { + + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMyNumber() { + return myNumber; + } + + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + + public OuterComposite myString(String myString) { + + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMyString() { + return myString; + } + + + public void setMyString(String myString) { + this.myString = myString; + } + + + public OuterComposite myBoolean(Boolean myBoolean) { + + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMyBoolean() { + return myBoolean; + } + + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 000000000000..308646a320c7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 000000000000..2df466732f74 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,309 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Category; +import org.openapitools.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Pet + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) + +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + private List<String> photoUrls = new ArrayList<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List<Tag> tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + + public Pet id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Pet category(Category category) { + + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Category getCategory() { + return category; + } + + + public void setCategory(Category category) { + this.category = category; + } + + + public Pet name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Pet photoUrls(List<String> photoUrls) { + + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List<String> getPhotoUrls() { + return photoUrls; + } + + + public void setPhotoUrls(List<String> photoUrls) { + this.photoUrls = photoUrls; + } + + + public Pet tags(List<Tag> tags) { + + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Tag> getTags() { + return tags; + } + + + public void setTags(List<Tag> tags) { + this.tags = tags; + } + + + public Pet status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "pet status in the store") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 000000000000..b3e58ef3d2c5 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) + +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + private String baz; + + + /** + * Get bar + * @return bar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBar() { + return bar; + } + + + + + public ReadOnlyFirst baz(String baz) { + + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_BAZ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBaz() { + return baz; + } + + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 000000000000..35ad3bf46994 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) + +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + private Long $specialPropertyName; + + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName $specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 000000000000..a3ecb398faa3 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) + +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public Tag id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public Tag name(String name) { + + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderDefault.java new file mode 100644 index 000000000000..f79d7b6383a7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -0,0 +1,229 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TypeHolderDefault + */ +@JsonPropertyOrder({ + TypeHolderDefault.JSON_PROPERTY_STRING_ITEM, + TypeHolderDefault.JSON_PROPERTY_NUMBER_ITEM, + TypeHolderDefault.JSON_PROPERTY_INTEGER_ITEM, + TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, + TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM +}) + +public class TypeHolderDefault { + public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + private String stringItem = "what"; + + public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + private BigDecimal numberItem; + + public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + private Integer integerItem; + + public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + private Boolean boolItem = true; + + public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + private List<Integer> arrayItem = new ArrayList<>(); + + + public TypeHolderDefault stringItem(String stringItem) { + + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStringItem() { + return stringItem; + } + + + public void setStringItem(String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderDefault numberItem(BigDecimal numberItem) { + + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumberItem() { + return numberItem; + } + + + public void setNumberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderDefault integerItem(Integer integerItem) { + + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getIntegerItem() { + return integerItem; + } + + + public void setIntegerItem(Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderDefault boolItem(Boolean boolItem) { + + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getBoolItem() { + return boolItem; + } + + + public void setBoolItem(Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderDefault arrayItem(List<Integer> arrayItem) { + + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List<Integer> getArrayItem() { + return arrayItem; + } + + + public void setArrayItem(List<Integer> arrayItem) { + this.arrayItem = arrayItem; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; + return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && + Objects.equals(this.numberItem, typeHolderDefault.numberItem) && + Objects.equals(this.integerItem, typeHolderDefault.integerItem) && + Objects.equals(this.boolItem, typeHolderDefault.boolItem) && + Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderDefault {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderExample.java new file mode 100644 index 000000000000..f15b107fd18b --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -0,0 +1,259 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TypeHolderExample + */ +@JsonPropertyOrder({ + TypeHolderExample.JSON_PROPERTY_STRING_ITEM, + TypeHolderExample.JSON_PROPERTY_NUMBER_ITEM, + TypeHolderExample.JSON_PROPERTY_FLOAT_ITEM, + TypeHolderExample.JSON_PROPERTY_INTEGER_ITEM, + TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, + TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM +}) + +public class TypeHolderExample { + public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; + private String stringItem; + + public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; + private BigDecimal numberItem; + + public static final String JSON_PROPERTY_FLOAT_ITEM = "float_item"; + private Float floatItem; + + public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; + private Integer integerItem; + + public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; + private Boolean boolItem; + + public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; + private List<Integer> arrayItem = new ArrayList<>(); + + + public TypeHolderExample stringItem(String stringItem) { + + this.stringItem = stringItem; + return this; + } + + /** + * Get stringItem + * @return stringItem + **/ + @ApiModelProperty(example = "what", required = true, value = "") + @JsonProperty(JSON_PROPERTY_STRING_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getStringItem() { + return stringItem; + } + + + public void setStringItem(String stringItem) { + this.stringItem = stringItem; + } + + + public TypeHolderExample numberItem(BigDecimal numberItem) { + + this.numberItem = numberItem; + return this; + } + + /** + * Get numberItem + * @return numberItem + **/ + @ApiModelProperty(example = "1.234", required = true, value = "") + @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumberItem() { + return numberItem; + } + + + public void setNumberItem(BigDecimal numberItem) { + this.numberItem = numberItem; + } + + + public TypeHolderExample floatItem(Float floatItem) { + + this.floatItem = floatItem; + return this; + } + + /** + * Get floatItem + * @return floatItem + **/ + @ApiModelProperty(example = "1.234", required = true, value = "") + @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Float getFloatItem() { + return floatItem; + } + + + public void setFloatItem(Float floatItem) { + this.floatItem = floatItem; + } + + + public TypeHolderExample integerItem(Integer integerItem) { + + this.integerItem = integerItem; + return this; + } + + /** + * Get integerItem + * @return integerItem + **/ + @ApiModelProperty(example = "-2", required = true, value = "") + @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getIntegerItem() { + return integerItem; + } + + + public void setIntegerItem(Integer integerItem) { + this.integerItem = integerItem; + } + + + public TypeHolderExample boolItem(Boolean boolItem) { + + this.boolItem = boolItem; + return this; + } + + /** + * Get boolItem + * @return boolItem + **/ + @ApiModelProperty(example = "true", required = true, value = "") + @JsonProperty(JSON_PROPERTY_BOOL_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getBoolItem() { + return boolItem; + } + + + public void setBoolItem(Boolean boolItem) { + this.boolItem = boolItem; + } + + + public TypeHolderExample arrayItem(List<Integer> arrayItem) { + + this.arrayItem = arrayItem; + return this; + } + + public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { + this.arrayItem.add(arrayItemItem); + return this; + } + + /** + * Get arrayItem + * @return arrayItem + **/ + @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List<Integer> getArrayItem() { + return arrayItem; + } + + + public void setArrayItem(List<Integer> arrayItem) { + this.arrayItem = arrayItem; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypeHolderExample typeHolderExample = (TypeHolderExample) o; + return Objects.equals(this.stringItem, typeHolderExample.stringItem) && + Objects.equals(this.numberItem, typeHolderExample.numberItem) && + Objects.equals(this.floatItem, typeHolderExample.floatItem) && + Objects.equals(this.integerItem, typeHolderExample.integerItem) && + Objects.equals(this.boolItem, typeHolderExample.boolItem) && + Objects.equals(this.arrayItem, typeHolderExample.arrayItem); + } + + @Override + public int hashCode() { + return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeHolderExample {\n"); + sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); + sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); + sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); + sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); + sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); + sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 000000000000..b7e74643dab2 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,319 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) + +public class User { + public static final String JSON_PROPERTY_ID = "id"; + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + private Integer userStatus; + + + public User id(Long id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getId() { + return id; + } + + + public void setId(Long id) { + this.id = id; + } + + + public User username(String username) { + + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public User firstName(String firstName) { + + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getFirstName() { + return firstName; + } + + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + + public User lastName(String lastName) { + + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LAST_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastName() { + return lastName; + } + + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + + public User email(String email) { + + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public User password(String password) { + + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public User phone(String phone) { + + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PHONE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPhone() { + return phone; + } + + + public void setPhone(String phone) { + this.phone = phone; + } + + + public User userStatus(Integer userStatus) { + + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "User Status") + @JsonProperty(JSON_PROPERTY_USER_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUserStatus() { + return userStatus; + } + + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/XmlItem.java new file mode 100644 index 000000000000..b3fbdce31b9b --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/XmlItem.java @@ -0,0 +1,1045 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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 com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * XmlItem + */ +@JsonPropertyOrder({ + XmlItem.JSON_PROPERTY_ATTRIBUTE_STRING, + XmlItem.JSON_PROPERTY_ATTRIBUTE_NUMBER, + XmlItem.JSON_PROPERTY_ATTRIBUTE_INTEGER, + XmlItem.JSON_PROPERTY_ATTRIBUTE_BOOLEAN, + XmlItem.JSON_PROPERTY_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_NAME_STRING, + XmlItem.JSON_PROPERTY_NAME_NUMBER, + XmlItem.JSON_PROPERTY_NAME_INTEGER, + XmlItem.JSON_PROPERTY_NAME_BOOLEAN, + XmlItem.JSON_PROPERTY_NAME_ARRAY, + XmlItem.JSON_PROPERTY_NAME_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_STRING, + XmlItem.JSON_PROPERTY_PREFIX_NUMBER, + XmlItem.JSON_PROPERTY_PREFIX_INTEGER, + XmlItem.JSON_PROPERTY_PREFIX_BOOLEAN, + XmlItem.JSON_PROPERTY_PREFIX_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_NAMESPACE_STRING, + XmlItem.JSON_PROPERTY_NAMESPACE_NUMBER, + XmlItem.JSON_PROPERTY_NAMESPACE_INTEGER, + XmlItem.JSON_PROPERTY_NAMESPACE_BOOLEAN, + XmlItem.JSON_PROPERTY_NAMESPACE_ARRAY, + XmlItem.JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_NS_STRING, + XmlItem.JSON_PROPERTY_PREFIX_NS_NUMBER, + XmlItem.JSON_PROPERTY_PREFIX_NS_INTEGER, + XmlItem.JSON_PROPERTY_PREFIX_NS_BOOLEAN, + XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, + XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY +}) + +public class XmlItem { + public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; + private String attributeString; + + public static final String JSON_PROPERTY_ATTRIBUTE_NUMBER = "attribute_number"; + private BigDecimal attributeNumber; + + public static final String JSON_PROPERTY_ATTRIBUTE_INTEGER = "attribute_integer"; + private Integer attributeInteger; + + public static final String JSON_PROPERTY_ATTRIBUTE_BOOLEAN = "attribute_boolean"; + private Boolean attributeBoolean; + + public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array"; + private List<Integer> wrappedArray = null; + + public static final String JSON_PROPERTY_NAME_STRING = "name_string"; + private String nameString; + + public static final String JSON_PROPERTY_NAME_NUMBER = "name_number"; + private BigDecimal nameNumber; + + public static final String JSON_PROPERTY_NAME_INTEGER = "name_integer"; + private Integer nameInteger; + + public static final String JSON_PROPERTY_NAME_BOOLEAN = "name_boolean"; + private Boolean nameBoolean; + + public static final String JSON_PROPERTY_NAME_ARRAY = "name_array"; + private List<Integer> nameArray = null; + + public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array"; + private List<Integer> nameWrappedArray = null; + + public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string"; + private String prefixString; + + public static final String JSON_PROPERTY_PREFIX_NUMBER = "prefix_number"; + private BigDecimal prefixNumber; + + public static final String JSON_PROPERTY_PREFIX_INTEGER = "prefix_integer"; + private Integer prefixInteger; + + public static final String JSON_PROPERTY_PREFIX_BOOLEAN = "prefix_boolean"; + private Boolean prefixBoolean; + + public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array"; + private List<Integer> prefixArray = null; + + public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; + private List<Integer> prefixWrappedArray = null; + + public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string"; + private String namespaceString; + + public static final String JSON_PROPERTY_NAMESPACE_NUMBER = "namespace_number"; + private BigDecimal namespaceNumber; + + public static final String JSON_PROPERTY_NAMESPACE_INTEGER = "namespace_integer"; + private Integer namespaceInteger; + + public static final String JSON_PROPERTY_NAMESPACE_BOOLEAN = "namespace_boolean"; + private Boolean namespaceBoolean; + + public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array"; + private List<Integer> namespaceArray = null; + + public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; + private List<Integer> namespaceWrappedArray = null; + + public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string"; + private String prefixNsString; + + public static final String JSON_PROPERTY_PREFIX_NS_NUMBER = "prefix_ns_number"; + private BigDecimal prefixNsNumber; + + public static final String JSON_PROPERTY_PREFIX_NS_INTEGER = "prefix_ns_integer"; + private Integer prefixNsInteger; + + public static final String JSON_PROPERTY_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; + private Boolean prefixNsBoolean; + + public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array"; + private List<Integer> prefixNsArray = null; + + public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; + private List<Integer> prefixNsWrappedArray = null; + + + public XmlItem attributeString(String attributeString) { + + this.attributeString = attributeString; + return this; + } + + /** + * Get attributeString + * @return attributeString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAttributeString() { + return attributeString; + } + + + public void setAttributeString(String attributeString) { + this.attributeString = attributeString; + } + + + public XmlItem attributeNumber(BigDecimal attributeNumber) { + + this.attributeNumber = attributeNumber; + return this; + } + + /** + * Get attributeNumber + * @return attributeNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getAttributeNumber() { + return attributeNumber; + } + + + public void setAttributeNumber(BigDecimal attributeNumber) { + this.attributeNumber = attributeNumber; + } + + + public XmlItem attributeInteger(Integer attributeInteger) { + + this.attributeInteger = attributeInteger; + return this; + } + + /** + * Get attributeInteger + * @return attributeInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getAttributeInteger() { + return attributeInteger; + } + + + public void setAttributeInteger(Integer attributeInteger) { + this.attributeInteger = attributeInteger; + } + + + public XmlItem attributeBoolean(Boolean attributeBoolean) { + + this.attributeBoolean = attributeBoolean; + return this; + } + + /** + * Get attributeBoolean + * @return attributeBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAttributeBoolean() { + return attributeBoolean; + } + + + public void setAttributeBoolean(Boolean attributeBoolean) { + this.attributeBoolean = attributeBoolean; + } + + + public XmlItem wrappedArray(List<Integer> wrappedArray) { + + this.wrappedArray = wrappedArray; + return this; + } + + public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { + if (this.wrappedArray == null) { + this.wrappedArray = new ArrayList<>(); + } + this.wrappedArray.add(wrappedArrayItem); + return this; + } + + /** + * Get wrappedArray + * @return wrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getWrappedArray() { + return wrappedArray; + } + + + public void setWrappedArray(List<Integer> wrappedArray) { + this.wrappedArray = wrappedArray; + } + + + public XmlItem nameString(String nameString) { + + this.nameString = nameString; + return this; + } + + /** + * Get nameString + * @return nameString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_NAME_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNameString() { + return nameString; + } + + + public void setNameString(String nameString) { + this.nameString = nameString; + } + + + public XmlItem nameNumber(BigDecimal nameNumber) { + + this.nameNumber = nameNumber; + return this; + } + + /** + * Get nameNumber + * @return nameNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_NAME_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getNameNumber() { + return nameNumber; + } + + + public void setNameNumber(BigDecimal nameNumber) { + this.nameNumber = nameNumber; + } + + + public XmlItem nameInteger(Integer nameInteger) { + + this.nameInteger = nameInteger; + return this; + } + + /** + * Get nameInteger + * @return nameInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_NAME_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getNameInteger() { + return nameInteger; + } + + + public void setNameInteger(Integer nameInteger) { + this.nameInteger = nameInteger; + } + + + public XmlItem nameBoolean(Boolean nameBoolean) { + + this.nameBoolean = nameBoolean; + return this; + } + + /** + * Get nameBoolean + * @return nameBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getNameBoolean() { + return nameBoolean; + } + + + public void setNameBoolean(Boolean nameBoolean) { + this.nameBoolean = nameBoolean; + } + + + public XmlItem nameArray(List<Integer> nameArray) { + + this.nameArray = nameArray; + return this; + } + + public XmlItem addNameArrayItem(Integer nameArrayItem) { + if (this.nameArray == null) { + this.nameArray = new ArrayList<>(); + } + this.nameArray.add(nameArrayItem); + return this; + } + + /** + * Get nameArray + * @return nameArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNameArray() { + return nameArray; + } + + + public void setNameArray(List<Integer> nameArray) { + this.nameArray = nameArray; + } + + + public XmlItem nameWrappedArray(List<Integer> nameWrappedArray) { + + this.nameWrappedArray = nameWrappedArray; + return this; + } + + public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { + if (this.nameWrappedArray == null) { + this.nameWrappedArray = new ArrayList<>(); + } + this.nameWrappedArray.add(nameWrappedArrayItem); + return this; + } + + /** + * Get nameWrappedArray + * @return nameWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNameWrappedArray() { + return nameWrappedArray; + } + + + public void setNameWrappedArray(List<Integer> nameWrappedArray) { + this.nameWrappedArray = nameWrappedArray; + } + + + public XmlItem prefixString(String prefixString) { + + this.prefixString = prefixString; + return this; + } + + /** + * Get prefixString + * @return prefixString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPrefixString() { + return prefixString; + } + + + public void setPrefixString(String prefixString) { + this.prefixString = prefixString; + } + + + public XmlItem prefixNumber(BigDecimal prefixNumber) { + + this.prefixNumber = prefixNumber; + return this; + } + + /** + * Get prefixNumber + * @return prefixNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getPrefixNumber() { + return prefixNumber; + } + + + public void setPrefixNumber(BigDecimal prefixNumber) { + this.prefixNumber = prefixNumber; + } + + + public XmlItem prefixInteger(Integer prefixInteger) { + + this.prefixInteger = prefixInteger; + return this; + } + + /** + * Get prefixInteger + * @return prefixInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getPrefixInteger() { + return prefixInteger; + } + + + public void setPrefixInteger(Integer prefixInteger) { + this.prefixInteger = prefixInteger; + } + + + public XmlItem prefixBoolean(Boolean prefixBoolean) { + + this.prefixBoolean = prefixBoolean; + return this; + } + + /** + * Get prefixBoolean + * @return prefixBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrefixBoolean() { + return prefixBoolean; + } + + + public void setPrefixBoolean(Boolean prefixBoolean) { + this.prefixBoolean = prefixBoolean; + } + + + public XmlItem prefixArray(List<Integer> prefixArray) { + + this.prefixArray = prefixArray; + return this; + } + + public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { + if (this.prefixArray == null) { + this.prefixArray = new ArrayList<>(); + } + this.prefixArray.add(prefixArrayItem); + return this; + } + + /** + * Get prefixArray + * @return prefixArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixArray() { + return prefixArray; + } + + + public void setPrefixArray(List<Integer> prefixArray) { + this.prefixArray = prefixArray; + } + + + public XmlItem prefixWrappedArray(List<Integer> prefixWrappedArray) { + + this.prefixWrappedArray = prefixWrappedArray; + return this; + } + + public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { + if (this.prefixWrappedArray == null) { + this.prefixWrappedArray = new ArrayList<>(); + } + this.prefixWrappedArray.add(prefixWrappedArrayItem); + return this; + } + + /** + * Get prefixWrappedArray + * @return prefixWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixWrappedArray() { + return prefixWrappedArray; + } + + + public void setPrefixWrappedArray(List<Integer> prefixWrappedArray) { + this.prefixWrappedArray = prefixWrappedArray; + } + + + public XmlItem namespaceString(String namespaceString) { + + this.namespaceString = namespaceString; + return this; + } + + /** + * Get namespaceString + * @return namespaceString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNamespaceString() { + return namespaceString; + } + + + public void setNamespaceString(String namespaceString) { + this.namespaceString = namespaceString; + } + + + public XmlItem namespaceNumber(BigDecimal namespaceNumber) { + + this.namespaceNumber = namespaceNumber; + return this; + } + + /** + * Get namespaceNumber + * @return namespaceNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getNamespaceNumber() { + return namespaceNumber; + } + + + public void setNamespaceNumber(BigDecimal namespaceNumber) { + this.namespaceNumber = namespaceNumber; + } + + + public XmlItem namespaceInteger(Integer namespaceInteger) { + + this.namespaceInteger = namespaceInteger; + return this; + } + + /** + * Get namespaceInteger + * @return namespaceInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getNamespaceInteger() { + return namespaceInteger; + } + + + public void setNamespaceInteger(Integer namespaceInteger) { + this.namespaceInteger = namespaceInteger; + } + + + public XmlItem namespaceBoolean(Boolean namespaceBoolean) { + + this.namespaceBoolean = namespaceBoolean; + return this; + } + + /** + * Get namespaceBoolean + * @return namespaceBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getNamespaceBoolean() { + return namespaceBoolean; + } + + + public void setNamespaceBoolean(Boolean namespaceBoolean) { + this.namespaceBoolean = namespaceBoolean; + } + + + public XmlItem namespaceArray(List<Integer> namespaceArray) { + + this.namespaceArray = namespaceArray; + return this; + } + + public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { + if (this.namespaceArray == null) { + this.namespaceArray = new ArrayList<>(); + } + this.namespaceArray.add(namespaceArrayItem); + return this; + } + + /** + * Get namespaceArray + * @return namespaceArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNamespaceArray() { + return namespaceArray; + } + + + public void setNamespaceArray(List<Integer> namespaceArray) { + this.namespaceArray = namespaceArray; + } + + + public XmlItem namespaceWrappedArray(List<Integer> namespaceWrappedArray) { + + this.namespaceWrappedArray = namespaceWrappedArray; + return this; + } + + public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { + if (this.namespaceWrappedArray == null) { + this.namespaceWrappedArray = new ArrayList<>(); + } + this.namespaceWrappedArray.add(namespaceWrappedArrayItem); + return this; + } + + /** + * Get namespaceWrappedArray + * @return namespaceWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getNamespaceWrappedArray() { + return namespaceWrappedArray; + } + + + public void setNamespaceWrappedArray(List<Integer> namespaceWrappedArray) { + this.namespaceWrappedArray = namespaceWrappedArray; + } + + + public XmlItem prefixNsString(String prefixNsString) { + + this.prefixNsString = prefixNsString; + return this; + } + + /** + * Get prefixNsString + * @return prefixNsString + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "string", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPrefixNsString() { + return prefixNsString; + } + + + public void setPrefixNsString(String prefixNsString) { + this.prefixNsString = prefixNsString; + } + + + public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) { + + this.prefixNsNumber = prefixNsNumber; + return this; + } + + /** + * Get prefixNsNumber + * @return prefixNsNumber + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "1.234", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getPrefixNsNumber() { + return prefixNsNumber; + } + + + public void setPrefixNsNumber(BigDecimal prefixNsNumber) { + this.prefixNsNumber = prefixNsNumber; + } + + + public XmlItem prefixNsInteger(Integer prefixNsInteger) { + + this.prefixNsInteger = prefixNsInteger; + return this; + } + + /** + * Get prefixNsInteger + * @return prefixNsInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "-2", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getPrefixNsInteger() { + return prefixNsInteger; + } + + + public void setPrefixNsInteger(Integer prefixNsInteger) { + this.prefixNsInteger = prefixNsInteger; + } + + + public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) { + + this.prefixNsBoolean = prefixNsBoolean; + return this; + } + + /** + * Get prefixNsBoolean + * @return prefixNsBoolean + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "true", value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrefixNsBoolean() { + return prefixNsBoolean; + } + + + public void setPrefixNsBoolean(Boolean prefixNsBoolean) { + this.prefixNsBoolean = prefixNsBoolean; + } + + + public XmlItem prefixNsArray(List<Integer> prefixNsArray) { + + this.prefixNsArray = prefixNsArray; + return this; + } + + public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { + if (this.prefixNsArray == null) { + this.prefixNsArray = new ArrayList<>(); + } + this.prefixNsArray.add(prefixNsArrayItem); + return this; + } + + /** + * Get prefixNsArray + * @return prefixNsArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixNsArray() { + return prefixNsArray; + } + + + public void setPrefixNsArray(List<Integer> prefixNsArray) { + this.prefixNsArray = prefixNsArray; + } + + + public XmlItem prefixNsWrappedArray(List<Integer> prefixNsWrappedArray) { + + this.prefixNsWrappedArray = prefixNsWrappedArray; + return this; + } + + public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { + if (this.prefixNsWrappedArray == null) { + this.prefixNsWrappedArray = new ArrayList<>(); + } + this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); + return this; + } + + /** + * Get prefixNsWrappedArray + * @return prefixNsWrappedArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List<Integer> getPrefixNsWrappedArray() { + return prefixNsWrappedArray; + } + + + public void setPrefixNsWrappedArray(List<Integer> prefixNsWrappedArray) { + this.prefixNsWrappedArray = prefixNsWrappedArray; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + XmlItem xmlItem = (XmlItem) o; + return Objects.equals(this.attributeString, xmlItem.attributeString) && + Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && + Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && + Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && + Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && + Objects.equals(this.nameString, xmlItem.nameString) && + Objects.equals(this.nameNumber, xmlItem.nameNumber) && + Objects.equals(this.nameInteger, xmlItem.nameInteger) && + Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && + Objects.equals(this.nameArray, xmlItem.nameArray) && + Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && + Objects.equals(this.prefixString, xmlItem.prefixString) && + Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && + Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && + Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && + Objects.equals(this.prefixArray, xmlItem.prefixArray) && + Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && + Objects.equals(this.namespaceString, xmlItem.namespaceString) && + Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && + Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && + Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && + Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && + Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && + Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && + Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && + Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && + Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && + Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && + Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); + } + + @Override + public int hashCode() { + 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(); + sb.append("class XmlItem {\n"); + sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); + sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); + sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); + sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); + sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); + sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); + sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); + sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); + sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); + sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); + sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); + sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); + sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); + sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); + sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); + sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); + sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); + sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); + sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); + sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); + sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); + sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); + sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); + sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); + sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); + sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); + sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); + sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); + sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 000000000000..44d82e91f71f --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +public class AnotherFakeApiTest { + + private final AnotherFakeApi api = new AnotherFakeApi(); + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void call123testSpecialTagsTest() throws ApiException { + // + //Client body = null; + // + //Client response = api.call123testSpecialTags(body); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 000000000000..73e2be5f5e5f --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,322 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.openapitools.client.model.XmlItem; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +public class FakeApiTest { + + private final FakeApi api = new FakeApi(); + + /** + * creates an XmlItem + * + * this route creates an XmlItem + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createXmlItemTest() throws ApiException { + // + //XmlItem xmlItem = null; + // + //api.createXmlItem(xmlItem); + + // TODO: test validations + } + /** + * Test serialization of outer boolean types + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterBooleanSerializeTest() throws ApiException { + // + //Boolean body = null; + // + //Boolean response = api.fakeOuterBooleanSerialize(body); + + // TODO: test validations + } + /** + * Test serialization of object with outer number type + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterCompositeSerializeTest() throws ApiException { + // + //OuterComposite body = null; + // + //OuterComposite response = api.fakeOuterCompositeSerialize(body); + + // TODO: test validations + } + /** + * Test serialization of outer number types + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterNumberSerializeTest() throws ApiException { + // + //BigDecimal body = null; + // + //BigDecimal response = api.fakeOuterNumberSerialize(body); + + // TODO: test validations + } + /** + * Test serialization of outer string types + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fakeOuterStringSerializeTest() throws ApiException { + // + //String body = null; + // + //String response = api.fakeOuterStringSerialize(body); + + // TODO: test validations + } + /** + * For this test, the body for this request much reference a schema named `File`. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithFileSchemaTest() throws ApiException { + // + //FileSchemaTestClass body = null; + // + //api.testBodyWithFileSchema(body); + + // TODO: test validations + } + /** + * @throws ApiException + * if the Api call fails + */ + @Test + public void testBodyWithQueryParamsTest() throws ApiException { + // + //String query = null; + // + //User body = null; + // + //api.testBodyWithQueryParams(query, body); + + // TODO: test validations + } + /** + * To test \"client\" model + * + * To test \"client\" model + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClientModelTest() throws ApiException { + // + //Client body = null; + // + //Client response = api.testClientModel(body); + + // TODO: test validations + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testEndpointParametersTest() throws ApiException { + // + //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); + + // TODO: test validations + } + /** + * To test enum parameters + * + * To test enum parameters + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testEnumParametersTest() throws ApiException { + // + //List<String> enumHeaderStringArray = null; + // + //String enumHeaderString = null; + // + //List<String> enumQueryStringArray = null; + // + //String enumQueryString = null; + // + //Integer enumQueryInteger = null; + // + //Double enumQueryDouble = null; + // + //List<String> enumFormStringArray = null; + // + //String enumFormString = null; + // + //api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + + // TODO: test validations + } + /** + * Fake endpoint to test group parameters (optional) + * + * Fake endpoint to test group parameters (optional) + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testGroupParametersTest() throws ApiException { + // + //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); + + // TODO: test validations + } + /** + * test inline additionalProperties + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testInlineAdditionalPropertiesTest() throws ApiException { + // + //Map<String, String> param = null; + // + //api.testInlineAdditionalProperties(param); + + // TODO: test validations + } + /** + * test json serialization of form data + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testJsonFormDataTest() throws ApiException { + // + //String param = null; + // + //String param2 = null; + // + //api.testJsonFormData(param, param2); + + // TODO: test validations + } + /** + * To test the collection format in query parameters + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testQueryParameterCollectionFormatTest() throws ApiException { + // + //List<String> pipe = null; + // + //List<String> ioutil = null; + // + //List<String> http = null; + // + //List<String> url = null; + // + //List<String> context = null; + // + //api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 000000000000..ac540ae2c810 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + /** + * To test class name in snake case + * + * To test class name in snake case + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + // + //Client body = null; + // + //Client response = api.testClassname(body); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 000000000000..5bda552acf62 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,191 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +public class PetApiTest { + + private final PetApi api = new PetApi(); + + /** + * Add a new pet to the store + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() throws ApiException { + // + //Pet body = null; + // + //api.addPet(body); + + // TODO: test validations + } + /** + * Deletes a pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() throws ApiException { + // + //Long petId = null; + // + //String apiKey = null; + // + //api.deletePet(petId, apiKey); + + // TODO: test validations + } + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() throws ApiException { + // + //List<String> status = null; + // + //List<Pet> response = api.findPetsByStatus(status); + + // TODO: test validations + } + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() throws ApiException { + // + //List<String> tags = null; + // + //List<Pet> response = api.findPetsByTags(tags); + + // TODO: test validations + } + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() throws ApiException { + // + //Long petId = null; + // + //Pet response = api.getPetById(petId); + + // TODO: test validations + } + /** + * Update an existing pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() throws ApiException { + // + //Pet body = null; + // + //api.updatePet(body); + + // TODO: test validations + } + /** + * Updates a pet in the store with form data + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() throws ApiException { + // + //Long petId = null; + // + //String name = null; + // + //String status = null; + // + //api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + /** + * uploads an image + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() throws ApiException { + // + //Long petId = null; + // + //String additionalMetadata = null; + // + //File file = null; + // + //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + + // TODO: test validations + } + /** + * uploads an image (required) + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileWithRequiredFileTest() throws ApiException { + // + //Long petId = null; + // + //File requiredFile = null; + // + //String additionalMetadata = null; + // + //ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 000000000000..6f9a624092d7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.Order; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() throws ApiException { + // + //String orderId = null; + // + //api.deleteOrder(orderId); + + // TODO: test validations + } + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() throws ApiException { + // + //Map<String, Integer> response = api.getInventory(); + + // TODO: test validations + } + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() throws ApiException { + // + //Long orderId = null; + // + //Order response = api.getOrderById(orderId); + + // TODO: test validations + } + /** + * Place an order for a pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() throws ApiException { + // + //Order body = null; + // + //Order response = api.placeOrder(body); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 000000000000..ffe1ec483816 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,162 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.model.User; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +public class UserApiTest { + + private final UserApi api = new UserApi(); + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() throws ApiException { + // + //User body = null; + // + //api.createUser(body); + + // TODO: test validations + } + /** + * Creates list of users with given input array + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() throws ApiException { + // + //List<User> body = null; + // + //api.createUsersWithArrayInput(body); + + // TODO: test validations + } + /** + * Creates list of users with given input array + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() throws ApiException { + // + //List<User> body = null; + // + //api.createUsersWithListInput(body); + + // TODO: test validations + } + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() throws ApiException { + // + //String username = null; + // + //api.deleteUser(username); + + // TODO: test validations + } + /** + * Get user by user name + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() throws ApiException { + // + //String username = null; + // + //User response = api.getUserByName(username); + + // TODO: test validations + } + /** + * Logs user into the system + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() throws ApiException { + // + //String username = null; + // + //String password = null; + // + //String response = api.loginUser(username, password); + + // TODO: test validations + } + /** + * Logs out current logged in user session + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() throws ApiException { + // + //api.logoutUser(); + + // TODO: test validations + } + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() throws ApiException { + // + //String username = null; + // + //User body = null; + // + //api.updateUser(username, body); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java new file mode 100644 index 000000000000..ec44af783873 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesAnyType + */ +public class AdditionalPropertiesAnyTypeTest { + private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); + + /** + * Model tests for AdditionalPropertiesAnyType + */ + @Test + public void testAdditionalPropertiesAnyType() { + // TODO: test AdditionalPropertiesAnyType + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java new file mode 100644 index 000000000000..ceb024c5620b --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesArray + */ +public class AdditionalPropertiesArrayTest { + private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); + + /** + * Model tests for AdditionalPropertiesArray + */ + @Test + public void testAdditionalPropertiesArray() { + // TODO: test AdditionalPropertiesArray + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java new file mode 100644 index 000000000000..517e5a10ae43 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesBoolean + */ +public class AdditionalPropertiesBooleanTest { + private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); + + /** + * Model tests for AdditionalPropertiesBoolean + */ + @Test + public void testAdditionalPropertiesBoolean() { + // TODO: test AdditionalPropertiesBoolean + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..2e3844ba9756 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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; + + +/** + * Model tests for AdditionalPropertiesClass + */ +public class AdditionalPropertiesClassTest { + private final AdditionalPropertiesClass model = new AdditionalPropertiesClass(); + + /** + * Model tests for AdditionalPropertiesClass + */ + @Test + public void testAdditionalPropertiesClass() { + // TODO: test AdditionalPropertiesClass + } + + /** + * Test the property 'mapString' + */ + @Test + public void mapStringTest() { + // TODO: test mapString + } + + /** + * Test the property 'mapNumber' + */ + @Test + public void mapNumberTest() { + // TODO: test mapNumber + } + + /** + * Test the property 'mapInteger' + */ + @Test + public void mapIntegerTest() { + // TODO: test mapInteger + } + + /** + * Test the property 'mapBoolean' + */ + @Test + public void mapBooleanTest() { + // TODO: test mapBoolean + } + + /** + * Test the property 'mapArrayInteger' + */ + @Test + public void mapArrayIntegerTest() { + // TODO: test mapArrayInteger + } + + /** + * Test the property 'mapArrayAnytype' + */ + @Test + public void mapArrayAnytypeTest() { + // TODO: test mapArrayAnytype + } + + /** + * Test the property 'mapMapString' + */ + @Test + public void mapMapStringTest() { + // TODO: test mapMapString + } + + /** + * Test the property 'mapMapAnytype' + */ + @Test + public void mapMapAnytypeTest() { + // TODO: test mapMapAnytype + } + + /** + * Test the property 'anytype1' + */ + @Test + public void anytype1Test() { + // TODO: test anytype1 + } + + /** + * Test the property 'anytype2' + */ + @Test + public void anytype2Test() { + // TODO: test anytype2 + } + + /** + * Test the property 'anytype3' + */ + @Test + public void anytype3Test() { + // TODO: test anytype3 + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java new file mode 100644 index 000000000000..66a7b85623e3 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesInteger + */ +public class AdditionalPropertiesIntegerTest { + private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); + + /** + * Model tests for AdditionalPropertiesInteger + */ + @Test + public void testAdditionalPropertiesInteger() { + // TODO: test AdditionalPropertiesInteger + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java new file mode 100644 index 000000000000..4e03485a4484 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesNumber + */ +public class AdditionalPropertiesNumberTest { + private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); + + /** + * Model tests for AdditionalPropertiesNumber + */ + @Test + public void testAdditionalPropertiesNumber() { + // TODO: test AdditionalPropertiesNumber + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java new file mode 100644 index 000000000000..e0c72c586347 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesObject + */ +public class AdditionalPropertiesObjectTest { + private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); + + /** + * Model tests for AdditionalPropertiesObject + */ + @Test + public void testAdditionalPropertiesObject() { + // TODO: test AdditionalPropertiesObject + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java new file mode 100644 index 000000000000..c84d987e7640 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for AdditionalPropertiesString + */ +public class AdditionalPropertiesStringTest { + private final AdditionalPropertiesString model = new AdditionalPropertiesString(); + + /** + * Model tests for AdditionalPropertiesString + */ + @Test + public void testAdditionalPropertiesString() { + // TODO: test AdditionalPropertiesString + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AnimalTest.java new file mode 100644 index 000000000000..c0d10ec5a3d8 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +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; + + +/** + * Model tests for Animal + */ +public class AnimalTest { + private final Animal model = new Animal(); + + /** + * Model tests for Animal + */ + @Test + public void testAnimal() { + // TODO: test Animal + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..e25187a3b608 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..ae1061823991 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java @@ -0,0 +1,52 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for ArrayOfNumberOnly + */ +public class ArrayOfNumberOnlyTest { + private final ArrayOfNumberOnly model = new ArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfNumberOnly + */ + @Test + public void testArrayOfNumberOnly() { + // TODO: test ArrayOfNumberOnly + } + + /** + * Test the property 'arrayNumber' + */ + @Test + public void arrayNumberTest() { + // TODO: test arrayNumber + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayTestTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayTestTest.java new file mode 100644 index 000000000000..36bd9951cf60 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ArrayTestTest.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for ArrayTest + */ +public class ArrayTestTest { + private final ArrayTest model = new ArrayTest(); + + /** + * Model tests for ArrayTest + */ + @Test + public void testArrayTest() { + // TODO: test ArrayTest + } + + /** + * Test the property 'arrayOfString' + */ + @Test + public void arrayOfStringTest() { + // TODO: test arrayOfString + } + + /** + * Test the property 'arrayArrayOfInteger' + */ + @Test + public void arrayArrayOfIntegerTest() { + // TODO: test arrayArrayOfInteger + } + + /** + * Test the property 'arrayArrayOfModel' + */ + @Test + public void arrayArrayOfModelTest() { + // TODO: test arrayArrayOfModel + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 000000000000..a9b13011f001 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 000000000000..006c80707427 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CapitalizationTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CapitalizationTest.java new file mode 100644 index 000000000000..a701b341fc59 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CapitalizationTest.java @@ -0,0 +1,89 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Capitalization + */ +public class CapitalizationTest { + private final Capitalization model = new Capitalization(); + + /** + * Model tests for Capitalization + */ + @Test + public void testCapitalization() { + // TODO: test Capitalization + } + + /** + * Test the property 'smallCamel' + */ + @Test + public void smallCamelTest() { + // TODO: test smallCamel + } + + /** + * Test the property 'capitalCamel' + */ + @Test + public void capitalCamelTest() { + // TODO: test capitalCamel + } + + /** + * Test the property 'smallSnake' + */ + @Test + public void smallSnakeTest() { + // TODO: test smallSnake + } + + /** + * Test the property 'capitalSnake' + */ + @Test + public void capitalSnakeTest() { + // TODO: test capitalSnake + } + + /** + * Test the property 'scAETHFlowPoints' + */ + @Test + public void scAETHFlowPointsTest() { + // TODO: test scAETHFlowPoints + } + + /** + * Test the property 'ATT_NAME' + */ + @Test + public void ATT_NAMETest() { + // TODO: test ATT_NAME + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatAllOfTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatAllOfTest.java new file mode 100644 index 000000000000..1d85a0447253 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for CatAllOf + */ +public class CatAllOfTest { + private final CatAllOf model = new CatAllOf(); + + /** + * Model tests for CatAllOf + */ + @Test + public void testCatAllOf() { + // TODO: test CatAllOf + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatTest.java new file mode 100644 index 000000000000..dbf40678a2d0 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CatTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import org.openapitools.client.model.CatAllOf; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Cat + */ +public class CatTest { + private final Cat model = new Cat(); + + /** + * Model tests for Cat + */ + @Test + public void testCat() { + // TODO: test Cat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CategoryTest.java new file mode 100644 index 000000000000..6027994a2ac3 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/CategoryTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Category + */ +public class CategoryTest { + private final Category model = new Category(); + + /** + * Model tests for Category + */ + @Test + public void testCategory() { + // TODO: test Category + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClassModelTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClassModelTest.java new file mode 100644 index 000000000000..8914c9cad43d --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClassModelTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ClassModel + */ +public class ClassModelTest { + private final ClassModel model = new ClassModel(); + + /** + * Model tests for ClassModel + */ + @Test + public void testClassModel() { + // TODO: test ClassModel + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClientTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClientTest.java new file mode 100644 index 000000000000..c21b346272d7 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ClientTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Client + */ +public class ClientTest { + private final Client model = new Client(); + + /** + * Model tests for Client + */ + @Test + public void testClient() { + // TODO: test Client + } + + /** + * Test the property 'client' + */ + @Test + public void clientTest() { + // TODO: test client + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogAllOfTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogAllOfTest.java new file mode 100644 index 000000000000..6e4b49108098 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogAllOfTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for DogAllOf + */ +public class DogAllOfTest { + private final DogAllOf model = new DogAllOf(); + + /** + * Model tests for DogAllOf + */ + @Test + public void testDogAllOf() { + // TODO: test DogAllOf + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogTest.java new file mode 100644 index 000000000000..a46bc508d48c --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/DogTest.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for Dog + */ +public class DogTest { + private final Dog model = new Dog(); + + /** + * Model tests for Dog + */ + @Test + public void testDog() { + // TODO: test Dog + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'breed' + */ + @Test + public void breedTest() { + // TODO: test breed + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumArraysTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumArraysTest.java new file mode 100644 index 000000000000..45b8fbbd8220 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumArraysTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for EnumArrays + */ +public class EnumArraysTest { + private final EnumArrays model = new EnumArrays(); + + /** + * Model tests for EnumArrays + */ + @Test + public void testEnumArrays() { + // TODO: test EnumArrays + } + + /** + * Test the property 'justSymbol' + */ + @Test + public void justSymbolTest() { + // TODO: test justSymbol + } + + /** + * Test the property 'arrayEnum' + */ + @Test + public void arrayEnumTest() { + // TODO: test arrayEnum + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumClassTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumClassTest.java new file mode 100644 index 000000000000..9e45543facd2 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumClassTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for EnumClass + */ +public class EnumClassTest { + /** + * Model tests for EnumClass + */ + @Test + public void testEnumClass() { + // TODO: test EnumClass + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumTestTest.java new file mode 100644 index 000000000000..04e7afb19784 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for EnumTest + */ +public class EnumTestTest { + private final EnumTest model = new EnumTest(); + + /** + * Model tests for EnumTest + */ + @Test + public void testEnumTest() { + // TODO: test EnumTest + } + + /** + * Test the property 'enumString' + */ + @Test + public void enumStringTest() { + // TODO: test enumString + } + + /** + * Test the property 'enumStringRequired' + */ + @Test + public void enumStringRequiredTest() { + // TODO: test enumStringRequired + } + + /** + * Test the property 'enumInteger' + */ + @Test + public void enumIntegerTest() { + // TODO: test enumInteger + } + + /** + * Test the property 'enumNumber' + */ + @Test + public void enumNumberTest() { + // TODO: test enumNumber + } + + /** + * Test the property 'outerEnum' + */ + @Test + public void outerEnumTest() { + // TODO: test outerEnum + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java new file mode 100644 index 000000000000..ef37e666be39 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for FileSchemaTestClass + */ +public class FileSchemaTestClassTest { + private final FileSchemaTestClass model = new FileSchemaTestClass(); + + /** + * Model tests for FileSchemaTestClass + */ + @Test + public void testFileSchemaTestClass() { + // TODO: test FileSchemaTestClass + } + + /** + * Test the property 'file' + */ + @Test + public void fileTest() { + // TODO: test file + } + + /** + * Test the property 'files' + */ + @Test + public void filesTest() { + // TODO: test files + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FormatTestTest.java new file mode 100644 index 000000000000..73a1f737503f --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -0,0 +1,158 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for FormatTest + */ +public class FormatTestTest { + private final FormatTest model = new FormatTest(); + + /** + * Model tests for FormatTest + */ + @Test + public void testFormatTest() { + // TODO: test FormatTest + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'bigDecimal' + */ + @Test + public void bigDecimalTest() { + // TODO: test bigDecimal + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java new file mode 100644 index 000000000000..e902c100383b --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for HasOnlyReadOnly + */ +public class HasOnlyReadOnlyTest { + private final HasOnlyReadOnly model = new HasOnlyReadOnly(); + + /** + * Model tests for HasOnlyReadOnly + */ + @Test + public void testHasOnlyReadOnly() { + // TODO: test HasOnlyReadOnly + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'foo' + */ + @Test + public void fooTest() { + // TODO: test foo + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MapTestTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MapTestTest.java new file mode 100644 index 000000000000..a0c991bb7588 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MapTestTest.java @@ -0,0 +1,76 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for MapTest + */ +public class MapTestTest { + private final MapTest model = new MapTest(); + + /** + * Model tests for MapTest + */ + @Test + public void testMapTest() { + // TODO: test MapTest + } + + /** + * Test the property 'mapMapOfString' + */ + @Test + public void mapMapOfStringTest() { + // TODO: test mapMapOfString + } + + /** + * Test the property 'mapOfEnumString' + */ + @Test + public void mapOfEnumStringTest() { + // TODO: test mapOfEnumString + } + + /** + * Test the property 'directMap' + */ + @Test + public void directMapTest() { + // TODO: test directMap + } + + /** + * Test the property 'indirectMap' + */ + @Test + public void indirectMapTest() { + // TODO: test indirectMap + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java new file mode 100644 index 000000000000..630b566f54db --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java @@ -0,0 +1,71 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ +public class MixedPropertiesAndAdditionalPropertiesClassTest { + private final MixedPropertiesAndAdditionalPropertiesClass model = new MixedPropertiesAndAdditionalPropertiesClass(); + + /** + * Model tests for MixedPropertiesAndAdditionalPropertiesClass + */ + @Test + public void testMixedPropertiesAndAdditionalPropertiesClass() { + // TODO: test MixedPropertiesAndAdditionalPropertiesClass + } + + /** + * Test the property 'uuid' + */ + @Test + public void uuidTest() { + // TODO: test uuid + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'map' + */ + @Test + public void mapTest() { + // TODO: test map + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/Model200ResponseTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/Model200ResponseTest.java new file mode 100644 index 000000000000..82c7208079db --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/Model200ResponseTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Model200Response + */ +public class Model200ResponseTest { + private final Model200Response model = new Model200Response(); + + /** + * Model tests for Model200Response + */ + @Test + public void testModel200Response() { + // TODO: test Model200Response + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'propertyClass' + */ + @Test + public void propertyClassTest() { + // TODO: test propertyClass + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java new file mode 100644 index 000000000000..97a1287aa413 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ModelApiResponse + */ +public class ModelApiResponseTest { + private final ModelApiResponse model = new ModelApiResponse(); + + /** + * Model tests for ModelApiResponse + */ + @Test + public void testModelApiResponse() { + // TODO: test ModelApiResponse + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelReturnTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelReturnTest.java new file mode 100644 index 000000000000..f884519ebc86 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ModelReturnTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ModelReturn + */ +public class ModelReturnTest { + private final ModelReturn model = new ModelReturn(); + + /** + * Model tests for ModelReturn + */ + @Test + public void testModelReturn() { + // TODO: test ModelReturn + } + + /** + * Test the property '_return' + */ + @Test + public void _returnTest() { + // TODO: test _return + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NameTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NameTest.java new file mode 100644 index 000000000000..cb3a94cf74ab --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NameTest.java @@ -0,0 +1,73 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Name + */ +public class NameTest { + private final Name model = new Name(); + + /** + * Model tests for Name + */ + @Test + public void testName() { + // TODO: test Name + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'snakeCase' + */ + @Test + public void snakeCaseTest() { + // TODO: test snakeCase + } + + /** + * Test the property 'property' + */ + @Test + public void propertyTest() { + // TODO: test property + } + + /** + * Test the property '_123number' + */ + @Test + public void _123numberTest() { + // TODO: test _123number + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NumberOnlyTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NumberOnlyTest.java new file mode 100644 index 000000000000..f4fbd5ee8b42 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/NumberOnlyTest.java @@ -0,0 +1,50 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for NumberOnly + */ +public class NumberOnlyTest { + private final NumberOnly model = new NumberOnly(); + + /** + * Model tests for NumberOnly + */ + @Test + public void testNumberOnly() { + // TODO: test NumberOnly + } + + /** + * Test the property 'justNumber' + */ + @Test + public void justNumberTest() { + // TODO: test justNumber + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OrderTest.java new file mode 100644 index 000000000000..da63441c6597 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OrderTest.java @@ -0,0 +1,90 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Order + */ +public class OrderTest { + private final Order model = new Order(); + + /** + * Model tests for Order + */ + @Test + public void testOrder() { + // TODO: test Order + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'petId' + */ + @Test + public void petIdTest() { + // TODO: test petId + } + + /** + * Test the property 'quantity' + */ + @Test + public void quantityTest() { + // TODO: test quantity + } + + /** + * Test the property 'shipDate' + */ + @Test + public void shipDateTest() { + // TODO: test shipDate + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'complete' + */ + @Test + public void completeTest() { + // TODO: test complete + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterCompositeTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterCompositeTest.java new file mode 100644 index 000000000000..ebea3ca304c0 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterCompositeTest.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for OuterComposite + */ +public class OuterCompositeTest { + private final OuterComposite model = new OuterComposite(); + + /** + * Model tests for OuterComposite + */ + @Test + public void testOuterComposite() { + // TODO: test OuterComposite + } + + /** + * Test the property 'myNumber' + */ + @Test + public void myNumberTest() { + // TODO: test myNumber + } + + /** + * Test the property 'myString' + */ + @Test + public void myStringTest() { + // TODO: test myString + } + + /** + * Test the property 'myBoolean' + */ + @Test + public void myBooleanTest() { + // TODO: test myBoolean + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterEnumTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterEnumTest.java new file mode 100644 index 000000000000..cf0ebae0faf0 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/OuterEnumTest.java @@ -0,0 +1,33 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for OuterEnum + */ +public class OuterEnumTest { + /** + * Model tests for OuterEnum + */ + @Test + public void testOuterEnum() { + // TODO: test OuterEnum + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/PetTest.java new file mode 100644 index 000000000000..c3c0d4cc35dd --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/PetTest.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Pet + */ +public class PetTest { + private final Pet model = new Pet(); + + /** + * Model tests for Pet + */ + @Test + public void testPet() { + // TODO: test Pet + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'category' + */ + @Test + public void categoryTest() { + // TODO: test category + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'photoUrls' + */ + @Test + public void photoUrlsTest() { + // TODO: test photoUrls + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java new file mode 100644 index 000000000000..b82a7d0ef561 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ReadOnlyFirst + */ +public class ReadOnlyFirstTest { + private final ReadOnlyFirst model = new ReadOnlyFirst(); + + /** + * Model tests for ReadOnlyFirst + */ + @Test + public void testReadOnlyFirst() { + // TODO: test ReadOnlyFirst + } + + /** + * Test the property 'bar' + */ + @Test + public void barTest() { + // TODO: test bar + } + + /** + * Test the property 'baz' + */ + @Test + public void bazTest() { + // TODO: test baz + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java new file mode 100644 index 000000000000..d5a19c371e68 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/SpecialModelNameTest.java @@ -0,0 +1,49 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for SpecialModelName + */ +public class SpecialModelNameTest { + private final SpecialModelName model = new SpecialModelName(); + + /** + * Model tests for SpecialModelName + */ + @Test + public void testSpecialModelName() { + // TODO: test SpecialModelName + } + + /** + * Test the property '$specialPropertyName' + */ + @Test + public void $specialPropertyNameTest() { + // TODO: test $specialPropertyName + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TagTest.java new file mode 100644 index 000000000000..5c2cc6f49e05 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TagTest.java @@ -0,0 +1,57 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java new file mode 100644 index 000000000000..e96ac744439d --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java @@ -0,0 +1,84 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for TypeHolderDefault + */ +public class TypeHolderDefaultTest { + private final TypeHolderDefault model = new TypeHolderDefault(); + + /** + * Model tests for TypeHolderDefault + */ + @Test + public void testTypeHolderDefault() { + // TODO: test TypeHolderDefault + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java new file mode 100644 index 000000000000..56641d163a50 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.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; + + +/** + * Model tests for TypeHolderExample + */ +public class TypeHolderExampleTest { + private final TypeHolderExample model = new TypeHolderExample(); + + /** + * Model tests for TypeHolderExample + */ + @Test + public void testTypeHolderExample() { + // TODO: test TypeHolderExample + } + + /** + * Test the property 'stringItem' + */ + @Test + public void stringItemTest() { + // TODO: test stringItem + } + + /** + * Test the property 'numberItem' + */ + @Test + public void numberItemTest() { + // TODO: test numberItem + } + + /** + * Test the property 'floatItem' + */ + @Test + public void floatItemTest() { + // TODO: test floatItem + } + + /** + * Test the property 'integerItem' + */ + @Test + public void integerItemTest() { + // TODO: test integerItem + } + + /** + * Test the property 'boolItem' + */ + @Test + public void boolItemTest() { + // TODO: test boolItem + } + + /** + * Test the property 'arrayItem' + */ + @Test + public void arrayItemTest() { + // TODO: test arrayItem + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/UserTest.java new file mode 100644 index 000000000000..ce40d3a2a637 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/UserTest.java @@ -0,0 +1,105 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for User + */ +public class UserTest { + private final User model = new User(); + + /** + * Model tests for User + */ + @Test + public void testUser() { + // TODO: test User + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'firstName' + */ + @Test + public void firstNameTest() { + // TODO: test firstName + } + + /** + * Test the property 'lastName' + */ + @Test + public void lastNameTest() { + // TODO: test lastName + } + + /** + * Test the property 'email' + */ + @Test + public void emailTest() { + // TODO: test email + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'phone' + */ + @Test + public void phoneTest() { + // TODO: test phone + } + + /** + * Test the property 'userStatus' + */ + @Test + public void userStatusTest() { + // TODO: test userStatus + } + +} diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/XmlItemTest.java new file mode 100644 index 000000000000..501c414555f4 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/XmlItemTest.java @@ -0,0 +1,276 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +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; + + +/** + * Model tests for XmlItem + */ +public class XmlItemTest { + private final XmlItem model = new XmlItem(); + + /** + * Model tests for XmlItem + */ + @Test + public void testXmlItem() { + // TODO: test XmlItem + } + + /** + * Test the property 'attributeString' + */ + @Test + public void attributeStringTest() { + // TODO: test attributeString + } + + /** + * Test the property 'attributeNumber' + */ + @Test + public void attributeNumberTest() { + // TODO: test attributeNumber + } + + /** + * Test the property 'attributeInteger' + */ + @Test + public void attributeIntegerTest() { + // TODO: test attributeInteger + } + + /** + * Test the property 'attributeBoolean' + */ + @Test + public void attributeBooleanTest() { + // TODO: test attributeBoolean + } + + /** + * Test the property 'wrappedArray' + */ + @Test + public void wrappedArrayTest() { + // TODO: test wrappedArray + } + + /** + * Test the property 'nameString' + */ + @Test + public void nameStringTest() { + // TODO: test nameString + } + + /** + * Test the property 'nameNumber' + */ + @Test + public void nameNumberTest() { + // TODO: test nameNumber + } + + /** + * Test the property 'nameInteger' + */ + @Test + public void nameIntegerTest() { + // TODO: test nameInteger + } + + /** + * Test the property 'nameBoolean' + */ + @Test + public void nameBooleanTest() { + // TODO: test nameBoolean + } + + /** + * Test the property 'nameArray' + */ + @Test + public void nameArrayTest() { + // TODO: test nameArray + } + + /** + * Test the property 'nameWrappedArray' + */ + @Test + public void nameWrappedArrayTest() { + // TODO: test nameWrappedArray + } + + /** + * Test the property 'prefixString' + */ + @Test + public void prefixStringTest() { + // TODO: test prefixString + } + + /** + * Test the property 'prefixNumber' + */ + @Test + public void prefixNumberTest() { + // TODO: test prefixNumber + } + + /** + * Test the property 'prefixInteger' + */ + @Test + public void prefixIntegerTest() { + // TODO: test prefixInteger + } + + /** + * Test the property 'prefixBoolean' + */ + @Test + public void prefixBooleanTest() { + // TODO: test prefixBoolean + } + + /** + * Test the property 'prefixArray' + */ + @Test + public void prefixArrayTest() { + // TODO: test prefixArray + } + + /** + * Test the property 'prefixWrappedArray' + */ + @Test + public void prefixWrappedArrayTest() { + // TODO: test prefixWrappedArray + } + + /** + * Test the property 'namespaceString' + */ + @Test + public void namespaceStringTest() { + // TODO: test namespaceString + } + + /** + * Test the property 'namespaceNumber' + */ + @Test + public void namespaceNumberTest() { + // TODO: test namespaceNumber + } + + /** + * Test the property 'namespaceInteger' + */ + @Test + public void namespaceIntegerTest() { + // TODO: test namespaceInteger + } + + /** + * Test the property 'namespaceBoolean' + */ + @Test + public void namespaceBooleanTest() { + // TODO: test namespaceBoolean + } + + /** + * Test the property 'namespaceArray' + */ + @Test + public void namespaceArrayTest() { + // TODO: test namespaceArray + } + + /** + * Test the property 'namespaceWrappedArray' + */ + @Test + public void namespaceWrappedArrayTest() { + // TODO: test namespaceWrappedArray + } + + /** + * Test the property 'prefixNsString' + */ + @Test + public void prefixNsStringTest() { + // TODO: test prefixNsString + } + + /** + * Test the property 'prefixNsNumber' + */ + @Test + public void prefixNsNumberTest() { + // TODO: test prefixNsNumber + } + + /** + * Test the property 'prefixNsInteger' + */ + @Test + public void prefixNsIntegerTest() { + // TODO: test prefixNsInteger + } + + /** + * Test the property 'prefixNsBoolean' + */ + @Test + public void prefixNsBooleanTest() { + // TODO: test prefixNsBoolean + } + + /** + * Test the property 'prefixNsArray' + */ + @Test + public void prefixNsArrayTest() { + // TODO: test prefixNsArray + } + + /** + * Test the property 'prefixNsWrappedArray' + */ + @Test + public void prefixNsWrappedArrayTest() { + // TODO: test prefixNsWrappedArray + } + +} diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index e8d4ec925e66..a0bfdf62070d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -36,6 +36,7 @@ import java.util.Map; + public class AnotherFakeApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; @@ -64,10 +65,10 @@ public AnotherFakeApi(ApiClient apiClient) { * @return Client * @throws ApiException if fails to make API call */ - public Client call123testSpecialTags(Client body) throws ApiException { + public Client call123testSpecialTags (Client body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags"); + throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -88,24 +89,23 @@ public Client call123testSpecialTags(Client body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "call123testSpecialTags call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "call123testSpecialTags call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index 3e301bd1dfb0..f2009364b7d0 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -44,6 +44,7 @@ import java.util.Map; + public class FakeApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; @@ -71,10 +72,10 @@ public FakeApi(ApiClient apiClient) { * @param xmlItem XmlItem Body (required) * @throws ApiException if fails to make API call */ - public void createXmlItem(XmlItem xmlItem) throws ApiException { + public void createXmlItem (XmlItem xmlItem) throws ApiException { // verify the required parameter 'xmlItem' is set if (xmlItem == null) { - throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem"); + throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -95,23 +96,22 @@ public void createXmlItem(XmlItem xmlItem) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "createXmlItem call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "createXmlItem call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -123,7 +123,7 @@ public void createXmlItem(XmlItem xmlItem) throws ApiException { * @return Boolean * @throws ApiException if fails to make API call */ - public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + public Boolean fakeOuterBooleanSerialize (Boolean body) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -143,24 +143,23 @@ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "fakeOuterBooleanSerialize call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "fakeOuterBooleanSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Boolean>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -172,7 +171,7 @@ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { * @return OuterComposite * @throws ApiException if fails to make API call */ - public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + public OuterComposite fakeOuterCompositeSerialize (OuterComposite body) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -192,24 +191,23 @@ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Ap if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "fakeOuterCompositeSerialize call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "fakeOuterCompositeSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<OuterComposite>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -221,7 +219,7 @@ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Ap * @return BigDecimal * @throws ApiException if fails to make API call */ - public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + public BigDecimal fakeOuterNumberSerialize (BigDecimal body) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -241,24 +239,23 @@ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "fakeOuterNumberSerialize call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "fakeOuterNumberSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<BigDecimal>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -270,7 +267,7 @@ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException * @return String * @throws ApiException if fails to make API call */ - public String fakeOuterStringSerialize(String body) throws ApiException { + public String fakeOuterStringSerialize (String body) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -290,24 +287,23 @@ public String fakeOuterStringSerialize(String body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "fakeOuterStringSerialize call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "fakeOuterStringSerialize call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -318,10 +314,10 @@ public String fakeOuterStringSerialize(String body) throws ApiException { * @param body (required) * @throws ApiException if fails to make API call */ - public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { + public void testBodyWithFileSchema (FileSchemaTestClass body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema"); + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -342,23 +338,22 @@ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testBodyWithFileSchema call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testBodyWithFileSchema call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -370,14 +365,14 @@ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException * @param body (required) * @throws ApiException if fails to make API call */ - public void testBodyWithQueryParams(String query, User body) throws ApiException { + public void testBodyWithQueryParams (String query, User body) throws ApiException { // verify the required parameter 'query' is set if (query == null) { - throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); } // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -407,23 +402,22 @@ public void testBodyWithQueryParams(String query, User body) throws ApiException if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testBodyWithQueryParams call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testBodyWithQueryParams call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -435,10 +429,10 @@ public void testBodyWithQueryParams(String query, User body) throws ApiException * @return Client * @throws ApiException if fails to make API call */ - public Client testClientModel(Client body) throws ApiException { + public Client testClientModel (Client body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); + throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -459,24 +453,23 @@ public Client testClientModel(Client body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testClientModel call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testClientModel call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -500,22 +493,22 @@ public Client testClientModel(Client body) throws ApiException { * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { + public void testEndpointParameters (BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { // verify the required parameter 'number' is set if (number == null) { - throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'number' when calling testEndpointParameters"); } // verify the required parameter '_double' is set if (_double == null) { - throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_double' when calling testEndpointParameters"); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == null) { - throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } // verify the required parameter '_byte' is set if (_byte == null) { - throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); + throw new ApiException(400, "Missing the required parameter '_byte' when calling testEndpointParameters"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -534,23 +527,22 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testEndpointParameters call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testEndpointParameters call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -568,7 +560,7 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call */ - public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { + public void testEnumParameters (List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -604,23 +596,22 @@ public void testEnumParameters(List<String> enumHeaderStringArray, String enumHe if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testEnumParameters call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testEnumParameters call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -636,18 +627,18 @@ public void testEnumParameters(List<String> enumHeaderStringArray, String enumHe * @param int64Group Integer in group parameters (optional) * @throws ApiException if fails to make API call */ - public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { + public void testGroupParameters (Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { // verify the required parameter 'requiredStringGroup' is set if (requiredStringGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredStringGroup' when calling testGroupParameters"); } // verify the required parameter 'requiredBooleanGroup' is set if (requiredBooleanGroup == null) { - throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters"); } // verify the required parameter 'requiredInt64Group' is set if (requiredInt64Group == null) { - throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); + throw new ApiException(400, "Missing the required parameter 'requiredInt64Group' when calling testGroupParameters"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -684,23 +675,22 @@ public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBoo if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testGroupParameters call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testGroupParameters call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -711,10 +701,10 @@ public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBoo * @param param request body (required) * @throws ApiException if fails to make API call */ - public void testInlineAdditionalProperties(Map<String, String> param) throws ApiException { + public void testInlineAdditionalProperties (Map<String, String> param) throws ApiException { // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties"); + throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -735,23 +725,22 @@ public void testInlineAdditionalProperties(Map<String, String> param) throws Api if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testInlineAdditionalProperties call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testInlineAdditionalProperties call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -763,14 +752,14 @@ public void testInlineAdditionalProperties(Map<String, String> param) throws Api * @param param2 field2 (required) * @throws ApiException if fails to make API call */ - public void testJsonFormData(String param, String param2) throws ApiException { + public void testJsonFormData (String param, String param2) throws ApiException { // verify the required parameter 'param' is set if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData"); } // verify the required parameter 'param2' is set if (param2 == null) { - throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); + throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -789,23 +778,22 @@ public void testJsonFormData(String param, String param2) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testJsonFormData call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testJsonFormData call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -820,26 +808,26 @@ public void testJsonFormData(String param, String param2) throws ApiException { * @param context (required) * @throws ApiException if fails to make API call */ - public void testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { + public void testQueryParameterCollectionFormat (List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException { // verify the required parameter 'pipe' is set if (pipe == null) { - throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'pipe' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'ioutil' is set if (ioutil == null) { - throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'ioutil' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'http' is set if (http == null) { - throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'http' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'url' is set if (url == null) { - throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'url' when calling testQueryParameterCollectionFormat"); } // verify the required parameter 'context' is set if (context == null) { - throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); + throw new ApiException(400, "Missing the required parameter 'context' when calling testQueryParameterCollectionFormat"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -871,23 +859,22 @@ public void testQueryParameterCollectionFormat(List<String> pipe, List<String> i if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testQueryParameterCollectionFormat call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testQueryParameterCollectionFormat call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index f687eb0a079b..5b6753d212ea 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -36,6 +36,7 @@ import java.util.Map; + public class FakeClassnameTags123Api { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; @@ -64,10 +65,10 @@ public FakeClassnameTags123Api(ApiClient apiClient) { * @return Client * @throws ApiException if fails to make API call */ - public Client testClassname(Client body) throws ApiException { + public Client testClassname (Client body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -88,24 +89,23 @@ public Client testClassname(Client body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "testClassname call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "testClassname call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java index 678c96814b5d..b8d9fa5c69a6 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/PetApi.java @@ -38,6 +38,7 @@ import java.util.Map; + public class PetApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; @@ -65,10 +66,10 @@ public PetApi(ApiClient apiClient) { * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call */ - public void addPet(Pet body) throws ApiException { + public void addPet (Pet body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -89,23 +90,22 @@ public void addPet(Pet body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "addPet call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "addPet call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -117,10 +117,10 @@ public void addPet(Pet body) throws ApiException { * @param apiKey (optional) * @throws ApiException if fails to make API call */ - public void deletePet(Long petId, String apiKey) throws ApiException { + public void deletePet (Long petId, String apiKey) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -143,23 +143,22 @@ public void deletePet(Long petId, String apiKey) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "deletePet call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "deletePet call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -171,10 +170,10 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @return List<Pet> * @throws ApiException if fails to make API call */ - public List<Pet> findPetsByStatus(List<String> status) throws ApiException { + public List<Pet> findPetsByStatus (List<String> status) throws ApiException { // verify the required parameter 'status' is set if (status == null) { - throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); + throw new ApiException(400, "Missing the required parameter 'status' when calling findPetsByStatus"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -202,24 +201,23 @@ public List<Pet> findPetsByStatus(List<String> status) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "findPetsByStatus call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "findPetsByStatus call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -233,10 +231,10 @@ public List<Pet> findPetsByStatus(List<String> status) throws ApiException { * @deprecated */ @Deprecated - public List<Pet> findPetsByTags(List<String> tags) throws ApiException { + public List<Pet> findPetsByTags (List<String> tags) throws ApiException { // verify the required parameter 'tags' is set if (tags == null) { - throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); + throw new ApiException(400, "Missing the required parameter 'tags' when calling findPetsByTags"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -264,24 +262,23 @@ public List<Pet> findPetsByTags(List<String> tags) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "findPetsByTags call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "findPetsByTags call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -293,10 +290,10 @@ public List<Pet> findPetsByTags(List<String> tags) throws ApiException { * @return Pet * @throws ApiException if fails to make API call */ - public Pet getPetById(Long petId) throws ApiException { + public Pet getPetById (Long petId) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -316,24 +313,23 @@ public Pet getPetById(Long petId) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "getPetById call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "getPetById call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Pet>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -344,10 +340,10 @@ public Pet getPetById(Long petId) throws ApiException { * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call */ - public void updatePet(Pet body) throws ApiException { + public void updatePet (Pet body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -368,23 +364,22 @@ public void updatePet(Pet body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "updatePet call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "updatePet call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -397,10 +392,10 @@ public void updatePet(Pet body) throws ApiException { * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ - public void updatePetWithForm(Long petId, String name, String status) throws ApiException { + public void updatePetWithForm (Long petId, String name, String status) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -420,23 +415,22 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "updatePetWithForm call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "updatePetWithForm call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -450,10 +444,10 @@ public void updatePetWithForm(Long petId, String name, String status) throws Api * @return ModelApiResponse * @throws ApiException if fails to make API call */ - public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { + public ModelApiResponse uploadFile (Long petId, String additionalMetadata, File file) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -473,24 +467,23 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "uploadFile call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "uploadFile call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -504,14 +497,14 @@ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File f * @return ModelApiResponse * @throws ApiException if fails to make API call */ - public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { + public ModelApiResponse uploadFileWithRequiredFile (Long petId, File requiredFile, String additionalMetadata) throws ApiException { // verify the required parameter 'petId' is set if (petId == null) { - throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFileWithRequiredFile"); } // verify the required parameter 'requiredFile' is set if (requiredFile == null) { - throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); + throw new ApiException(400, "Missing the required parameter 'requiredFile' when calling uploadFileWithRequiredFile"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -531,24 +524,23 @@ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "uploadFileWithRequiredFile call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "uploadFileWithRequiredFile call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java index 44de279bccea..b8b5ad93573d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/StoreApi.java @@ -36,6 +36,7 @@ import java.util.Map; + public class StoreApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; @@ -63,10 +64,10 @@ public StoreApi(ApiClient apiClient) { * @param orderId ID of the order that needs to be deleted (required) * @throws ApiException if fails to make API call */ - public void deleteOrder(String orderId) throws ApiException { + public void deleteOrder (String orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -86,23 +87,22 @@ public void deleteOrder(String orderId) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "deleteOrder call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "deleteOrder call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -113,7 +113,7 @@ public void deleteOrder(String orderId) throws ApiException { * @return Map<String, Integer> * @throws ApiException if fails to make API call */ - public Map<String, Integer> getInventory() throws ApiException { + public Map<String, Integer> getInventory () throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -131,24 +131,23 @@ public Map<String, Integer> getInventory() throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "getInventory call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "getInventory call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Map<String, Integer>>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -160,10 +159,10 @@ public Map<String, Integer> getInventory() throws ApiException { * @return Order * @throws ApiException if fails to make API call */ - public Order getOrderById(Long orderId) throws ApiException { + public Order getOrderById (Long orderId) throws ApiException { // verify the required parameter 'orderId' is set if (orderId == null) { - throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); + throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -183,24 +182,23 @@ public Order getOrderById(Long orderId) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "getOrderById call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "getOrderById call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -212,10 +210,10 @@ public Order getOrderById(Long orderId) throws ApiException { * @return Order * @throws ApiException if fails to make API call */ - public Order placeOrder(Order body) throws ApiException { + public Order placeOrder (Order body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -236,24 +234,23 @@ public Order placeOrder(Order body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "placeOrder call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "placeOrder call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java index e5e75b719877..d0f358fee28d 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/UserApi.java @@ -36,6 +36,7 @@ import java.util.Map; + public class UserApi { private final HttpClient memberVarHttpClient; private final ObjectMapper memberVarObjectMapper; @@ -63,10 +64,10 @@ public UserApi(ApiClient apiClient) { * @param body Created user object (required) * @throws ApiException if fails to make API call */ - public void createUser(User body) throws ApiException { + public void createUser (User body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -87,23 +88,22 @@ public void createUser(User body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "createUser call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "createUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -114,10 +114,10 @@ public void createUser(User body) throws ApiException { * @param body List of user object (required) * @throws ApiException if fails to make API call */ - public void createUsersWithArrayInput(List<User> body) throws ApiException { + public void createUsersWithArrayInput (List<User> body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -138,23 +138,22 @@ public void createUsersWithArrayInput(List<User> body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "createUsersWithArrayInput call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "createUsersWithArrayInput call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -165,10 +164,10 @@ public void createUsersWithArrayInput(List<User> body) throws ApiException { * @param body List of user object (required) * @throws ApiException if fails to make API call */ - public void createUsersWithListInput(List<User> body) throws ApiException { + public void createUsersWithListInput (List<User> body) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -189,23 +188,22 @@ public void createUsersWithListInput(List<User> body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "createUsersWithListInput call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "createUsersWithListInput call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -216,10 +214,10 @@ public void createUsersWithListInput(List<User> body) throws ApiException { * @param username The name that needs to be deleted (required) * @throws ApiException if fails to make API call */ - public void deleteUser(String username) throws ApiException { + public void deleteUser (String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -239,23 +237,22 @@ public void deleteUser(String username) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "deleteUser call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "deleteUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -267,10 +264,10 @@ public void deleteUser(String username) throws ApiException { * @return User * @throws ApiException if fails to make API call */ - public User getUserByName(String username) throws ApiException { + public User getUserByName (String username) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); + throw new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -290,24 +287,23 @@ public User getUserByName(String username) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "getUserByName call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "getUserByName call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<User>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -320,14 +316,14 @@ public User getUserByName(String username) throws ApiException { * @return String * @throws ApiException if fails to make API call */ - public String loginUser(String username, String password) throws ApiException { + public String loginUser (String username, String password) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser"); } // verify the required parameter 'password' is set if (password == null) { - throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); + throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -356,24 +352,23 @@ public String loginUser(String username, String password) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "loginUser call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "loginUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - return memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {}); } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -383,7 +378,7 @@ public String loginUser(String username, String password) throws ApiException { * * @throws ApiException if fails to make API call */ - public void logoutUser() throws ApiException { + public void logoutUser () throws ApiException { HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -401,23 +396,22 @@ public void logoutUser() throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "logoutUser call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "logoutUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } @@ -429,14 +423,14 @@ public void logoutUser() throws ApiException { * @param body Updated user object (required) * @throws ApiException if fails to make API call */ - public void updateUser(String username, User body) throws ApiException { + public void updateUser (String username, User body) throws ApiException { // verify the required parameter 'username' is set if (username == null) { - throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } // verify the required parameter 'body' is set if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -458,23 +452,22 @@ public void updateUser(String username, User body) throws ApiException { if (memberVarInterceptor != null) { memberVarInterceptor.accept(localVarRequestBuilder); } - HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send( - localVarRequestBuilder.build(), - HttpResponse.BodyHandlers.ofInputStream()); + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); if (memberVarResponseInterceptor != null) { memberVarResponseInterceptor.accept(localVarResponse); } if (localVarResponse.statusCode()/ 100 != 2) { - throw new ApiException(localVarResponse.statusCode(), - "updateUser call received non-success response", - localVarResponse.headers(), - localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); + throw new ApiException(localVarResponse.statusCode(), + "updateUser call received non-success response", + localVarResponse.headers(), + localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes())); } - } catch (IOException e) { throw new ApiException(e); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ApiException(e); } From f8a7475c7b683798ae6a5ad4ff5b4583981551bb Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Sun, 3 May 2020 16:18:33 +0800 Subject: [PATCH 58/78] update doc, samples --- docs/generators/java.md | 1 + .../client/petstore/go/go-petstore-withXml/client.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/generators/java.md b/docs/generators/java.md index c1e25a2055e4..8b25f67b29fb 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -12,6 +12,7 @@ sidebar_label: java |artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client| |artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator| |artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| +|asyncNative|If true, async handlers will be used, instead of the sync version| |false| |bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| |caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index 5a5a4c852939..6fffa78f8ff9 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" "io" + "io/ioutil" "log" "mime/multipart" "net/http" @@ -382,6 +383,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err From e4cbaa721b28ba5edbe93eaf1b9776367162edee Mon Sep 17 00:00:00 2001 From: Paul Hatcher <phatcher@users.noreply.github.com> Date: Sun, 3 May 2020 09:32:26 +0100 Subject: [PATCH 59/78] Implement Asp.Net Core 3.0/3.1 generator (#6009) (#6025) * Minor changes to 2.1 templates to make them work or improve documentation * Support for ASP.NET Core 3.0 and 3.1 * Update aspnetcore test scripts and results * Update generated documentation * update doc * Update modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache Co-Authored-By: Tatsuro Shibamura <me@shibayan.jp> * Update modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache Co-Authored-By: Tatsuro Shibamura <me@shibayan.jp> Co-authored-by: William Cheng <wing328hk@gmail.com> Co-authored-by: Tatsuro Shibamura <me@shibayan.jp> --- bin/aspnetcore3-petstore-server.sh | 32 + bin/windows/aspnetcore3-petstore-server.bat | 10 + docs/generators/aspnetcore.md | 10 +- .../languages/AspNetCoreServerCodegen.java | 52 +- .../Authentication/ApiAuthentication.mustache | 36 +- .../aspnetcore/2.1/Project.csproj.mustache | 2 +- .../resources/aspnetcore/2.1/README.mustache | 2 +- .../resources/aspnetcore/2.1/Startup.mustache | 6 +- .../Authentication/ApiAuthentication.mustache | 71 ++ .../aspnetcore/3.0/Dockerfile.mustache | 32 + .../3.0/Filters/BasePathFilter.mustache | 50 + ...eneratePathParamsValidationFilter.mustache | 98 ++ .../3.0/OpenApi/TypeExtensions.mustache | 51 + .../resources/aspnetcore/3.0/Program.mustache | 33 + .../aspnetcore/3.0/Project.csproj.mustache | 47 + .../aspnetcore/3.0/Project.nuspec.mustache | 20 + .../3.0/Properties/launchSettings.json | 37 + .../resources/aspnetcore/3.0/README.mustache | 28 + .../aspnetcore/3.0/Solution.mustache | 22 + .../resources/aspnetcore/3.0/Startup.mustache | 162 +++ .../3.0/appsettings.Development.json | 9 + .../resources/aspnetcore/3.0/appsettings.json | 8 + .../aspnetcore/3.0/bodyParam.mustache | 1 + .../aspnetcore/3.0/build.bat.mustache | 9 + .../aspnetcore/3.0/build.sh.mustache | 8 + .../aspnetcore/3.0/controller.mustache | 81 ++ .../aspnetcore/3.0/enumClass.mustache | 19 + .../aspnetcore/3.0/formParam.mustache | 1 + .../main/resources/aspnetcore/3.0/gitignore | 208 ++++ .../aspnetcore/3.0/headerParam.mustache | 1 + .../aspnetcore/3.0/listReturn.mustache | 4 + .../aspnetcore/3.0/mapReturn.mustache | 4 + .../resources/aspnetcore/3.0/model.mustache | 154 +++ .../aspnetcore/3.0/objectReturn.mustache | 4 + .../aspnetcore/3.0/partial_header.mustache | 13 + .../aspnetcore/3.0/pathParam.mustache | 1 + .../aspnetcore/3.0/queryParam.mustache | 1 + .../resources/aspnetcore/3.0/tags.mustache | 1 + .../aspnetcore/3.0/typeConverter.mustache | 42 + .../aspnetcore/3.0/validateModel.mustache | 61 + .../aspnetcore/3.0/wwwroot/README.md | 42 + .../aspnetcore/3.0/wwwroot/index.html | 1 + .../3.0/wwwroot/openapi-original.mustache | 1 + .../aspnetcore/3.0/wwwroot/web.config | 9 + .../aspnetcore/.openapi-generator/VERSION | 2 +- samples/server/petstore/aspnetcore/README.md | 2 +- .../Authentication/ApiAuthentication.cs | 29 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 2 +- .../src/Org.OpenAPITools/Startup.cs | 3 +- .../aspnetcore3/.openapi-generator-ignore | 23 + .../aspnetcore3/.openapi-generator/VERSION | 1 + .../petstore/aspnetcore3/Org.OpenAPITools.sln | 22 + samples/server/petstore/aspnetcore3/README.md | 24 + samples/server/petstore/aspnetcore3/build.bat | 9 + samples/server/petstore/aspnetcore3/build.sh | 8 + .../src/Org.OpenAPITools/.gitignore | 208 ++++ .../Attributes/ValidateModelStateAttribute.cs | 61 + .../Authentication/ApiAuthentication.cs | 63 + .../Org.OpenAPITools/Controllers/PetApi.cs | 232 ++++ .../Org.OpenAPITools/Controllers/StoreApi.cs | 139 +++ .../Org.OpenAPITools/Controllers/UserApi.cs | 207 ++++ .../Converters/CustomEnumConverter.cs | 42 + .../src/Org.OpenAPITools/Dockerfile | 32 + .../Filters/BasePathFilter.cs | 50 + .../GeneratePathParamsValidationFilter.cs | 98 ++ .../Org.OpenAPITools/Models/ApiResponse.cs | 147 +++ .../src/Org.OpenAPITools/Models/Category.cs | 133 +++ .../src/Org.OpenAPITools/Models/Order.cs | 219 ++++ .../src/Org.OpenAPITools/Models/Pet.cs | 223 ++++ .../src/Org.OpenAPITools/Models/Tag.cs | 133 +++ .../src/Org.OpenAPITools/Models/User.cs | 218 ++++ .../OpenApi/TypeExtensions.cs | 51 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 24 + .../src/Org.OpenAPITools/Program.cs | 33 + .../Properties/launchSettings.json | 37 + .../src/Org.OpenAPITools/Startup.cs | 159 +++ .../src/Org.OpenAPITools/appsettings.json | 8 + .../src/Org.OpenAPITools/wwwroot/README.md | 42 + .../src/Org.OpenAPITools/wwwroot/index.html | 1 + .../wwwroot/openapi-original.json | 1012 +++++++++++++++++ .../src/Org.OpenAPITools/wwwroot/web.config | 9 + 81 files changed, 5139 insertions(+), 51 deletions(-) create mode 100644 bin/aspnetcore3-petstore-server.sh create mode 100644 bin/windows/aspnetcore3-petstore-server.bat create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Authentication/ApiAuthentication.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Dockerfile.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/BasePathFilter.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/GeneratePathParamsValidationFilter.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/OpenApi/TypeExtensions.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.csproj.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.nuspec.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Properties/launchSettings.json create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Solution.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.Development.json create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.json create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/bodyParam.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.bat.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.sh.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/enumClass.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/gitignore create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/headerParam.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/listReturn.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/mapReturn.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/objectReturn.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/partial_header.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/tags.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/typeConverter.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/validateModel.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/README.md create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/index.html create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/openapi-original.mustache create mode 100644 modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/web.config create mode 100644 samples/server/petstore/aspnetcore3/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnetcore3/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnetcore3/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnetcore3/README.md create mode 100644 samples/server/petstore/aspnetcore3/build.bat create mode 100644 samples/server/petstore/aspnetcore3/build.sh create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/.gitignore create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/PetApi.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/StoreApi.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/UserApi.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Dockerfile create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/BasePathFilter.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Startup.cs create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/README.md create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/index.html create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/openapi-original.json create mode 100644 samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/web.config diff --git a/bin/aspnetcore3-petstore-server.sh b/bin/aspnetcore3-petstore-server.sh new file mode 100644 index 000000000000..56c3be609ced --- /dev/null +++ b/bin/aspnetcore3-petstore-server.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore3 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/aspnetcore3-petstore-server.bat b/bin/windows/aspnetcore3-petstore-server.bat new file mode 100644 index 000000000000..8e5e78ad4002 --- /dev/null +++ b/bin/windows/aspnetcore3-petstore-server.bat @@ -0,0 +1,10 @@ +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 -DloggerPath=conf/log4j.properties +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g aspnetcore -o samples\server\petstore\aspnetcore3\ --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/docs/generators/aspnetcore.md b/docs/generators/aspnetcore.md index f407544ff306..a33bb615a2b2 100644 --- a/docs/generators/aspnetcore.md +++ b/docs/generators/aspnetcore.md @@ -5,7 +5,7 @@ sidebar_label: aspnetcore | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | -|aspnetCoreVersion|ASP.NET Core version: 3.0 (preview4 only), 2.2, 2.1, 2.0 (deprecated)| |2.2| +|aspnetCoreVersion|ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)| |2.2| |buildTarget|Target to build an application or library| |program| |classModifier|Class Modifier can be empty, abstract| || |compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2| @@ -16,7 +16,7 @@ sidebar_label: aspnetcore |licenseName|The name of the license| |NoLicense| |licenseUrl|The URL of the license| |http://localhost| |modelClassModifier|Model Class Modifier can be nothing or partial| |partial| -|newtonsoftVersion|Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+| |3.0.0-preview5-19227-01| +|newtonsoftVersion|Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+| |3.0.0| |operationIsAsync|Set methods to async or sync (default).| |false| |operationModifier|Operation Modifier can be virtual, abstract or partial| |virtual| |operationResultTask|Set methods result to Task<>.| |false| @@ -29,11 +29,11 @@ sidebar_label: aspnetcore |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| -|swashbuckleVersion|Swashbucke version: 3.0.0, 4.0.0| |3.0.0| +|swashbuckleVersion|Swashbuckle version: 3.0.0, 4.0.0, 5.0.0| |3.0.0| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| -|useDefaultRouting|Use default routing for the ASP.NET Core version. For 3.0 turn off default because it is not yet supported.| |true| -|useFrameworkReference|Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.| |false| +|useDefaultRouting|Use default routing for the ASP.NET Core version.| |true| +|useFrameworkReference|Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.| |false| |useNewtonsoft|Uses the Newtonsoft JSON library.| |true| |useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |true| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java index 66fe43864a7b..c39677a10216 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java @@ -60,6 +60,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { public static final String NEWTONSOFT_VERSION = "newtonsoftVersion"; private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}"; + private String userSecretsGuid = randomUUID().toString(); @SuppressWarnings("hiding") protected Logger LOGGER = LoggerFactory.getLogger(AspNetCoreServerCodegen.class); @@ -67,9 +68,8 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { private boolean useSwashbuckle = true; protected int serverPort = 8080; protected String serverHost = "0.0.0.0"; - protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbucke version: 3.0.0, 4.0.0"); - ; // default to 2.1 - protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.0 (preview4 only), 2.2, 2.1, 2.0 (deprecated)"); + protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0"); + protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)"); private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier can be empty, abstract"); private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual, abstract or partial"); private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial"); @@ -83,7 +83,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { private boolean useFrameworkReference = false; private boolean useNewtonsoft = true; private boolean useDefaultRouting = true; - private String newtonsoftVersion = "3.0.0-preview5-19227-01"; + private String newtonsoftVersion = "3.0.0"; public AspNetCoreServerCodegen() { super(); @@ -186,10 +186,11 @@ public AspNetCoreServerCodegen() { addOption(COMPATIBILITY_VERSION, "ASP.Net Core CompatibilityVersion", compatibilityVersion); - aspnetCoreVersion.addEnum("2.0", "ASP.NET COre 2.0"); + aspnetCoreVersion.addEnum("2.0", "ASP.NET Core 2.0"); aspnetCoreVersion.addEnum("2.1", "ASP.NET Core 2.1"); aspnetCoreVersion.addEnum("2.2", "ASP.NET Core 2.2"); aspnetCoreVersion.addEnum("3.0", "ASP.NET Core 3.0"); + aspnetCoreVersion.addEnum("3.1", "ASP.NET Core 3.1"); aspnetCoreVersion.setDefault("2.2"); aspnetCoreVersion.setOptValue(aspnetCoreVersion.getDefault()); addOption(aspnetCoreVersion.getOpt(), aspnetCoreVersion.getDescription(), aspnetCoreVersion.getOptValue()); @@ -227,7 +228,7 @@ public AspNetCoreServerCodegen() { isLibrary); addSwitch(USE_FRAMEWORK_REFERENCE, - "Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.", + "Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.", useFrameworkReference); addSwitch(USE_NEWTONSOFT, @@ -239,7 +240,7 @@ public AspNetCoreServerCodegen() { newtonsoftVersion); addSwitch(USE_DEFAULT_ROUTING, - "Use default routing for the ASP.NET Core version. For 3.0 turn off default because it is not yet supported.", + "Use default routing for the ASP.NET Core version.", useDefaultRouting); addOption(CodegenConstants.ENUM_NAME_SUFFIX, @@ -263,7 +264,7 @@ public AspNetCoreServerCodegen() { addOption(operationModifier.getOpt(), operationModifier.getDescription(), operationModifier.getOptValue()); buildTarget.addEnum("program", "Generate code for a standalone server"); - buildTarget.addEnum("library", "Generate code for a server abstract class lbrary"); + buildTarget.addEnum("library", "Generate code for a server abstract class library"); buildTarget.setDefault("program"); buildTarget.setOptValue(buildTarget.getDefault()); addOption(buildTarget.getOpt(), buildTarget.getDescription(), buildTarget.getOptValue()); @@ -286,7 +287,6 @@ public AspNetCoreServerCodegen() { modelClassModifier.setDefault("partial"); modelClassModifier.setOptValue(modelClassModifier.getDefault()); addOption(modelClassModifier.getOpt(), modelClassModifier.getDescription(), modelClassModifier.getOptValue()); - } @Override @@ -320,6 +320,7 @@ public void processOpts() { setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID)); } additionalProperties.put("packageGuid", packageGuid); + additionalProperties.put("userSecretsGuid", userSecretsGuid); if (!additionalProperties.containsKey(NEWTONSOFT_VERSION)) { additionalProperties.put(NEWTONSOFT_VERSION, newtonsoftVersion); @@ -367,6 +368,9 @@ public void processOpts() { supportingFiles.add(new SupportingFile("gitignore", packageFolder, ".gitignore")); supportingFiles.add(new SupportingFile("validateModel.mustache", packageFolder + File.separator + "Attributes", "ValidateModelStateAttribute.cs")); supportingFiles.add(new SupportingFile("typeConverter.mustache", packageFolder + File.separator + "Converters", "CustomEnumConverter.cs")); + if (aspnetCoreVersion.getOptValue().startsWith("3.")) { + supportingFiles.add(new SupportingFile("OpenApi" + File.separator + "TypeExtensions.mustache", packageFolder + File.separator + "OpenApi", "TypeExtensions.cs")); + } supportingFiles.add(new SupportingFile("Project.csproj.mustache", packageFolder, packageName + ".csproj")); if (!isLibrary) { supportingFiles.add(new SupportingFile("Dockerfile.mustache", packageFolder, "Dockerfile")); @@ -532,19 +536,34 @@ private void setBuildTarget() { private void setAspnetCoreVersion(String packageFolder) { setCliOption(aspnetCoreVersion); - if ("2.0".equals(aspnetCoreVersion.getOptValue())) { - embeddedTemplateDir = templateDir = "aspnetcore/2.0"; + + if (aspnetCoreVersion.getOptValue().startsWith("3.")) { + compatibilityVersion = null; + } else if ("2.0".equals(aspnetCoreVersion.getOptValue())) { supportingFiles.add(new SupportingFile("web.config", packageFolder, "web.config")); - LOGGER.info("ASP.NET core version: 2.0"); compatibilityVersion = null; } else { // default, do nothing - LOGGER.info("ASP.NET core version: " + aspnetCoreVersion.getOptValue()); compatibilityVersion = "Version_" + aspnetCoreVersion.getOptValue().replace(".", "_"); } + LOGGER.info("ASP.NET core version: " + aspnetCoreVersion.getOptValue()); + embeddedTemplateDir = templateDir = "aspnetcore/" + determineTemplateVersion(aspnetCoreVersion.getOptValue()); additionalProperties.put(COMPATIBILITY_VERSION, compatibilityVersion); } + private String determineTemplateVersion(String frameworkVersion) { + switch (frameworkVersion) { + case "3.1": + return "3.0"; + + case "2.2": + return "2.1"; + + default: + return frameworkVersion; + } + } + private void setUseSwashbuckle() { if (isLibrary) { LOGGER.warn("buildTarget is " + buildTarget.getOptValue() + " so changing default isLibrary to false "); @@ -572,7 +591,7 @@ private void setOperationIsAsync() { private void setIsFramework() { if (aspnetCoreVersion.getOptValue().startsWith("3.")) {// default, do nothing - LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing to use frameworkReference instead of packageReference "); + LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing to use frameworkReference instead of packageReference "); useFrameworkReference = true; additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference); } else { @@ -582,7 +601,6 @@ private void setIsFramework() { additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference); } } - } private void setUseNewtonsoft() { @@ -617,8 +635,8 @@ private void setSwashbuckleVersion() { setCliOption(swashbuckleVersion); if (aspnetCoreVersion.getOptValue().startsWith("3.")) { - LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing default Swashbuckle version to 4.0.0."); - swashbuckleVersion.setOptValue("4.0.0"); + LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing default Swashbuckle version to 5.0.0."); + swashbuckleVersion.setOptValue("5.0.0"); additionalProperties.put(SWASHBUCKLE_VERSION, swashbuckleVersion.getOptValue()); } else { // default, do nothing diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache index 8f266775e131..755fefbd5064 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache @@ -7,12 +7,26 @@ using System.Threading.Tasks; namespace {{packageName}}.Authentication { + /// <summary> + /// A requirement that an ApiKey must be present. + /// </summary> public class ApiKeyRequirement : IAuthorizationRequirement { - public IReadOnlyList<string> ApiKeys { get; set; } - - public string PolicyName { get; set; } + /// <summary> + /// Get the list of api keys + /// </summary> + public IReadOnlyList<string> ApiKeys { get; } + /// <summary> + /// Get the policy name, + /// </summary> + public string PolicyName { get; } + + /// <summary> + /// Create a new instance of the <see cref="ApiKeyRequirement"/> class. + /// </summary> + /// <param name="apiKeys"></param> + /// <param name="policyName"></param> public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) { ApiKeys = apiKeys?.ToList() ?? new List<string>(); @@ -20,9 +34,12 @@ namespace {{packageName}}.Authentication } } + /// <summary> + /// Enforce that an api key is present. + /// </summary> public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement> { - + /// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" /> protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) { SucceedRequirementIfApiKeyPresentAndValid(context, requirement); @@ -32,27 +49,22 @@ namespace {{packageName}}.Authentication private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) { {{#authMethods}}{{#isApiKey}} -{{#-first}} if (context.Resource is AuthorizationFilterContext authorizationFilterContext) { - var apiKey = ""; -{{/-first}} {{#isKeyInHeader}} - apiKey = authorizationFilterContext.HttpContext.Request.Headers["{{keyParamName}}"].FirstOrDefault(); + var apiKey = authorizationFilterContext.HttpContext.Request.Headers["{{keyParamName}}"].FirstOrDefault(); {{/isKeyInHeader}} {{#isKeyInQuery}} - apiKey = authorizationFilterContext.HttpContext.Request.Query["{{keyParamName}}"].FirstOrDefault(); + var apiKey = authorizationFilterContext.HttpContext.Request.Query["{{keyParamName}}"].FirstOrDefault(); {{/isKeyInQuery}} {{#isKeyInCookie}} - apiKey = authorizationFilterContext.HttpContext.Request.Cookies["{{keyParamName}}"] ?? null; + var apiKey = authorizationFilterContext.HttpContext.Request.Cookies["{{keyParamName}}"] ?? null; {{/isKeyInCookie}} if (requirement.PolicyName == "{{name}}" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) { context.Succeed(requirement); } -{{#-last}} } -{{/-last}} {{/isApiKey}}{{/authMethods}} } } diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache index a7b6b35bd78a..963dad63749b 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache @@ -29,6 +29,6 @@ {{/useSwashbuckle}} </ItemGroup> <ItemGroup> - <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" /> + <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" /> </ItemGroup> </Project> diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache index d7582331bc02..c5673ac9d1db 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache @@ -1,4 +1,4 @@ -# {{packageName}} - ASP.NET Core 2.0 Server +# {{packageName}} - ASP.NET Core {{aspnetCoreVersion}} Server {{#appDescriptionWithNewLines}} {{{appDescriptionWithNewLines}}} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache index 744a282fee1f..e3701048a274 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache @@ -44,17 +44,13 @@ namespace {{packageName}} { {{#authMethods}} {{#isApiKey}} -{{#-first}} services.AddTransient<IAuthorizationHandler, ApiKeyRequirementHandler>(); services.AddAuthorization(authConfig => { -{{/-first}} authConfig.AddPolicy("{{name}}", policyBuilder => policyBuilder .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"{{name}}"))); -{{#-last}} }); -{{/-last}} {{/isApiKey}} {{/authMethods}} @@ -81,7 +77,7 @@ namespace {{packageName}} { Version = "{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}", Title = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}", - Description = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} (ASP.NET Core 2.0)", + Description = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} (ASP.NET Core {{aspnetCoreVersion}})", Contact = new Contact() { Name = "{{#infoName}}{{{infoName}}}{{/infoName}}{{^infoName}}OpenAPI-Generator Contributors{{/infoName}}", diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Authentication/ApiAuthentication.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Authentication/ApiAuthentication.mustache new file mode 100644 index 000000000000..a9de368316d4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Authentication/ApiAuthentication.mustache @@ -0,0 +1,71 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc.Filters; + +namespace {{packageName}}.Authentication +{ + /// <summary> + /// A requirement that an ApiKey must be present. + /// </summary> + public class ApiKeyRequirement : IAuthorizationRequirement + { + /// <summary> + /// Get the list of api keys + /// </summary> + public IReadOnlyList<string> ApiKeys { get; } + + /// <summary> + /// Get the policy name, + /// </summary> + public string PolicyName { get; } + + /// <summary> + /// Create a new instance of the <see cref="ApiKeyRequirement"/> class. + /// </summary> + /// <param name="apiKeys"></param> + /// <param name="policyName"></param> + public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) + { + ApiKeys = apiKeys?.ToList() ?? new List<string>(); + PolicyName = policyName; + } + } + + /// <summary> + /// Enforce that an api key is present. + /// </summary> + public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement> + { + /// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" /> + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + SucceedRequirementIfApiKeyPresentAndValid(context, requirement); + return Task.CompletedTask; + } + + private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { +{{#authMethods}}{{#isApiKey}} + if (context.Resource is AuthorizationFilterContext authorizationFilterContext) + { +{{#isKeyInHeader}} + var apiKey = authorizationFilterContext.HttpContext.Request.Headers["{{keyParamName}}"].FirstOrDefault(); +{{/isKeyInHeader}} +{{#isKeyInQuery}} + var apiKey = authorizationFilterContext.HttpContext.Request.Query["{{keyParamName}}"].FirstOrDefault(); +{{/isKeyInQuery}} +{{#isKeyInCookie}} + var apiKey = authorizationFilterContext.HttpContext.Request.Cookies["{{keyParamName}}"] ?? null; +{{/isKeyInCookie}} + if (requirement.PolicyName == "{{name}}" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) + { + context.Succeed(requirement); + } + } +{{/isApiKey}}{{/authMethods}} + } + } +} + diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Dockerfile.mustache new file mode 100644 index 000000000000..ceb80c4f3043 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Dockerfile.mustache @@ -0,0 +1,32 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# Container we use for final publish +FROM mcr.microsoft.com/dotnet/core/aspnet:{{aspnetCoreVersion}}-buster-slim AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +# Build container +FROM mcr.microsoft.com/dotnet/core/sdk:{{aspnetCoreVersion}}-buster AS build + +# Copy the code into the container +WORKDIR /{{sourceFolder}} +COPY ["{{sourceFolder}}/{{packageName}}/{{packageName}}.csproj", "{{packageName}}/"] + +# NuGet restore +RUN dotnet restore "{{packageName}}/{{packageName}}.csproj" +COPY ["{{sourceFolder}}/{{packageName}}/", "{{packageName}}/"] + +# Build the API +WORKDIR "{{packageName}}" +RUN dotnet build "{{packageName}}.csproj" -c Release -o /app/build + +# Publish it +FROM build AS publish +RUN dotnet publish "{{packageName}}.csproj" -c Release -o /app/publish + +# Make the final image for publishing +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "{{packageName}}.dll"] diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/BasePathFilter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/BasePathFilter.mustache new file mode 100644 index 000000000000..8faa0782461f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/BasePathFilter.mustache @@ -0,0 +1,50 @@ +using System.Linq; +using System.Text.RegularExpressions; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace {{packageName}}.Filters +{ + /// <summary> + /// BasePath Document Filter sets BasePath property of Swagger and removes it from the individual URL paths + /// </summary> + public class BasePathFilter : IDocumentFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="basePath">BasePath to remove from Operations</param> + public BasePathFilter(string basePath) + { + BasePath = basePath; + } + + /// <summary> + /// Gets the BasePath of the Swagger Doc + /// </summary> + /// <returns>The BasePath of the Swagger Doc</returns> + public string BasePath { get; } + + /// <summary> + /// Apply the filter + /// </summary> + /// <param name="swaggerDoc">SwaggerDocument</param> + /// <param name="context">FilterContext</param> + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + //swaggerDoc.BasePath = BasePath; + + var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList(); + + foreach (var (key, value) in pathsToModify) + { + if (key.StartsWith(BasePath)) + { + var newKey = Regex.Replace(key, $"^{BasePath}", string.Empty); + swaggerDoc.Paths.Remove(key); + swaggerDoc.Paths.Add(newKey, value); + } + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/GeneratePathParamsValidationFilter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/GeneratePathParamsValidationFilter.mustache new file mode 100644 index 000000000000..88861304c394 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Filters/GeneratePathParamsValidationFilter.mustache @@ -0,0 +1,98 @@ +using System.ComponentModel.DataAnnotations; +using System.Linq; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace {{packageName}}.Filters +{ + /// <summary> + /// Path Parameter Validation Rules Filter + /// </summary> + public class GeneratePathParamsValidationFilter : IOperationFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="operation">Operation</param> + /// <param name="context">OperationFilterContext</param> + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + var pars = context.ApiDescription.ParameterDescriptions; + + foreach (var par in pars) + { + var swaggerParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); + + var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes.ToList(); + + // See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1147 + // and https://mikeralphson.github.io/openapi/2017/03/15/openapi3.0.0-rc0 + // Basically OpenAPI v3 body parameters are split out into RequestBody and the properties have moved to schema + if (attributes.Any() && swaggerParam != null) + { + // Required - [Required] + var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); + if (requiredAttr != null) + { + swaggerParam.Required = true; + } + + // Regex Pattern [RegularExpression] + var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); + if (regexAttr != null) + { + var regex = (string)regexAttr.ConstructorArguments[0].Value; + swaggerParam.Schema.Pattern = regex; + } + + // String Length [StringLength] + int? minLength = null, maxLength = null; + var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); + if (stringLengthAttr != null) + { + if (stringLengthAttr.NamedArguments.Count == 1) + { + minLength = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; + } + maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value; + } + + var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); + if (minLengthAttr != null) + { + minLength = (int)minLengthAttr.ConstructorArguments[0].Value; + } + + var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); + if (maxLengthAttr != null) + { + maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value; + } + + if (minLength != null) + { + swaggerParam.Schema.MinLength = minLength; + } + + if (maxLength != null) + { + swaggerParam.Schema.MaxLength = maxLength; + } + + // Range [Range] + var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); + if (rangeAttr != null) + { + var rangeMin = (int)rangeAttr.ConstructorArguments[0].Value; + var rangeMax = (int)rangeAttr.ConstructorArguments[1].Value; + + swaggerParam.Schema.MinLength = rangeMin; + swaggerParam.Schema.MaxLength = rangeMax; + } + } + } + } + } +} + diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/OpenApi/TypeExtensions.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/OpenApi/TypeExtensions.mustache new file mode 100644 index 000000000000..df00a93e8c62 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/OpenApi/TypeExtensions.mustache @@ -0,0 +1,51 @@ +using System; +using System.Linq; +using System.Text; + +namespace {{packageName}}.OpenApi +{ + /// <summary> + /// Replacement utilities from Swashbuckle.AspNetCore.SwaggerGen which are not in 5.x + /// </summary> + public static class TypeExtensions + { + /// <summary> + /// Produce a friendly name for the type which is unique. + /// </summary> + /// <param name="type"></param> + /// <param name="fullyQualified"></param> + public static string FriendlyId(this Type type, bool fullyQualified = false) + { + var typeName = fullyQualified + ? type.FullNameSansTypeParameters().Replace("+", ".") + : type.Name; + + if (type.IsGenericType) + { + var genericArgumentIds = type.GetGenericArguments() + .Select(t => t.FriendlyId(fullyQualified)) + .ToArray(); + + return new StringBuilder(typeName) + .Replace($"`{genericArgumentIds.Count()}", string.Empty) + .Append($"[{string.Join(",", genericArgumentIds).TrimEnd(',')}]") + .ToString(); + } + + return typeName; + } + + /// <summary> + /// Determine the fully qualified type name without type parameters. + /// </summary> + /// <param name="type"></param> + public static string FullNameSansTypeParameters(this Type type) + { + var fullName = type.FullName; + if (string.IsNullOrEmpty(fullName)) + fullName = type.Name; + var chopIndex = fullName.IndexOf("[[", StringComparison.Ordinal); + return (chopIndex == -1) ? fullName : fullName.Substring(0, chopIndex); + } + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache new file mode 100644 index 000000000000..3689e61e6de9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace {{packageName}} +{ + /// <summary> + /// Program + /// </summary> + public class Program + { + /// <summary> + /// Main + /// </summary> + /// <param name="args"></param> + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + /// <summary> + /// Create the host builder. + /// </summary> + /// <param name="args"></param> + /// <returns>IHostBuilder</returns> + public static IHostBuilder CreateWebHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup<Startup>() + .UseUrls("http://0.0.0.0:{{#serverPort}}{{serverPort}}{{/serverPort}}{{^serverPort}}8080{{/serverPort}}/"); + }); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.csproj.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.csproj.mustache new file mode 100644 index 000000000000..83036fc53a7e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.csproj.mustache @@ -0,0 +1,47 @@ +<Project Sdk="{{projectSdk}}"> + <PropertyGroup> + <Description>{{packageName}}</Description> + <Copyright>{{packageName}}</Copyright> + <TargetFramework>netcoreapp{{aspnetCoreVersion}}</TargetFramework> + <GenerateDocumentationFile>true</GenerateDocumentationFile> + <PreserveCompilationContext>true</PreserveCompilationContext> +{{#isLibrary}} + <OutputType>Library</OutputType> +{{/isLibrary}} + <AssemblyName>{{packageName}}</AssemblyName> + <PackageId>{{packageName}}</PackageId> + <UserSecretsId>{{userSecretsGuid}}</UserSecretsId> + <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> + <DockerfileContext>..\..</DockerfileContext> + </PropertyGroup> + <ItemGroup> +{{#useFrameworkReference}} +{{#isLibrary}} + <FrameworkReference Include="Microsoft.AspNetCore.App" /> +{{/isLibrary}} +{{/useFrameworkReference}} +{{^useFrameworkReference}} + <PackageReference Include="Microsoft.AspNetCore.App" /> +{{/useFrameworkReference}} + <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="{{aspnetCoreVersion}}.0"/> +{{#useSwashbuckle}} + <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" /> +{{#useNewtonsoft}} + <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="{{swashbuckleVersion}}"/> + <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="{{swashbuckleVersion}}"/> +{{/useNewtonsoft}} +{{^useNewtonsoft}} + <PackageReference Include="Swashbuckle.AspNetCore" Version="{{swashbuckleVersion}}"/> +{{/useNewtonsoft}} + <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="{{swashbuckleVersion}}" /> +{{/useSwashbuckle}} +{{^useSwashbuckle}} +{{#useNewtonsoft}} + <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="{{newtonsoftVersion}}" /> +{{/useNewtonsoft}} +{{/useSwashbuckle}} + </ItemGroup> + <ItemGroup> + <!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="{{aspnetCoreVersion}}.0" />--> + </ItemGroup> +</Project> diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.nuspec.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.nuspec.mustache new file mode 100644 index 000000000000..03490d711296 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Project.nuspec.mustache @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<package > + <metadata> + <id>$id$</id> + <version>{{packageVersion}}</version> + <title>{{packageTitle}}</title> + <authors>{{packageAuthors}}</authors> + <owners>{{packageAuthors}}</owners> + <licenseUrl>{{licenseUrl}}</licenseUrl> + <!-- + <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl> + <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl> + --> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <description>{{packageName}}</description> + <releaseNotes>Summary of changes made in this release of the package.</releaseNotes> + <copyright>{{packageCopyright}}</copyright> + <tags>{{packageName}}</tags> + </metadata> +</package> diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Properties/launchSettings.json b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Properties/launchSettings.json new file mode 100644 index 000000000000..57b03cc43aa3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Properties/launchSettings.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61788", + "sslPort": 44301 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OpenAPI": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/README.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/README.mustache new file mode 100644 index 000000000000..c5673ac9d1db --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/README.mustache @@ -0,0 +1,28 @@ +# {{packageName}} - ASP.NET Core {{aspnetCoreVersion}} Server + +{{#appDescriptionWithNewLines}} +{{{appDescriptionWithNewLines}}} +{{/appDescriptionWithNewLines}} + +## Run + +Linux/OS X: + +``` +sh build.sh +``` + +Windows: + +``` +build.bat +``` +{{^isLibrary}} +## Run in Docker + +``` +cd {{sourceFolder}}/{{packageName}} +docker build -t {{dockerTag}} . +docker run -p 5000:8080 {{dockerTag}} +``` +{{/isLibrary}} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Solution.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Solution.mustache new file mode 100644 index 000000000000..8c6d69ea93da --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Solution.mustache @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2043 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{packageName}}", "{{sourceFolder}}\{{packageName}}\{{packageName}}.csproj", "{{packageGuid}}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {{packageGuid}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {{packageGuid}}.Debug|Any CPU.Build.0 = Debug|Any CPU + {{packageGuid}}.Release|Any CPU.ActiveCfg = Release|Any CPU + {{packageGuid}}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache new file mode 100644 index 000000000000..dbca972d966c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Startup.mustache @@ -0,0 +1,162 @@ +{{>partial_header}} +using System; +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +{{#useSwashbuckle}} +using Microsoft.OpenApi.Models; +{{/useSwashbuckle}} +{{#useNewtonsoft}} +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Serialization; +{{/useNewtonsoft}} +using {{packageName}}.Authentication; +{{#useSwashbuckle}} +using {{packageName}}.Filters; +{{/useSwashbuckle}} +using {{packageName}}.OpenApi; + +namespace {{packageName}} +{ + /// <summary> + /// Startup + /// </summary> + public class Startup + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="env"></param> + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + /// <summary> + /// The application configuration. + /// </summary> + public IConfiguration Configuration { get; } + + /// <summary> + /// This method gets called by the runtime. Use this method to add services to the container. + /// </summary> + /// <param name="services"></param> + public void ConfigureServices(IServiceCollection services) + { +{{#authMethods}} +{{#isApiKey}} + services.AddTransient<IAuthorizationHandler, ApiKeyRequirementHandler>(); + services.AddAuthorization(authConfig => + { + authConfig.AddPolicy("{{name}}", policyBuilder => + { + policyBuilder + .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"{{name}}")); + }); + }); +{{/isApiKey}} +{{/authMethods}} + + // Add framework services. + services + // Don't need the full MVC stack for an API, see https://andrewlock.net/comparing-startup-between-the-asp-net-core-3-templates/ + .AddControllers() + {{#compatibilityVersion}} + // Don't need this for 3.x - see https://docs.microsoft.com/en-us/aspnet/core/mvc/compatibility-version?view=aspnetcore-3.1 + //.SetCompatibilityVersion(CompatibilityVersion.{{compatibilityVersion}}) + {{/compatibilityVersion}} + .{{#useNewtonsoft}}AddNewtonsoftJson{{/useNewtonsoft}}{{^useNewtonsoft}}AddJsonOptions{{/useNewtonsoft}}(opts => + { + opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + opts.SerializerSettings.Converters.Add(new StringEnumConverter + { + {{#useNewtonsoft}}NamingStrategy = new CamelCaseNamingStrategy(){{/useNewtonsoft}}{{^useNewtonsoft}}CamelCaseText = true{{/useNewtonsoft}} + }); + }); +{{#useSwashbuckle}} + + services + .AddSwaggerGen(c => + { + c.SwaggerDoc("{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}", new OpenApiInfo + { + Title = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}", + Description = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} (ASP.NET Core {{aspnetCoreVersion}})", + TermsOfService = new Uri("{{#termsOfService}}{{{termsOfService}}}{{/termsOfService}}{{^termsOfService}}https://github.com/openapitools/openapi-generator{{/termsOfService}}"), + Contact = new OpenApiContact + { + Name = "{{#infoName}}{{{infoName}}}{{/infoName}}{{^infoName}}OpenAPI-Generator Contributors{{/infoName}}", + Url = new Uri("{{#infoUrl}}{{{infoUrl}}}{{/infoUrl}}{{^infoUrl}}https://github.com/openapitools/openapi-generator{{/infoUrl}}"), + Email = "{{#infoEmail}}{{{infoEmail}}}{{/infoEmail}}" + }, + License = new OpenApiLicense + { + Name = "{{licenseName}}", + Url = new Uri("{{licenseUrl}}") + }, + Version = "{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}", + }); + c.CustomSchemaIds(type => type.FriendlyId(true)); + c.DescribeAllEnumsAsStrings(); + c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml"); + {{#basePathWithoutHost}} + // Sets the basePath property in the Swagger document generated + c.DocumentFilter<BasePathFilter>("{{{basePathWithoutHost}}}"); + {{/basePathWithoutHost}} + + // Include DataAnnotation attributes on Controller Action parameters as Swagger validation rules (e.g required, pattern, ..) + // Use [ValidateModelState] on Actions to actually validate it in C# as well! + c.OperationFilter<GeneratePathParamsValidationFilter>(); + }); +{{#useNewtonsoft}} + services + .AddSwaggerGenNewtonsoftSupport(); +{{/useNewtonsoft}} +{{/useSwashbuckle}} + } + + /// <summary> + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// </summary> + /// <param name="app"></param> + /// <param name="env"></param> + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseDefaultFiles(); + app.UseStaticFiles(); +{{#useSwashbuckle}} + app.UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) + .UseSwaggerUI(c => + { + //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) + c.SwaggerEndpoint("/swagger/{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}/openapi.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}"); + + //TODO: Or alternatively use the original Swagger contract that's included in the static files + // c.SwaggerEndpoint("/openapi-original.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} Original"); + }){{/useSwashbuckle}}; + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.Development.json b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.Development.json new file mode 100644 index 000000000000..e203e9407e74 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.json b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.json new file mode 100644 index 000000000000..def9159a7d94 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/bodyParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/bodyParam.mustache new file mode 100644 index 000000000000..02b0fa1d2dea --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/bodyParam.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}[FromBody]{{&dataType}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.bat.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.bat.mustache new file mode 100644 index 000000000000..e437bccf7d6f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.bat.mustache @@ -0,0 +1,9 @@ +:: Generated by: https://openapi-generator.tech +:: + +@echo off + +dotnet restore {{sourceFolder}}\{{packageName}} +dotnet build {{sourceFolder}}\{{packageName}} +echo Now, run the following to start the project: dotnet run -p {{sourceFolder}}\{{packageName}}\{{packageName}}.csproj --launch-profile web. +echo. diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.sh.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.sh.mustache new file mode 100644 index 000000000000..3804359d7e26 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.sh.mustache @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Generated by: https://openapi-generator.tech +# + +dotnet restore {{sourceFolder}}/{{packageName}}/ && \ + dotnet build {{sourceFolder}}/{{packageName}}/ && \ + echo "Now, run the following to start the project: dotnet run -p {{sourceFolder}}/{{packageName}}/{{packageName}}.csproj --launch-profile web" diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache new file mode 100644 index 000000000000..2fe77a01be34 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/controller.mustache @@ -0,0 +1,81 @@ +{{>partial_header}} +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +{{#operationResultTask}} +using System.Threading.Tasks; +{{/operationResultTask}} +using Microsoft.AspNetCore.Mvc; +{{#useSwashbuckle}} +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +{{/useSwashbuckle}} +{{^isLibrary}} +using Newtonsoft.Json; +{{/isLibrary}} +using {{packageName}}.Attributes; +using {{modelPackage}}; + +namespace {{apiPackage}} +{ {{#operations}} + /// <summary> + /// {{description}} + /// </summary>{{#description}} + [Description("{{description}}")]{{/description}} + [ApiController] + public {{#classModifier}}{{classModifier}} {{/classModifier}}class {{classname}}Controller : ControllerBase + { {{#operation}} + /// <summary> + /// {{#summary}}{{summary}}{{/summary}} + /// </summary>{{#notes}} + /// <remarks>{{notes}}</remarks>{{/notes}}{{#allParams}} + /// <param name="{{paramName}}">{{description}}</param>{{/allParams}}{{#responses}} + /// <response code="{{code}}">{{message}}</response>{{/responses}} + [{{httpMethod}}] + [Route("{{{basePathWithoutHost}}}{{{path}}}")] +{{#authMethods}} +{{#isApiKey}} + [Authorize(Policy = "{{name}}")] +{{/isApiKey}} +{{#isBasicBearer}} + [Authorize{{#scopes}}{{#-first}}(Roles = "{{/-first}}{{scope}}{{^-last}},{{/-last}}{{#-last}}"){{/-last}}{{/scopes}}] +{{/isBasicBearer}} +{{/authMethods}} + [ValidateModelState]{{#useSwashbuckle}} + [SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}} + [SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}{{/useSwashbuckle}}{{^useSwashbuckle}}{{#responses}}{{#dataType}} + [ProducesResponseType(statusCode: {{code}}, type: typeof({{&dataType}}))]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}{{/useSwashbuckle}} + public {{operationModifier}} {{#operationResultTask}}{{#operationIsAsync}}async {{/operationIsAsync}}Task<{{/operationResultTask}}IActionResult{{#operationResultTask}}>{{/operationResultTask}} {{operationId}}({{#allParams}}{{>pathParam}}{{>queryParam}}{{>bodyParam}}{{>formParam}}{{>headerParam}}{{#hasMore}}{{^isCookieParam}}, {{/isCookieParam}}{{/hasMore}}{{/allParams}}){{^generateBody}};{{/generateBody}} + {{#generateBody}} + { + {{#cookieParams}} + var {{paramName}} = Request.Cookies["{{paramName}}"]; + {{/cookieParams}} + +{{#responses}} +{{#dataType}} + //TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode({{code}}, default({{&dataType}})); +{{/dataType}} +{{^dataType}} + //TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode({{code}}); +{{/dataType}} +{{/responses}} +{{#returnType}} + string exampleJson = null; + {{#examples}} + exampleJson = "{{{example}}}"; + {{/examples}} + {{#isListCollection}}{{>listReturn}}{{/isListCollection}}{{^isListCollection}}{{#isMapContainer}}{{>mapReturn}}{{/isMapContainer}}{{^isMapContainer}}{{>objectReturn}}{{/isMapContainer}}{{/isListCollection}} + {{!TODO: defaultResponse, examples, auth, consumes, produces, nickname, externalDocs, imports, security}} + //TODO: Change the data returned + return {{#operationResultTask}}Task.FromResult<IActionResult>({{/operationResultTask}}new ObjectResult(example){{#operationResultTask}}){{/operationResultTask}};{{/returnType}}{{^returnType}} + throw new NotImplementedException();{{/returnType}} + } + {{/generateBody}} + {{/operation}} + } +{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/enumClass.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/enumClass.mustache new file mode 100644 index 000000000000..8a932b5ade61 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/enumClass.mustache @@ -0,0 +1,19 @@ + + /// <summary> + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// </summary> + {{#description}} + /// <value>{{{description}}}</value> + {{/description}} + {{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}[TypeConverter(typeof(CustomEnumConverter<{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}} + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { + {{#allowableValues}}{{#enumVars}} + /// <summary> + /// Enum {{name}} for {{{value}}} + /// </summary> + {{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}} + {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}}, + {{/-last}}{{/enumVars}}{{/allowableValues}} + } diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache new file mode 100644 index 000000000000..fbd2d815d58d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/formParam.mustache @@ -0,0 +1 @@ +{{#isFormParam}}[FromForm]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/gitignore b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/gitignore new file mode 100644 index 000000000000..cd9b840e5498 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/gitignore @@ -0,0 +1,208 @@ +PID + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# 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 +# TODO: 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 + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# 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/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ +orleans.codegen.cs + +# 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 + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/headerParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/headerParam.mustache new file mode 100644 index 000000000000..a3a929904c62 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/headerParam.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}[FromHeader]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/listReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/listReturn.mustache new file mode 100644 index 000000000000..d609e67148c2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/listReturn.mustache @@ -0,0 +1,4 @@ + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<{{returnContainer}}<{{#returnType}}{{{returnType}}}{{/returnType}}>>(exampleJson) + : Enumerable.Empty<{{#returnType}}{{{returnType}}}{{/returnType}}>(); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/mapReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/mapReturn.mustache new file mode 100644 index 000000000000..856fb1b3507c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/mapReturn.mustache @@ -0,0 +1,4 @@ + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Dictionary<{{#returnType}}{{{returnType}}}{{/returnType}}>>(exampleJson) + : new Dictionary<{{#returnType}}{{{returnType}}}{{/returnType}}>(); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/model.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/model.mustache new file mode 100644 index 000000000000..8ae491d52cca --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/model.mustache @@ -0,0 +1,154 @@ +{{>partial_header}} +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using {{packageName}}.Converters; + +{{#models}} +{{#model}} +namespace {{modelPackage}} +{ {{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}} + /// <summary> + /// {{description}} + /// </summary> + [DataContract] + public {{#modelClassModifier}}{{modelClassModifier}} {{/modelClassModifier}}class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}> + { + {{#vars}} + {{#items.isEnum}} + {{#items}} + {{^complexType}} +{{>enumClass}} + {{/complexType}} + {{/items}} + {{/items.isEnum}} + {{#isEnum}} + {{^complexType}} +{{>enumClass}} + {{/complexType}} + {{/isEnum}} + /// <summary> + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// </summary>{{#description}} + /// <value>{{description}}</value>{{/description}}{{#required}} + [Required]{{/required}}{{#pattern}} + [RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}} + [StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} + [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} + [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}} + [Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}} + [DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}})] + {{#isEnum}} + public {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{name}} { get; set; }{{#defaultValue}} = {{{defaultValue}}};{{/defaultValue}} + {{/isEnum}} + {{^isEnum}} + public {{{dataType}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }{{#defaultValue}} = {{{defaultValue}}};{{/defaultValue}} + {{/isEnum}} + {{#hasMore}} + + {{/hasMore}} + {{/vars}} + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class {{classname}} {\n"); + {{#vars}} + sb.Append(" {{name}}: ").Append({{name}}).Append("\n"); + {{/vars}} + sb.Append("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public {{#parent}}{{^isMapModel}}{{^isArrayModel}}new {{/isArrayModel}}{{/isMapModel}}{{/parent}}string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals(({{classname}})obj); + } + + /// <summary> + /// Returns true if {{classname}} instances are equal + /// </summary> + /// <param name="other">Instance of {{classname}} to be compared</param> + /// <returns>Boolean</returns> + public bool Equals({{classname}} other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return {{#vars}}{{^isContainer}} + ( + {{name}} == other.{{name}} || + {{^vendorExtensions.x-is-value-type}}{{name}} != null &&{{/vendorExtensions.x-is-value-type}} + {{name}}.Equals(other.{{name}}) + ){{#hasMore}} && {{/hasMore}}{{/isContainer}}{{#isContainer}} + ( + {{name}} == other.{{name}} || + {{^vendorExtensions.x-is-value-type}}{{name}} != null && + other.{{name}} != null && + {{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(other.{{name}}) + ){{#hasMore}} && {{/hasMore}}{{/isContainer}}{{/vars}}{{^vars}}false{{/vars}}; + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + {{#vars}} + {{^vendorExtensions.x-is-value-type}}if ({{name}} != null){{/vendorExtensions.x-is-value-type}} + hashCode = hashCode * 59 + {{name}}.GetHashCode(); + {{/vars}} + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==({{classname}} left, {{classname}} right) + { + return Equals(left, right); + } + + public static bool operator !=({{classname}} left, {{classname}} right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +{{/isEnum}} +{{/model}} +{{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/objectReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/objectReturn.mustache new file mode 100644 index 000000000000..4059a61ac0b8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/objectReturn.mustache @@ -0,0 +1,4 @@ + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<{{#returnType}}{{{returnType}}}{{/returnType}}>(exampleJson) + : default({{#returnType}}{{{returnType}}}{{/returnType}}); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/partial_header.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/partial_header.mustache new file mode 100644 index 000000000000..9eb233d1197c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/partial_header.mustache @@ -0,0 +1,13 @@ +/* + {{#appName}} + * {{{appName}}} + * + {{/appName}} + {{#appDescription}} + * {{{appDescription}}} + * + {{/appDescription}} + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * Generated by: https://openapi-generator.tech + */ diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache new file mode 100644 index 000000000000..7a7ffd3ab16a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/pathParam.mustache @@ -0,0 +1 @@ +{{#isPathParam}}[FromRoute]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache new file mode 100644 index 000000000000..c454950bd147 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/queryParam.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}[FromQuery]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/tags.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/tags.mustache new file mode 100644 index 000000000000..c97df19949e6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/tags.mustache @@ -0,0 +1 @@ +{{!TODO: Need iterable tags object...}}{{#tags}}, Tags = new[] { {{/tags}}"{{#tags}}{{tag}} {{/tags}}"{{#tags}} }{{/tags}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/typeConverter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/typeConverter.mustache new file mode 100644 index 000000000000..3d0b6da46dc2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/typeConverter.mustache @@ -0,0 +1,42 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using Newtonsoft.Json; + +namespace {{packageName}}.Converters +{ + /// <summary> + /// Custom string to enum converter + /// </summary> + public class CustomEnumConverter<T> : TypeConverter + { + /// <summary> + /// Determine if we can convert a type to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="sourceType"></param> + /// <returns></returns> + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// <summary> + /// Convert from a type value to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="culture"></param> + /// <param name="value"></param> + /// <returns></returns> + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var s = value as string; + if (string.IsNullOrEmpty(s)) + { + return null; + } + + return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @""""); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/validateModel.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/validateModel.mustache new file mode 100644 index 000000000000..e11aaa5d2708 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/validateModel.mustache @@ -0,0 +1,61 @@ +using System.ComponentModel.DataAnnotations; +using System.Reflection; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace {{packageName}}.Attributes +{ + /// <summary> + /// Model state validation attribute + /// </summary> + public class ValidateModelStateAttribute : ActionFilterAttribute + { + /// <summary> + /// Called before the action method is invoked + /// </summary> + /// <param name="context"></param> + public override void OnActionExecuting(ActionExecutingContext context) + { + // Per https://blog.markvincze.com/how-to-validate-action-parameters-with-dataannotation-attributes/ + var descriptor = context.ActionDescriptor as ControllerActionDescriptor; + if (descriptor != null) + { + foreach (var parameter in descriptor.MethodInfo.GetParameters()) + { + object args = null; + if (context.ActionArguments.ContainsKey(parameter.Name)) + { + args = context.ActionArguments[parameter.Name]; + } + + ValidateAttributes(parameter, args, context.ModelState); + } + } + + if (!context.ModelState.IsValid) + { + context.Result = new BadRequestObjectResult(context.ModelState); + } + } + + private void ValidateAttributes(ParameterInfo parameter, object args, ModelStateDictionary modelState) + { + foreach (var attributeData in parameter.CustomAttributes) + { + var attributeInstance = parameter.GetCustomAttribute(attributeData.AttributeType); + + var validationAttribute = attributeInstance as ValidationAttribute; + if (validationAttribute != null) + { + var isValid = validationAttribute.IsValid(args); + if (!isValid) + { + modelState.AddModelError(parameter.Name, validationAttribute.FormatErrorMessage(parameter.Name)); + } + } + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/README.md b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/README.md new file mode 100644 index 000000000000..6a0b78471a33 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/README.md @@ -0,0 +1,42 @@ +# Welcome to ASP.NET 5 Preview + +We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. + +ASP.NET 5 has been rearchitected to make it **lean** and **composable**. It's fully **open source** and available on [GitHub](http://go.microsoft.com/fwlink/?LinkID=517854). +Your new project automatically takes advantage of modern client-side utilities like [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) and [npm](http://go.microsoft.com/fwlink/?LinkId=518005) (to add client-side libraries) and [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) (for client-side build and automation tasks). + +We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015. +The ASP.NET Team + +### You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016) + +### This application consists of: +* Sample pages using ASP.NET MVC 6 +* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side resources +* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939) + +#### NEW CONCEPTS +* [The 'wwwroot' explained](http://go.microsoft.com/fwlink/?LinkId=518008) +* [Configuration in ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518012) +* [Dependency Injection](http://go.microsoft.com/fwlink/?LinkId=518013) +* [Razor TagHelpers](http://go.microsoft.com/fwlink/?LinkId=518014) +* [Manage client packages using Gulp](http://go.microsoft.com/fwlink/?LinkID=517849) +* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=517850) + +#### CUSTOMIZE APP +* [Add Controllers and Views](http://go.microsoft.com/fwlink/?LinkID=398600) +* [Add Data using EntityFramework](http://go.microsoft.com/fwlink/?LinkID=398602) +* [Add Authentication using Identity](http://go.microsoft.com/fwlink/?LinkID=398603) +* [Add real time support using SignalR](http://go.microsoft.com/fwlink/?LinkID=398606) +* [Add Class library](http://go.microsoft.com/fwlink/?LinkID=398604) +* [Add Web APIs with MVC 6](http://go.microsoft.com/fwlink/?LinkId=518009) +* [Add client packages using Bower](http://go.microsoft.com/fwlink/?LinkID=517848) + +#### DEPLOY +* [Run your app locally](http://go.microsoft.com/fwlink/?LinkID=517851) +* [Run your app on ASP.NET Core 5](http://go.microsoft.com/fwlink/?LinkID=517852) +* [Run commands in your 'project.json'](http://go.microsoft.com/fwlink/?LinkID=517853) +* [Publish to Microsoft Azure Web Sites](http://go.microsoft.com/fwlink/?LinkID=398609) +* [Publish to the file system](http://go.microsoft.com/fwlink/?LinkId=518019) + +We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015) diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/index.html b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/index.html new file mode 100644 index 000000000000..cde1f2f90b92 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/index.html @@ -0,0 +1 @@ +<meta http-equiv="refresh" content="0;URL='./swagger/'" /> \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/openapi-original.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/openapi-original.mustache new file mode 100644 index 000000000000..2c1b461cf000 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/openapi-original.mustache @@ -0,0 +1 @@ +{{{openapi-json}}} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/web.config b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/web.config new file mode 100644 index 000000000000..e70a7778d60b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/3.0/wwwroot/web.config @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <system.webServer> + <handlers> + <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/> + </handlers> + <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/> + </system.webServer> +</configuration> diff --git a/samples/server/petstore/aspnetcore/.openapi-generator/VERSION b/samples/server/petstore/aspnetcore/.openapi-generator/VERSION index 94bf4e677615..b5d898602c2c 100644 --- a/samples/server/petstore/aspnetcore/.openapi-generator/VERSION +++ b/samples/server/petstore/aspnetcore/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.3-SNAPSHOT +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore/README.md b/samples/server/petstore/aspnetcore/README.md index 83c46e8a5220..0dfedef95732 100644 --- a/samples/server/petstore/aspnetcore/README.md +++ b/samples/server/petstore/aspnetcore/README.md @@ -1,4 +1,4 @@ -# Org.OpenAPITools - ASP.NET Core 2.0 Server +# Org.OpenAPITools - ASP.NET Core 2.2 Server This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs index bde72d78080b..605abe35f6bb 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs @@ -7,12 +7,26 @@ namespace Org.OpenAPITools.Authentication { + /// <summary> + /// A requirement that an ApiKey must be present. + /// </summary> public class ApiKeyRequirement : IAuthorizationRequirement { - public IReadOnlyList<string> ApiKeys { get; set; } - - public string PolicyName { get; set; } + /// <summary> + /// Get the list of api keys + /// </summary> + public IReadOnlyList<string> ApiKeys { get; } + /// <summary> + /// Get the policy name, + /// </summary> + public string PolicyName { get; } + + /// <summary> + /// Create a new instance of the <see cref="ApiKeyRequirement"/> class. + /// </summary> + /// <param name="apiKeys"></param> + /// <param name="policyName"></param> public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) { ApiKeys = apiKeys?.ToList() ?? new List<string>(); @@ -20,9 +34,12 @@ public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) } } + /// <summary> + /// Enforce that an api key is present. + /// </summary> public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement> { - + /// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" /> protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) { SucceedRequirementIfApiKeyPresentAndValid(context, requirement); @@ -34,12 +51,12 @@ private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerConte if (context.Resource is AuthorizationFilterContext authorizationFilterContext) { - var apiKey = ""; - apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault(); + var apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault(); if (requirement.PolicyName == "api_key" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) { context.Succeed(requirement); } + } } } diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 3fbf77c6005a..63ecd64a4507 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -14,6 +14,6 @@ <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="3.0.0" /> </ItemGroup> <ItemGroup> - <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" /> + <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" /> </ItemGroup> </Project> diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs index dc255939dc9d..8afc90fa56c6 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs @@ -57,6 +57,7 @@ public void ConfigureServices(IServiceCollection services) authConfig.AddPolicy("api_key", policyBuilder => policyBuilder .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"api_key"))); + }); // Add framework services. services @@ -78,7 +79,7 @@ public void ConfigureServices(IServiceCollection services) { Version = "1.0.0", Title = "OpenAPI Petstore", - Description = "OpenAPI Petstore (ASP.NET Core 2.0)", + Description = "OpenAPI Petstore (ASP.NET Core 2.2)", Contact = new Contact() { Name = "OpenAPI-Generator Contributors", diff --git a/samples/server/petstore/aspnetcore3/.openapi-generator-ignore b/samples/server/petstore/aspnetcore3/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/.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/server/petstore/aspnetcore3/.openapi-generator/VERSION b/samples/server/petstore/aspnetcore3/.openapi-generator/VERSION new file mode 100644 index 000000000000..b5d898602c2c --- /dev/null +++ b/samples/server/petstore/aspnetcore3/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore3/Org.OpenAPITools.sln b/samples/server/petstore/aspnetcore3/Org.OpenAPITools.sln new file mode 100644 index 000000000000..c2bc38764202 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/Org.OpenAPITools.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2043 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3C799344-F285-4669-8FD5-7ED9B795D5C5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnetcore3/README.md b/samples/server/petstore/aspnetcore3/README.md new file mode 100644 index 000000000000..ad46d4e125cc --- /dev/null +++ b/samples/server/petstore/aspnetcore3/README.md @@ -0,0 +1,24 @@ +# Org.OpenAPITools - ASP.NET Core 3.0 Server + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Run + +Linux/OS X: + +``` +sh build.sh +``` + +Windows: + +``` +build.bat +``` +## Run in Docker + +``` +cd src/Org.OpenAPITools +docker build -t org.openapitools . +docker run -p 5000:8080 org.openapitools +``` diff --git a/samples/server/petstore/aspnetcore3/build.bat b/samples/server/petstore/aspnetcore3/build.bat new file mode 100644 index 000000000000..cd65518e4287 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/build.bat @@ -0,0 +1,9 @@ +:: Generated by: https://openapi-generator.tech +:: + +@echo off + +dotnet restore src\Org.OpenAPITools +dotnet build src\Org.OpenAPITools +echo Now, run the following to start the project: dotnet run -p src\Org.OpenAPITools\Org.OpenAPITools.csproj --launch-profile web. +echo. diff --git a/samples/server/petstore/aspnetcore3/build.sh b/samples/server/petstore/aspnetcore3/build.sh new file mode 100644 index 000000000000..afbeddb83782 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Generated by: https://openapi-generator.tech +# + +dotnet restore src/Org.OpenAPITools/ && \ + dotnet build src/Org.OpenAPITools/ && \ + echo "Now, run the following to start the project: dotnet run -p src/Org.OpenAPITools/Org.OpenAPITools.csproj --launch-profile web" diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/.gitignore b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/.gitignore new file mode 100644 index 000000000000..cd9b840e5498 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/.gitignore @@ -0,0 +1,208 @@ +PID + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# 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 +# TODO: 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 + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# 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/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ +orleans.codegen.cs + +# 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 + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs new file mode 100644 index 000000000000..f388cfdf9831 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs @@ -0,0 +1,61 @@ +using System.ComponentModel.DataAnnotations; +using System.Reflection; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace Org.OpenAPITools.Attributes +{ + /// <summary> + /// Model state validation attribute + /// </summary> + public class ValidateModelStateAttribute : ActionFilterAttribute + { + /// <summary> + /// Called before the action method is invoked + /// </summary> + /// <param name="context"></param> + public override void OnActionExecuting(ActionExecutingContext context) + { + // Per https://blog.markvincze.com/how-to-validate-action-parameters-with-dataannotation-attributes/ + var descriptor = context.ActionDescriptor as ControllerActionDescriptor; + if (descriptor != null) + { + foreach (var parameter in descriptor.MethodInfo.GetParameters()) + { + object args = null; + if (context.ActionArguments.ContainsKey(parameter.Name)) + { + args = context.ActionArguments[parameter.Name]; + } + + ValidateAttributes(parameter, args, context.ModelState); + } + } + + if (!context.ModelState.IsValid) + { + context.Result = new BadRequestObjectResult(context.ModelState); + } + } + + private void ValidateAttributes(ParameterInfo parameter, object args, ModelStateDictionary modelState) + { + foreach (var attributeData in parameter.CustomAttributes) + { + var attributeInstance = parameter.GetCustomAttribute(attributeData.AttributeType); + + var validationAttribute = attributeInstance as ValidationAttribute; + if (validationAttribute != null) + { + var isValid = validationAttribute.IsValid(args); + if (!isValid) + { + modelState.AddModelError(parameter.Name, validationAttribute.FormatErrorMessage(parameter.Name)); + } + } + } + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs new file mode 100644 index 000000000000..92b2512e441d --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc.Filters; + +namespace Org.OpenAPITools.Authentication +{ + /// <summary> + /// A requirement that an ApiKey must be present. + /// </summary> + public class ApiKeyRequirement : IAuthorizationRequirement + { + /// <summary> + /// Get the list of api keys + /// </summary> + public IReadOnlyList<string> ApiKeys { get; } + + /// <summary> + /// Get the policy name, + /// </summary> + public string PolicyName { get; } + + /// <summary> + /// Create a new instance of the <see cref="ApiKeyRequirement"/> class. + /// </summary> + /// <param name="apiKeys"></param> + /// <param name="policyName"></param> + public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) + { + ApiKeys = apiKeys?.ToList() ?? new List<string>(); + PolicyName = policyName; + } + } + + /// <summary> + /// Enforce that an api key is present. + /// </summary> + public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement> + { + /// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" /> + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + SucceedRequirementIfApiKeyPresentAndValid(context, requirement); + return Task.CompletedTask; + } + + private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + + if (context.Resource is AuthorizationFilterContext authorizationFilterContext) + { + var apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault(); + if (requirement.PolicyName == "api_key" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) + { + context.Succeed(requirement); + } + } + + } + } +} + diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/PetApi.cs new file mode 100644 index 000000000000..2102b82d8fe6 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -0,0 +1,232 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class PetApiController : ControllerBase + { + /// <summary> + /// Add a new pet to the store + /// </summary> + /// <param name="body">Pet object that needs to be added to the store</param> + /// <response code="405">Invalid input</response> + [HttpPost] + [Route("/v2/pet")] + [ValidateModelState] + [SwaggerOperation("AddPet")] + public virtual IActionResult AddPet([FromBody]Pet body) + { + + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// Deletes a pet + /// </summary> + /// <param name="petId">Pet id to delete</param> + /// <param name="apiKey"></param> + /// <response code="400">Invalid pet value</response> + [HttpDelete] + [Route("/v2/pet/{petId}")] + [ValidateModelState] + [SwaggerOperation("DeletePet")] + public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + + throw new NotImplementedException(); + } + + /// <summary> + /// Finds Pets by status + /// </summary> + /// <remarks>Multiple status values can be provided with comma separated strings</remarks> + /// <param name="status">Status values that need to be considered for filter</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid status value</response> + [HttpGet] + [Route("/v2/pet/findByStatus")] + [ValidateModelState] + [SwaggerOperation("FindPetsByStatus")] + [SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")] + public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string> status) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(List<Pet>)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<List<Pet>>(exampleJson) + : default(List<Pet>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Finds Pets by tags + /// </summary> + /// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks> + /// <param name="tags">Tags to filter by</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid tag value</response> + [HttpGet] + [Route("/v2/pet/findByTags")] + [ValidateModelState] + [SwaggerOperation("FindPetsByTags")] + [SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")] + public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string> tags) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(List<Pet>)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<List<Pet>>(exampleJson) + : default(List<Pet>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Find pet by ID + /// </summary> + /// <remarks>Returns a single pet</remarks> + /// <param name="petId">ID of pet to return</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Pet not found</response> + [HttpGet] + [Route("/v2/pet/{petId}")] + [Authorize(Policy = "api_key")] + [ValidateModelState] + [SwaggerOperation("GetPetById")] + [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] + public virtual IActionResult GetPetById([FromRoute][Required]long petId) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Pet)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Pet>(exampleJson) + : default(Pet); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Update an existing pet + /// </summary> + /// <param name="body">Pet object that needs to be added to the store</param> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Pet not found</response> + /// <response code="405">Validation exception</response> + [HttpPut] + [Route("/v2/pet")] + [ValidateModelState] + [SwaggerOperation("UpdatePet")] + public virtual IActionResult UpdatePet([FromBody]Pet body) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// Updates a pet in the store with form data + /// </summary> + /// <param name="petId">ID of pet that needs to be updated</param> + /// <param name="name">Updated name of the pet</param> + /// <param name="status">Updated status of the pet</param> + /// <response code="405">Invalid input</response> + [HttpPost] + [Route("/v2/pet/{petId}")] + [ValidateModelState] + [SwaggerOperation("UpdatePetWithForm")] + public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + { + + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// uploads an image + /// </summary> + /// <param name="petId">ID of pet to update</param> + /// <param name="additionalMetadata">Additional data to pass to server</param> + /// <param name="file">file to upload</param> + /// <response code="200">successful operation</response> + [HttpPost] + [Route("/v2/pet/{petId}/uploadImage")] + [ValidateModelState] + [SwaggerOperation("UploadFile")] + [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] + public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(ApiResponse)); + string exampleJson = null; + exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<ApiResponse>(exampleJson) + : default(ApiResponse); + //TODO: Change the data returned + return new ObjectResult(example); + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/StoreApi.cs new file mode 100644 index 000000000000..fa909a61a146 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -0,0 +1,139 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class StoreApiController : ControllerBase + { + /// <summary> + /// Delete purchase order by ID + /// </summary> + /// <remarks>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</remarks> + /// <param name="orderId">ID of the order that needs to be deleted</param> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Order not found</response> + [HttpDelete] + [Route("/v2/store/order/{orderId}")] + [ValidateModelState] + [SwaggerOperation("DeleteOrder")] + public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + + /// <summary> + /// Returns pet inventories by status + /// </summary> + /// <remarks>Returns a map of status codes to quantities</remarks> + /// <response code="200">successful operation</response> + [HttpGet] + [Route("/v2/store/inventory")] + [Authorize(Policy = "api_key")] + [ValidateModelState] + [SwaggerOperation("GetInventory")] + [SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int>), description: "successful operation")] + public virtual IActionResult GetInventory() + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Dictionary<string, int>)); + string exampleJson = null; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson) + : default(Dictionary<string, int>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Find purchase order by ID + /// </summary> + /// <remarks>For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions</remarks> + /// <param name="orderId">ID of pet that needs to be fetched</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Order not found</response> + [HttpGet] + [Route("/v2/store/order/{orderId}")] + [ValidateModelState] + [SwaggerOperation("GetOrderById")] + [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] + public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Order)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Order>(exampleJson) + : default(Order); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Place an order for a pet + /// </summary> + /// <param name="body">order placed for purchasing the pet</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid Order</response> + [HttpPost] + [Route("/v2/store/order")] + [ValidateModelState] + [SwaggerOperation("PlaceOrder")] + [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] + public virtual IActionResult PlaceOrder([FromBody]Order body) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Order)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Order>(exampleJson) + : default(Order); + //TODO: Change the data returned + return new ObjectResult(example); + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/UserApi.cs new file mode 100644 index 000000000000..c37f0251d3bc --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -0,0 +1,207 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class UserApiController : ControllerBase + { + /// <summary> + /// Create user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="body">Created user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user")] + [ValidateModelState] + [SwaggerOperation("CreateUser")] + public virtual IActionResult CreateUser([FromBody]User body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Creates list of users with given input array + /// </summary> + /// <param name="body">List of user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user/createWithArray")] + [ValidateModelState] + [SwaggerOperation("CreateUsersWithArrayInput")] + public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Creates list of users with given input array + /// </summary> + /// <param name="body">List of user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user/createWithList")] + [ValidateModelState] + [SwaggerOperation("CreateUsersWithListInput")] + public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Delete user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="username">The name that needs to be deleted</param> + /// <response code="400">Invalid username supplied</response> + /// <response code="404">User not found</response> + [HttpDelete] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("DeleteUser")] + public virtual IActionResult DeleteUser([FromRoute][Required]string username) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + + /// <summary> + /// Get user by user name + /// </summary> + /// <param name="username">The name that needs to be fetched. Use user1 for testing.</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid username supplied</response> + /// <response code="404">User not found</response> + [HttpGet] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("GetUserByName")] + [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] + public virtual IActionResult GetUserByName([FromRoute][Required]string username) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(User)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}"; + exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<User>(exampleJson) + : default(User); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Logs user into the system + /// </summary> + /// <param name="username">The user name for login</param> + /// <param name="password">The password for login in clear text</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid username/password supplied</response> + [HttpGet] + [Route("/v2/user/login")] + [ValidateModelState] + [SwaggerOperation("LoginUser")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] + public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(string)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<string>(exampleJson) + : default(string); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Logs out current logged in user session + /// </summary> + /// <response code="0">successful operation</response> + [HttpGet] + [Route("/v2/user/logout")] + [ValidateModelState] + [SwaggerOperation("LogoutUser")] + public virtual IActionResult LogoutUser() + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Updated user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="username">name that need to be deleted</param> + /// <param name="body">Updated user object</param> + /// <response code="400">Invalid user supplied</response> + /// <response code="404">User not found</response> + [HttpPut] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("UpdateUser")] + public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs new file mode 100644 index 000000000000..00b75a3cc7c7 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs @@ -0,0 +1,42 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Converters +{ + /// <summary> + /// Custom string to enum converter + /// </summary> + public class CustomEnumConverter<T> : TypeConverter + { + /// <summary> + /// Determine if we can convert a type to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="sourceType"></param> + /// <returns></returns> + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// <summary> + /// Convert from a type value to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="culture"></param> + /// <param name="value"></param> + /// <returns></returns> + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var s = value as string; + if (string.IsNullOrEmpty(s)) + { + return null; + } + + return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @""""); + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Dockerfile b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Dockerfile new file mode 100644 index 000000000000..a054cdee5ac5 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Dockerfile @@ -0,0 +1,32 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# Container we use for final publish +FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +# Build container +FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build + +# Copy the code into the container +WORKDIR /src +COPY ["src/Org.OpenAPITools/Org.OpenAPITools.csproj", "Org.OpenAPITools/"] + +# NuGet restore +RUN dotnet restore "Org.OpenAPITools/Org.OpenAPITools.csproj" +COPY ["src/Org.OpenAPITools/", "Org.OpenAPITools/"] + +# Build the API +WORKDIR "Org.OpenAPITools" +RUN dotnet build "Org.OpenAPITools.csproj" -c Release -o /app/build + +# Publish it +FROM build AS publish +RUN dotnet publish "Org.OpenAPITools.csproj" -c Release -o /app/publish + +# Make the final image for publishing +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Org.OpenAPITools.dll"] diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/BasePathFilter.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/BasePathFilter.cs new file mode 100644 index 000000000000..09ab6006a7bd --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/BasePathFilter.cs @@ -0,0 +1,50 @@ +using System.Linq; +using System.Text.RegularExpressions; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Org.OpenAPITools.Filters +{ + /// <summary> + /// BasePath Document Filter sets BasePath property of Swagger and removes it from the individual URL paths + /// </summary> + public class BasePathFilter : IDocumentFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="basePath">BasePath to remove from Operations</param> + public BasePathFilter(string basePath) + { + BasePath = basePath; + } + + /// <summary> + /// Gets the BasePath of the Swagger Doc + /// </summary> + /// <returns>The BasePath of the Swagger Doc</returns> + public string BasePath { get; } + + /// <summary> + /// Apply the filter + /// </summary> + /// <param name="swaggerDoc">SwaggerDocument</param> + /// <param name="context">FilterContext</param> + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + //swaggerDoc.BasePath = BasePath; + + var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList(); + + foreach (var (key, value) in pathsToModify) + { + if (key.StartsWith(BasePath)) + { + var newKey = Regex.Replace(key, $"^{BasePath}", string.Empty); + swaggerDoc.Paths.Remove(key); + swaggerDoc.Paths.Add(newKey, value); + } + } + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs new file mode 100644 index 000000000000..823aa34de41f --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs @@ -0,0 +1,98 @@ +using System.ComponentModel.DataAnnotations; +using System.Linq; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Org.OpenAPITools.Filters +{ + /// <summary> + /// Path Parameter Validation Rules Filter + /// </summary> + public class GeneratePathParamsValidationFilter : IOperationFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="operation">Operation</param> + /// <param name="context">OperationFilterContext</param> + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + var pars = context.ApiDescription.ParameterDescriptions; + + foreach (var par in pars) + { + var swaggerParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); + + var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes.ToList(); + + // See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1147 + // and https://mikeralphson.github.io/openapi/2017/03/15/openapi3.0.0-rc0 + // Basically OpenAPI v3 body parameters are split out into RequestBody and the properties have moved to schema + if (attributes.Any() && swaggerParam != null) + { + // Required - [Required] + var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); + if (requiredAttr != null) + { + swaggerParam.Required = true; + } + + // Regex Pattern [RegularExpression] + var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); + if (regexAttr != null) + { + var regex = (string)regexAttr.ConstructorArguments[0].Value; + swaggerParam.Schema.Pattern = regex; + } + + // String Length [StringLength] + int? minLength = null, maxLength = null; + var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); + if (stringLengthAttr != null) + { + if (stringLengthAttr.NamedArguments.Count == 1) + { + minLength = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; + } + maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value; + } + + var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); + if (minLengthAttr != null) + { + minLength = (int)minLengthAttr.ConstructorArguments[0].Value; + } + + var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); + if (maxLengthAttr != null) + { + maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value; + } + + if (minLength != null) + { + swaggerParam.Schema.MinLength = minLength; + } + + if (maxLength != null) + { + swaggerParam.Schema.MaxLength = maxLength; + } + + // Range [Range] + var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); + if (rangeAttr != null) + { + var rangeMin = (int)rangeAttr.ConstructorArguments[0].Value; + var rangeMax = (int)rangeAttr.ConstructorArguments[1].Value; + + swaggerParam.Schema.MinLength = rangeMin; + swaggerParam.Schema.MaxLength = rangeMax; + } + } + } + } + } +} + diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..ef3413980eac --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,147 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// Describes the result of uploading an image resource + /// </summary> + [DataContract] + public partial class ApiResponse : IEquatable<ApiResponse> + { + /// <summary> + /// Gets or Sets Code + /// </summary> + [DataMember(Name="code", EmitDefaultValue=false)] + public int Code { get; set; } + + /// <summary> + /// Gets or Sets Type + /// </summary> + [DataMember(Name="type", EmitDefaultValue=false)] + public string Type { get; set; } + + /// <summary> + /// Gets or Sets Message + /// </summary> + [DataMember(Name="message", EmitDefaultValue=false)] + public string Message { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((ApiResponse)obj); + } + + /// <summary> + /// Returns true if ApiResponse instances are equal + /// </summary> + /// <param name="other">Instance of ApiResponse to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(ApiResponse other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Code == other.Code || + + Code.Equals(other.Code) + ) && + ( + Type == other.Type || + Type != null && + Type.Equals(other.Type) + ) && + ( + Message == other.Message || + Message != null && + Message.Equals(other.Message) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Code.GetHashCode(); + if (Type != null) + hashCode = hashCode * 59 + Type.GetHashCode(); + if (Message != null) + hashCode = hashCode * 59 + Message.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(ApiResponse left, ApiResponse right) + { + return Equals(left, right); + } + + public static bool operator !=(ApiResponse left, ApiResponse right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..6ac6a181baf6 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,133 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A category for a pet + /// </summary> + [DataContract] + public partial class Category : IEquatable<Category> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Category)obj); + } + + /// <summary> + /// Returns true if Category instances are equal + /// </summary> + /// <param name="other">Instance of Category to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Category other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Category left, Category right) + { + return Equals(left, right); + } + + public static bool operator !=(Category left, Category right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..77a4c75a1b17 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,219 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// An order for a pets from the pet store + /// </summary> + [DataContract] + public partial class Order : IEquatable<Order> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets PetId + /// </summary> + [DataMember(Name="petId", EmitDefaultValue=false)] + public long PetId { get; set; } + + /// <summary> + /// Gets or Sets Quantity + /// </summary> + [DataMember(Name="quantity", EmitDefaultValue=false)] + public int Quantity { get; set; } + + /// <summary> + /// Gets or Sets ShipDate + /// </summary> + [DataMember(Name="shipDate", EmitDefaultValue=false)] + public DateTime ShipDate { get; set; } + + + /// <summary> + /// Order Status + /// </summary> + /// <value>Order Status</value> + [TypeConverter(typeof(CustomEnumConverter<StatusEnum>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StatusEnum + { + + /// <summary> + /// Enum PlacedEnum for placed + /// </summary> + [EnumMember(Value = "placed")] + PlacedEnum = 1, + + /// <summary> + /// Enum ApprovedEnum for approved + /// </summary> + [EnumMember(Value = "approved")] + ApprovedEnum = 2, + + /// <summary> + /// Enum DeliveredEnum for delivered + /// </summary> + [EnumMember(Value = "delivered")] + DeliveredEnum = 3 + } + + /// <summary> + /// Order Status + /// </summary> + /// <value>Order Status</value> + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum Status { get; set; } + + /// <summary> + /// Gets or Sets Complete + /// </summary> + [DataMember(Name="complete", EmitDefaultValue=false)] + public bool Complete { get; set; } = false; + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Order)obj); + } + + /// <summary> + /// Returns true if Order instances are equal + /// </summary> + /// <param name="other">Instance of Order to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Order other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + PetId == other.PetId || + + PetId.Equals(other.PetId) + ) && + ( + Quantity == other.Quantity || + + Quantity.Equals(other.Quantity) + ) && + ( + ShipDate == other.ShipDate || + ShipDate != null && + ShipDate.Equals(other.ShipDate) + ) && + ( + Status == other.Status || + + Status.Equals(other.Status) + ) && + ( + Complete == other.Complete || + + Complete.Equals(other.Complete) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + + hashCode = hashCode * 59 + PetId.GetHashCode(); + + hashCode = hashCode * 59 + Quantity.GetHashCode(); + if (ShipDate != null) + hashCode = hashCode * 59 + ShipDate.GetHashCode(); + + hashCode = hashCode * 59 + Status.GetHashCode(); + + hashCode = hashCode * 59 + Complete.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Order left, Order right) + { + return Equals(left, right); + } + + public static bool operator !=(Order left, Order right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..a814c6e1edfe --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,223 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A pet for sale in the pet store + /// </summary> + [DataContract] + public partial class Pet : IEquatable<Pet> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Category + /// </summary> + [DataMember(Name="category", EmitDefaultValue=false)] + public Category Category { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [Required] + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Gets or Sets PhotoUrls + /// </summary> + [Required] + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + public List<string> PhotoUrls { get; set; } + + /// <summary> + /// Gets or Sets Tags + /// </summary> + [DataMember(Name="tags", EmitDefaultValue=false)] + public List<Tag> Tags { get; set; } + + + /// <summary> + /// pet status in the store + /// </summary> + /// <value>pet status in the store</value> + [TypeConverter(typeof(CustomEnumConverter<StatusEnum>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StatusEnum + { + + /// <summary> + /// Enum AvailableEnum for available + /// </summary> + [EnumMember(Value = "available")] + AvailableEnum = 1, + + /// <summary> + /// Enum PendingEnum for pending + /// </summary> + [EnumMember(Value = "pending")] + PendingEnum = 2, + + /// <summary> + /// Enum SoldEnum for sold + /// </summary> + [EnumMember(Value = "sold")] + SoldEnum = 3 + } + + /// <summary> + /// pet status in the store + /// </summary> + /// <value>pet status in the store</value> + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum Status { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Pet)obj); + } + + /// <summary> + /// Returns true if Pet instances are equal + /// </summary> + /// <param name="other">Instance of Pet to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Pet other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Category == other.Category || + Category != null && + Category.Equals(other.Category) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ) && + ( + PhotoUrls == other.PhotoUrls || + PhotoUrls != null && + other.PhotoUrls != null && + PhotoUrls.SequenceEqual(other.PhotoUrls) + ) && + ( + Tags == other.Tags || + Tags != null && + other.Tags != null && + Tags.SequenceEqual(other.Tags) + ) && + ( + Status == other.Status || + + Status.Equals(other.Status) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Category != null) + hashCode = hashCode * 59 + Category.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + if (PhotoUrls != null) + hashCode = hashCode * 59 + PhotoUrls.GetHashCode(); + if (Tags != null) + hashCode = hashCode * 59 + Tags.GetHashCode(); + + hashCode = hashCode * 59 + Status.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Pet left, Pet right) + { + return Equals(left, right); + } + + public static bool operator !=(Pet left, Pet right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..f0a131f617ca --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,133 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A tag for a pet + /// </summary> + [DataContract] + public partial class Tag : IEquatable<Tag> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Tag)obj); + } + + /// <summary> + /// Returns true if Tag instances are equal + /// </summary> + /// <param name="other">Instance of Tag to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Tag other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Tag left, Tag right) + { + return Equals(left, right); + } + + public static bool operator !=(Tag left, Tag right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..3c8a18d63cf7 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Models/User.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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A User who is purchasing from the pet store + /// </summary> + [DataContract] + public partial class User : IEquatable<User> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Username + /// </summary> + [DataMember(Name="username", EmitDefaultValue=false)] + public string Username { get; set; } + + /// <summary> + /// Gets or Sets FirstName + /// </summary> + [DataMember(Name="firstName", EmitDefaultValue=false)] + public string FirstName { get; set; } + + /// <summary> + /// Gets or Sets LastName + /// </summary> + [DataMember(Name="lastName", EmitDefaultValue=false)] + public string LastName { get; set; } + + /// <summary> + /// Gets or Sets Email + /// </summary> + [DataMember(Name="email", EmitDefaultValue=false)] + public string Email { get; set; } + + /// <summary> + /// Gets or Sets Password + /// </summary> + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// <summary> + /// Gets or Sets Phone + /// </summary> + [DataMember(Name="phone", EmitDefaultValue=false)] + public string Phone { get; set; } + + /// <summary> + /// User Status + /// </summary> + /// <value>User Status</value> + [DataMember(Name="userStatus", EmitDefaultValue=false)] + public int UserStatus { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((User)obj); + } + + /// <summary> + /// Returns true if User instances are equal + /// </summary> + /// <param name="other">Instance of User to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(User other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Username == other.Username || + Username != null && + Username.Equals(other.Username) + ) && + ( + FirstName == other.FirstName || + FirstName != null && + FirstName.Equals(other.FirstName) + ) && + ( + LastName == other.LastName || + LastName != null && + LastName.Equals(other.LastName) + ) && + ( + Email == other.Email || + Email != null && + Email.Equals(other.Email) + ) && + ( + Password == other.Password || + Password != null && + Password.Equals(other.Password) + ) && + ( + Phone == other.Phone || + Phone != null && + Phone.Equals(other.Phone) + ) && + ( + UserStatus == other.UserStatus || + + UserStatus.Equals(other.UserStatus) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Username != null) + hashCode = hashCode * 59 + Username.GetHashCode(); + if (FirstName != null) + hashCode = hashCode * 59 + FirstName.GetHashCode(); + if (LastName != null) + hashCode = hashCode * 59 + LastName.GetHashCode(); + if (Email != null) + hashCode = hashCode * 59 + Email.GetHashCode(); + if (Password != null) + hashCode = hashCode * 59 + Password.GetHashCode(); + if (Phone != null) + hashCode = hashCode * 59 + Phone.GetHashCode(); + + hashCode = hashCode * 59 + UserStatus.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(User left, User right) + { + return Equals(left, right); + } + + public static bool operator !=(User left, User right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs new file mode 100644 index 000000000000..b862226f2c1b --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs @@ -0,0 +1,51 @@ +using System; +using System.Linq; +using System.Text; + +namespace Org.OpenAPITools.OpenApi +{ + /// <summary> + /// Replacement utilities from Swashbuckle.AspNetCore.SwaggerGen which are not in 5.x + /// </summary> + public static class TypeExtensions + { + /// <summary> + /// Produce a friendly name for the type which is unique. + /// </summary> + /// <param name="type"></param> + /// <param name="fullyQualified"></param> + public static string FriendlyId(this Type type, bool fullyQualified = false) + { + var typeName = fullyQualified + ? type.FullNameSansTypeParameters().Replace("+", ".") + : type.Name; + + if (type.IsGenericType) + { + var genericArgumentIds = type.GetGenericArguments() + .Select(t => t.FriendlyId(fullyQualified)) + .ToArray(); + + return new StringBuilder(typeName) + .Replace($"`{genericArgumentIds.Count()}", string.Empty) + .Append($"[{string.Join(",", genericArgumentIds).TrimEnd(',')}]") + .ToString(); + } + + return typeName; + } + + /// <summary> + /// Determine the fully qualified type name without type parameters. + /// </summary> + /// <param name="type"></param> + public static string FullNameSansTypeParameters(this Type type) + { + var fullName = type.FullName; + if (string.IsNullOrEmpty(fullName)) + fullName = type.Name; + var chopIndex = fullName.IndexOf("[[", StringComparison.Ordinal); + return (chopIndex == -1) ? fullName : fullName.Substring(0, chopIndex); + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..e0f43209ba77 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,24 @@ +<Project Sdk="Microsoft.NET.Sdk.Web"> + <PropertyGroup> + <Description>Org.OpenAPITools</Description> + <Copyright>Org.OpenAPITools</Copyright> + <TargetFramework>netcoreapp3.0</TargetFramework> + <GenerateDocumentationFile>true</GenerateDocumentationFile> + <PreserveCompilationContext>true</PreserveCompilationContext> + <AssemblyName>Org.OpenAPITools</AssemblyName> + <PackageId>Org.OpenAPITools</PackageId> + <UserSecretsId>bd74038c-1dca-4b76-ae76-537f7afee2ae</UserSecretsId> + <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> + <DockerfileContext>..\..</DockerfileContext> + </PropertyGroup> + <ItemGroup> + <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0"/> + <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" /> + <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.0.0"/> + <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0"/> + <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.0.0" /> + </ItemGroup> + <ItemGroup> + <!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />--> + </ItemGroup> +</Project> diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..28b87acf7538 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace Org.OpenAPITools +{ + /// <summary> + /// Program + /// </summary> + public class Program + { + /// <summary> + /// Main + /// </summary> + /// <param name="args"></param> + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + /// <summary> + /// Create the host builder. + /// </summary> + /// <param name="args"></param> + /// <returns>IHostBuilder</returns> + public static IHostBuilder CreateWebHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup<Startup>() + .UseUrls("http://0.0.0.0:8080/"); + }); + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..57b03cc43aa3 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61788", + "sslPort": 44301 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OpenAPI": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Startup.cs new file mode 100644 index 000000000000..cfcd30f6a1a3 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/Startup.cs @@ -0,0 +1,159 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.OpenApi.Models; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Serialization; +using Org.OpenAPITools.Authentication; +using Org.OpenAPITools.Filters; +using Org.OpenAPITools.OpenApi; + +namespace Org.OpenAPITools +{ + /// <summary> + /// Startup + /// </summary> + public class Startup + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="env"></param> + public Startup(IHostEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables(); + + Configuration = builder.Build(); + } + + /// <summary> + /// The application configuration. + /// </summary> + public IConfiguration Configuration { get; } + + /// <summary> + /// This method gets called by the runtime. Use this method to add services to the container. + /// </summary> + /// <param name="services"></param> + public void ConfigureServices(IServiceCollection services) + { + services.AddTransient<IAuthorizationHandler, ApiKeyRequirementHandler>(); + services.AddAuthorization(authConfig => + { + authConfig.AddPolicy("api_key", policyBuilder => + { + policyBuilder + .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"api_key")); + }); + }); + + // Add framework services. + services + // Don't need the full MVC stack for an API, see https://andrewlock.net/comparing-startup-between-the-asp-net-core-3-templates/ + .AddControllers() + .AddNewtonsoftJson(opts => + { + opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + opts.SerializerSettings.Converters.Add(new StringEnumConverter + { + NamingStrategy = new CamelCaseNamingStrategy() + }); + }); + + services + .AddSwaggerGen(c => + { + c.SwaggerDoc("1.0.0", new OpenApiInfo + { + Title = "OpenAPI Petstore", + Description = "OpenAPI Petstore (ASP.NET Core 3.0)", + TermsOfService = new Uri("https://github.com/openapitools/openapi-generator"), + Contact = new OpenApiContact + { + Name = "OpenAPI-Generator Contributors", + Url = new Uri("https://github.com/openapitools/openapi-generator"), + Email = "" + }, + License = new OpenApiLicense + { + Name = "NoLicense", + Url = new Uri("https://www.apache.org/licenses/LICENSE-2.0.html") + }, + Version = "1.0.0", + }); + c.CustomSchemaIds(type => type.FriendlyId(true)); + c.DescribeAllEnumsAsStrings(); + c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml"); + // Sets the basePath property in the Swagger document generated + c.DocumentFilter<BasePathFilter>("/v2"); + + // Include DataAnnotation attributes on Controller Action parameters as Swagger validation rules (e.g required, pattern, ..) + // Use [ValidateModelState] on Actions to actually validate it in C# as well! + c.OperationFilter<GeneratePathParamsValidationFilter>(); + }); + services + .AddSwaggerGenNewtonsoftSupport(); + } + + /// <summary> + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// </summary> + /// <param name="app"></param> + /// <param name="env"></param> + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app + // TODO: Renable if you need MVC views as well as just the API + //.UseMvc() + .UseDefaultFiles() + .UseStaticFiles() + .UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) + .UseSwaggerUI(c => + { + //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) + c.SwaggerEndpoint("/swagger/1.0.0/openapi.json", "OpenAPI Petstore"); + + //TODO: Or alternatively use the original Swagger contract that's included in the static files + // c.SwaggerEndpoint("/openapi-original.json", "OpenAPI Petstore Original"); + }); + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..def9159a7d94 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/README.md b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/README.md new file mode 100644 index 000000000000..6a0b78471a33 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/README.md @@ -0,0 +1,42 @@ +# Welcome to ASP.NET 5 Preview + +We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. + +ASP.NET 5 has been rearchitected to make it **lean** and **composable**. It's fully **open source** and available on [GitHub](http://go.microsoft.com/fwlink/?LinkID=517854). +Your new project automatically takes advantage of modern client-side utilities like [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) and [npm](http://go.microsoft.com/fwlink/?LinkId=518005) (to add client-side libraries) and [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) (for client-side build and automation tasks). + +We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015. +The ASP.NET Team + +### You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016) + +### This application consists of: +* Sample pages using ASP.NET MVC 6 +* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side resources +* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939) + +#### NEW CONCEPTS +* [The 'wwwroot' explained](http://go.microsoft.com/fwlink/?LinkId=518008) +* [Configuration in ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518012) +* [Dependency Injection](http://go.microsoft.com/fwlink/?LinkId=518013) +* [Razor TagHelpers](http://go.microsoft.com/fwlink/?LinkId=518014) +* [Manage client packages using Gulp](http://go.microsoft.com/fwlink/?LinkID=517849) +* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=517850) + +#### CUSTOMIZE APP +* [Add Controllers and Views](http://go.microsoft.com/fwlink/?LinkID=398600) +* [Add Data using EntityFramework](http://go.microsoft.com/fwlink/?LinkID=398602) +* [Add Authentication using Identity](http://go.microsoft.com/fwlink/?LinkID=398603) +* [Add real time support using SignalR](http://go.microsoft.com/fwlink/?LinkID=398606) +* [Add Class library](http://go.microsoft.com/fwlink/?LinkID=398604) +* [Add Web APIs with MVC 6](http://go.microsoft.com/fwlink/?LinkId=518009) +* [Add client packages using Bower](http://go.microsoft.com/fwlink/?LinkID=517848) + +#### DEPLOY +* [Run your app locally](http://go.microsoft.com/fwlink/?LinkID=517851) +* [Run your app on ASP.NET Core 5](http://go.microsoft.com/fwlink/?LinkID=517852) +* [Run commands in your 'project.json'](http://go.microsoft.com/fwlink/?LinkID=517853) +* [Publish to Microsoft Azure Web Sites](http://go.microsoft.com/fwlink/?LinkID=398609) +* [Publish to the file system](http://go.microsoft.com/fwlink/?LinkId=518019) + +We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015) diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/index.html b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/index.html new file mode 100644 index 000000000000..cde1f2f90b92 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/index.html @@ -0,0 +1 @@ +<meta http-equiv="refresh" content="0;URL='./swagger/'" /> \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/openapi-original.json b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/openapi-original.json new file mode 100644 index 000000000000..c72a9d39daa2 --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/openapi-original.json @@ -0,0 +1,1012 @@ +{ + "openapi" : "3.0.1", + "info" : { + "description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.", + "license" : { + "name" : "Apache-2.0", + "url" : "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + "title" : "OpenAPI Petstore", + "version" : "1.0.0" + }, + "servers" : [ { + "url" : "http://petstore.swagger.io/v2" + } ], + "tags" : [ { + "description" : "Everything about your Pets", + "name" : "pet" + }, { + "description" : "Access to Petstore orders", + "name" : "store" + }, { + "description" : "Operations about user", + "name" : "user" + } ], + "paths" : { + "/pet" : { + "post" : { + "operationId" : "addPet", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "Pet object that needs to be added to the store", + "required" : true + }, + "responses" : { + "405" : { + "content" : { }, + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Add a new pet to the store", + "tags" : [ "pet" ], + "x-codegen-request-body-name" : "body" + }, + "put" : { + "operationId" : "updatePet", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "Pet object that needs to be added to the store", + "required" : true + }, + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Pet not found" + }, + "405" : { + "content" : { }, + "description" : "Validation exception" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Update an existing pet", + "tags" : [ "pet" ], + "x-codegen-request-body-name" : "body" + } + }, + "/pet/findByStatus" : { + "get" : { + "description" : "Multiple status values can be provided with comma separated strings", + "operationId" : "findPetsByStatus", + "parameters" : [ { + "description" : "Status values that need to be considered for filter", + "explode" : false, + "in" : "query", + "name" : "status", + "required" : true, + "schema" : { + "items" : { + "default" : "available", + "enum" : [ "available", "pending", "sold" ], + "type" : "string" + }, + "type" : "array" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + }, + "application/json" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid status value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Finds Pets by status", + "tags" : [ "pet" ] + } + }, + "/pet/findByTags" : { + "get" : { + "deprecated" : true, + "description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId" : "findPetsByTags", + "parameters" : [ { + "description" : "Tags to filter by", + "explode" : false, + "in" : "query", + "name" : "tags", + "required" : true, + "schema" : { + "items" : { + "type" : "string" + }, + "type" : "array" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + }, + "application/json" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid tag value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Finds Pets by tags", + "tags" : [ "pet" ] + } + }, + "/pet/{petId}" : { + "delete" : { + "operationId" : "deletePet", + "parameters" : [ { + "in" : "header", + "name" : "api_key", + "schema" : { + "type" : "string" + } + }, { + "description" : "Pet id to delete", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid pet value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Deletes a pet", + "tags" : [ "pet" ] + }, + "get" : { + "description" : "Returns a single pet", + "operationId" : "getPetById", + "parameters" : [ { + "description" : "ID of pet to return", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Pet not found" + } + }, + "security" : [ { + "api_key" : [ ] + } ], + "summary" : "Find pet by ID", + "tags" : [ "pet" ] + }, + "post" : { + "operationId" : "updatePetWithForm", + "parameters" : [ { + "description" : "ID of pet that needs to be updated", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "requestBody" : { + "content" : { + "application/x-www-form-urlencoded" : { + "schema" : { + "properties" : { + "name" : { + "description" : "Updated name of the pet", + "type" : "string" + }, + "status" : { + "description" : "Updated status of the pet", + "type" : "string" + } + } + } + } + } + }, + "responses" : { + "405" : { + "content" : { }, + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Updates a pet in the store with form data", + "tags" : [ "pet" ] + } + }, + "/pet/{petId}/uploadImage" : { + "post" : { + "operationId" : "uploadFile", + "parameters" : [ { + "description" : "ID of pet to update", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "properties" : { + "additionalMetadata" : { + "description" : "Additional data to pass to server", + "type" : "string" + }, + "file" : { + "description" : "file to upload", + "format" : "binary", + "type" : "string" + } + } + } + } + } + }, + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ApiResponse" + } + } + }, + "description" : "successful operation" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "uploads an image", + "tags" : [ "pet" ] + } + }, + "/store/inventory" : { + "get" : { + "description" : "Returns a map of status codes to quantities", + "operationId" : "getInventory", + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "additionalProperties" : { + "format" : "int32", + "type" : "integer" + }, + "type" : "object" + } + } + }, + "description" : "successful operation" + } + }, + "security" : [ { + "api_key" : [ ] + } ], + "summary" : "Returns pet inventories by status", + "tags" : [ "store" ] + } + }, + "/store/order" : { + "post" : { + "operationId" : "placeOrder", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "order placed for purchasing the pet", + "required" : true + }, + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid Order" + } + }, + "summary" : "Place an order for a pet", + "tags" : [ "store" ], + "x-codegen-request-body-name" : "body" + } + }, + "/store/order/{orderId}" : { + "delete" : { + "description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId" : "deleteOrder", + "parameters" : [ { + "description" : "ID of the order that needs to be deleted", + "in" : "path", + "name" : "orderId", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Order not found" + } + }, + "summary" : "Delete purchase order by ID", + "tags" : [ "store" ] + }, + "get" : { + "description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId" : "getOrderById", + "parameters" : [ { + "description" : "ID of pet that needs to be fetched", + "in" : "path", + "name" : "orderId", + "required" : true, + "schema" : { + "format" : "int64", + "maximum" : 5, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Order not found" + } + }, + "summary" : "Find purchase order by ID", + "tags" : [ "store" ] + } + }, + "/user" : { + "post" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "createUser", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "Created user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Create user", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/createWithArray" : { + "post" : { + "operationId" : "createUsersWithArrayInput", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/User" + }, + "type" : "array" + } + } + }, + "description" : "List of user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Creates list of users with given input array", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/createWithList" : { + "post" : { + "operationId" : "createUsersWithListInput", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/User" + }, + "type" : "array" + } + } + }, + "description" : "List of user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Creates list of users with given input array", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/login" : { + "get" : { + "operationId" : "loginUser", + "parameters" : [ { + "description" : "The user name for login", + "in" : "query", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "description" : "The password for login in clear text", + "in" : "query", + "name" : "password", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "type" : "string" + } + }, + "application/json" : { + "schema" : { + "type" : "string" + } + } + }, + "description" : "successful operation", + "headers" : { + "X-Rate-Limit" : { + "description" : "calls per hour allowed by the user", + "schema" : { + "format" : "int32", + "type" : "integer" + } + }, + "X-Expires-After" : { + "description" : "date in UTC when toekn expires", + "schema" : { + "format" : "date-time", + "type" : "string" + } + } + } + }, + "400" : { + "content" : { }, + "description" : "Invalid username/password supplied" + } + }, + "summary" : "Logs user into the system", + "tags" : [ "user" ] + } + }, + "/user/logout" : { + "get" : { + "operationId" : "logoutUser", + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Logs out current logged in user session", + "tags" : [ "user" ] + } + }, + "/user/{username}" : { + "delete" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "deleteUser", + "parameters" : [ { + "description" : "The name that needs to be deleted", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid username supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Delete user", + "tags" : [ "user" ] + }, + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "description" : "The name that needs to be fetched. Use user1 for testing.", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid username supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Get user by user name", + "tags" : [ "user" ] + }, + "put" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "updateUser", + "parameters" : [ { + "description" : "name that need to be deleted", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "Updated user object", + "required" : true + }, + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid user supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Updated user", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + } + }, + "components" : { + "schemas" : { + "Order" : { + "description" : "An order for a pets from the pet store", + "example" : { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "petId" : { + "format" : "int64", + "type" : "integer" + }, + "quantity" : { + "format" : "int32", + "type" : "integer" + }, + "shipDate" : { + "format" : "date-time", + "type" : "string" + }, + "status" : { + "description" : "Order Status", + "enum" : [ "placed", "approved", "delivered" ], + "type" : "string" + }, + "complete" : { + "default" : false, + "type" : "boolean" + } + }, + "title" : "Pet Order", + "type" : "object", + "xml" : { + "name" : "Order" + } + }, + "Category" : { + "description" : "A category for a pet", + "example" : { + "name" : "name", + "id" : 6 + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "name" : { + "type" : "string" + } + }, + "title" : "Pet category", + "type" : "object", + "xml" : { + "name" : "Category" + } + }, + "User" : { + "description" : "A User who is purchasing from the pet store", + "example" : { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "username" : { + "type" : "string" + }, + "firstName" : { + "type" : "string" + }, + "lastName" : { + "type" : "string" + }, + "email" : { + "type" : "string" + }, + "password" : { + "type" : "string" + }, + "phone" : { + "type" : "string" + }, + "userStatus" : { + "description" : "User Status", + "format" : "int32", + "type" : "integer" + } + }, + "title" : "a User", + "type" : "object", + "xml" : { + "name" : "User" + } + }, + "Tag" : { + "description" : "A tag for a pet", + "example" : { + "name" : "name", + "id" : 1 + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "name" : { + "type" : "string" + } + }, + "title" : "Pet Tag", + "type" : "object", + "xml" : { + "name" : "Tag" + } + }, + "Pet" : { + "description" : "A pet for sale in the pet store", + "example" : { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "category" : { + "$ref" : "#/components/schemas/Category" + }, + "name" : { + "example" : "doggie", + "type" : "string" + }, + "photoUrls" : { + "items" : { + "type" : "string" + }, + "type" : "array", + "xml" : { + "name" : "photoUrl", + "wrapped" : true + } + }, + "tags" : { + "items" : { + "$ref" : "#/components/schemas/Tag" + }, + "type" : "array", + "xml" : { + "name" : "tag", + "wrapped" : true + } + }, + "status" : { + "description" : "pet status in the store", + "enum" : [ "available", "pending", "sold" ], + "type" : "string" + } + }, + "required" : [ "name", "photoUrls" ], + "title" : "a Pet", + "type" : "object", + "xml" : { + "name" : "Pet" + } + }, + "ApiResponse" : { + "description" : "Describes the result of uploading an image resource", + "example" : { + "code" : 0, + "type" : "type", + "message" : "message" + }, + "properties" : { + "code" : { + "format" : "int32", + "type" : "integer" + }, + "type" : { + "type" : "string" + }, + "message" : { + "type" : "string" + } + }, + "title" : "An uploaded response", + "type" : "object" + } + }, + "securitySchemes" : { + "petstore_auth" : { + "flows" : { + "implicit" : { + "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", + "scopes" : { + "write:pets" : "modify pets in your account", + "read:pets" : "read your pets" + } + } + }, + "type" : "oauth2" + }, + "api_key" : { + "in" : "header", + "name" : "api_key", + "type" : "apiKey" + } + } + } +} diff --git a/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/web.config b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/web.config new file mode 100644 index 000000000000..e70a7778d60b --- /dev/null +++ b/samples/server/petstore/aspnetcore3/src/Org.OpenAPITools/wwwroot/web.config @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <system.webServer> + <handlers> + <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/> + </handlers> + <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/> + </system.webServer> +</configuration> From cbc006a93854bf064e2279b0944192742b719eac Mon Sep 17 00:00:00 2001 From: Justin Black <spacether@users.noreply.github.com> Date: Sun, 3 May 2020 11:44:04 -0700 Subject: [PATCH 60/78] Adds memoization and deserialization through 2 or more discriminators (#6124) * Adds cached_property decorator, adds feature to move through n discriminators * Adds v3 sample with 2 discriminators * Adds tests of Shape, Tringle, and Quadrilateral traveling through 2 discriminators * Adds test_deserialization.py:test_deserialize_shape * Simplifes XTriangle sample spec schemas * Simplifies Shape schema definition, updates go+python-experimental samples * Fixes python-experimental test_dog tests * Separates off python-experimental spec --- bin/openapi3/python-experimental-petstore.sh | 2 +- .../python/python-experimental/model.mustache | 3 + .../model_templates/classvars.mustache | 4 +- .../method_discriminator.mustache | 6 +- .../method_init_composed.mustache | 2 + .../method_init_normal.mustache | 1 + .../method_init_shared.mustache | 21 +- .../method_set_attribute.mustache | 5 +- .../model_templates/model_composed.mustache | 2 +- .../model_templates/model_normal.mustache | 4 +- .../model_templates/model_simple.mustache | 4 +- .../python-experimental/model_utils.mustache | 161 +- ...odels-for-testing-with-http-signature.yaml | 1936 +++++++++++++++++ .../petstore_api/model_utils.py | 166 +- .../models/additional_properties_any_type.py | 31 +- .../models/additional_properties_array.py | 31 +- .../models/additional_properties_boolean.py | 31 +- .../models/additional_properties_class.py | 31 +- .../models/additional_properties_integer.py | 31 +- .../models/additional_properties_number.py | 31 +- .../models/additional_properties_object.py | 31 +- .../models/additional_properties_string.py | 31 +- .../petstore_api/models/animal.py | 37 +- .../petstore_api/models/api_response.py | 31 +- .../models/array_of_array_of_number_only.py | 31 +- .../models/array_of_number_only.py | 31 +- .../petstore_api/models/array_test.py | 31 +- .../petstore_api/models/capitalization.py | 31 +- .../petstore_api/models/cat.py | 36 +- .../petstore_api/models/cat_all_of.py | 31 +- .../petstore_api/models/category.py | 31 +- .../petstore_api/models/child.py | 30 +- .../petstore_api/models/child_all_of.py | 31 +- .../petstore_api/models/child_cat.py | 36 +- .../petstore_api/models/child_cat_all_of.py | 31 +- .../petstore_api/models/child_dog.py | 36 +- .../petstore_api/models/child_dog_all_of.py | 31 +- .../petstore_api/models/child_lizard.py | 36 +- .../models/child_lizard_all_of.py | 31 +- .../petstore_api/models/class_model.py | 31 +- .../petstore_api/models/client.py | 31 +- .../petstore_api/models/dog.py | 36 +- .../petstore_api/models/dog_all_of.py | 31 +- .../petstore_api/models/enum_arrays.py | 31 +- .../petstore_api/models/enum_class.py | 31 +- .../petstore_api/models/enum_test.py | 31 +- .../petstore_api/models/file.py | 31 +- .../models/file_schema_test_class.py | 31 +- .../petstore_api/models/format_test.py | 31 +- .../petstore_api/models/grandparent.py | 31 +- .../petstore_api/models/grandparent_animal.py | 37 +- .../petstore_api/models/has_only_read_only.py | 31 +- .../petstore_api/models/list.py | 31 +- .../petstore_api/models/map_test.py | 31 +- ...perties_and_additional_properties_class.py | 31 +- .../petstore_api/models/model200_response.py | 31 +- .../petstore_api/models/model_return.py | 31 +- .../petstore_api/models/name.py | 31 +- .../petstore_api/models/number_only.py | 31 +- .../petstore_api/models/order.py | 31 +- .../petstore_api/models/outer_composite.py | 31 +- .../petstore_api/models/outer_enum.py | 31 +- .../petstore_api/models/outer_number.py | 31 +- .../petstore_api/models/parent.py | 30 +- .../petstore_api/models/parent_all_of.py | 31 +- .../petstore_api/models/parent_pet.py | 36 +- .../petstore_api/models/pet.py | 31 +- .../petstore_api/models/player.py | 31 +- .../petstore_api/models/read_only_first.py | 31 +- .../petstore_api/models/special_model_name.py | 31 +- .../petstore_api/models/string_boolean_map.py | 31 +- .../petstore_api/models/tag.py | 31 +- .../models/type_holder_default.py | 31 +- .../models/type_holder_example.py | 31 +- .../petstore_api/models/user.py | 31 +- .../petstore_api/models/xml_item.py | 31 +- .../python-experimental/test/test_child.py | 2 +- .../python-experimental/test/test_dog.py | 2 +- .../petstore/python-experimental/README.md | 11 + .../docs/ComplexQuadrilateral.md | 11 + .../docs/EquilateralTriangle.md | 11 + .../docs/IsoscelesTriangle.md | 11 + .../python-experimental/docs/Quadrilateral.md | 11 + .../docs/QuadrilateralInterface.md | 10 + .../docs/ScaleneTriangle.md | 11 + .../python-experimental/docs/Shape.md | 12 + .../docs/ShapeInterface.md | 10 + .../docs/SimpleQuadrilateral.md | 11 + .../python-experimental/docs/Triangle.md | 11 + .../docs/TriangleInterface.md | 10 + .../petstore_api/__init__.py | 11 + .../petstore_api/model_utils.py | 166 +- .../models/additional_properties_class.py | 31 +- .../petstore_api/models/address.py | 31 +- .../petstore_api/models/animal.py | 37 +- .../petstore_api/models/api_response.py | 31 +- .../petstore_api/models/apple.py | 31 +- .../petstore_api/models/apple_req.py | 31 +- .../models/array_of_array_of_number_only.py | 31 +- .../models/array_of_number_only.py | 31 +- .../petstore_api/models/array_test.py | 31 +- .../petstore_api/models/banana.py | 31 +- .../petstore_api/models/banana_req.py | 31 +- .../petstore_api/models/capitalization.py | 31 +- .../petstore_api/models/cat.py | 36 +- .../petstore_api/models/cat_all_of.py | 31 +- .../petstore_api/models/category.py | 31 +- .../petstore_api/models/class_model.py | 31 +- .../petstore_api/models/client.py | 31 +- .../models/complex_quadrilateral.py | 216 ++ .../petstore_api/models/dog.py | 36 +- .../petstore_api/models/dog_all_of.py | 31 +- .../petstore_api/models/enum_arrays.py | 31 +- .../petstore_api/models/enum_class.py | 31 +- .../petstore_api/models/enum_test.py | 31 +- .../models/equilateral_triangle.py | 216 ++ .../petstore_api/models/file.py | 31 +- .../models/file_schema_test_class.py | 31 +- .../petstore_api/models/foo.py | 31 +- .../petstore_api/models/format_test.py | 31 +- .../petstore_api/models/fruit.py | 30 +- .../petstore_api/models/fruit_req.py | 30 +- .../petstore_api/models/gm_fruit.py | 30 +- .../petstore_api/models/has_only_read_only.py | 31 +- .../models/health_check_result.py | 31 +- .../petstore_api/models/inline_object.py | 31 +- .../petstore_api/models/inline_object1.py | 31 +- .../petstore_api/models/inline_object2.py | 31 +- .../petstore_api/models/inline_object3.py | 31 +- .../petstore_api/models/inline_object4.py | 31 +- .../petstore_api/models/inline_object5.py | 31 +- .../models/inline_response_default.py | 31 +- .../petstore_api/models/isosceles_triangle.py | 216 ++ .../petstore_api/models/list.py | 31 +- .../petstore_api/models/mammal.py | 36 +- .../petstore_api/models/map_test.py | 31 +- ...perties_and_additional_properties_class.py | 31 +- .../petstore_api/models/model200_response.py | 31 +- .../petstore_api/models/model_return.py | 31 +- .../petstore_api/models/name.py | 31 +- .../petstore_api/models/nullable_class.py | 31 +- .../petstore_api/models/number_only.py | 31 +- .../petstore_api/models/order.py | 31 +- .../petstore_api/models/outer_composite.py | 31 +- .../petstore_api/models/outer_enum.py | 31 +- .../models/outer_enum_default_value.py | 31 +- .../petstore_api/models/outer_enum_integer.py | 31 +- .../outer_enum_integer_default_value.py | 31 +- .../petstore_api/models/pet.py | 31 +- .../petstore_api/models/quadrilateral.py | 235 ++ .../models/quadrilateral_interface.py | 155 ++ .../petstore_api/models/read_only_first.py | 31 +- .../petstore_api/models/scalene_triangle.py | 216 ++ .../petstore_api/models/shape.py | 239 ++ .../petstore_api/models/shape_interface.py | 155 ++ .../models/simple_quadrilateral.py | 216 ++ .../petstore_api/models/special_model_name.py | 31 +- .../petstore_api/models/string_boolean_map.py | 31 +- .../petstore_api/models/tag.py | 31 +- .../petstore_api/models/triangle.py | 242 +++ .../petstore_api/models/triangle_interface.py | 155 ++ .../petstore_api/models/user.py | 31 +- .../petstore_api/models/whale.py | 31 +- .../petstore_api/models/zebra.py | 31 +- .../test/test_complex_quadrilateral.py | 37 + .../test/test_equilateral_triangle.py | 37 + .../python-experimental/test/test_fruit.py | 8 +- .../test/test_fruit_req.py | 8 +- .../python-experimental/test/test_gm_fruit.py | 10 +- .../test/test_isosceles_triangle.py | 37 + .../test/test_quadrilateral.py | 38 + .../test/test_quadrilateral_interface.py | 37 + .../test/test_scalene_triangle.py | 37 + .../python-experimental/test/test_shape.py | 84 + .../test/test_shape_interface.py | 37 + .../test/test_simple_quadrilateral.py | 37 + .../python-experimental/test/test_triangle.py | 40 + .../test/test_triangle_interface.py | 37 + .../tests/test_deserialization.py | 42 + 179 files changed, 8339 insertions(+), 947 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/Shape.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/Triangle.md create mode 100644 samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_shape.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_triangle.py create mode 100644 samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py diff --git a/bin/openapi3/python-experimental-petstore.sh b/bin/openapi3/python-experimental-petstore.sh index 71cd902dee57..20d0595485c3 100755 --- a/bin/openapi3/python-experimental-petstore.sh +++ b/bin/openapi3/python-experimental-petstore.sh @@ -28,7 +28,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" #yaml="modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml" -yaml="modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml" +yaml="modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml" ags="generate -t modules/openapi-generator/src/main/resources/python -i $yaml -g python-experimental -o samples/openapi3/client/petstore/python-experimental/ --additional-properties packageName=petstore_api $@" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache index ef7da5728252..9afb17b52776 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model.mustache @@ -13,6 +13,9 @@ from {{packageName}}.model_utils import ( # noqa: F401 ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache index 8b49e58edbf2..fe54e34f5bb6 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/classvars.mustache @@ -94,7 +94,7 @@ additional_properties_type = {{#additionalPropertiesType}}({{{additionalPropertiesType}}},) # noqa: E501{{/additionalPropertiesType}}{{^additionalPropertiesType}}None{{/additionalPropertiesType}} - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -113,7 +113,7 @@ {{/optionalVars}} } - @staticmethod + @cached_property def discriminator(): {{^discriminator}}return None{{/discriminator}}{{#discriminator}}val = { {{#mappedModels}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache index c4baa722ffb5..de06fb461ebc 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_discriminator.mustache @@ -1,10 +1,10 @@ @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache index e00bf129b247..a5d948f0dd8c 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_composed.mustache @@ -4,6 +4,7 @@ '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', @@ -16,6 +17,7 @@ '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { {{#requiredVars}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache index d26506c56c31..8433c49f2f6a 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_normal.mustache @@ -4,6 +4,7 @@ '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) {{> python-experimental/model_templates/method_init_shared }} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache index 9dd5bc2b6f3f..1631d57eec29 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_init_shared.mustache @@ -1,4 +1,5 @@ - def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}, {{name}}={{{defaultValue}}}{{/defaultValue}}{{/requiredVars}}, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}, {{name}}={{{defaultValue}}}{{/defaultValue}}{{/requiredVars}}, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """{{classname}} - a model defined in OpenAPI {{#requiredVars}} @@ -31,6 +32,21 @@ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) {{#optionalVars}} {{name}} ({{{dataType}}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} # noqa: E501 {{/optionalVars}} @@ -40,4 +56,5 @@ self._check_type = _check_type self._from_server = _from_server self._path_to_item = _path_to_item - self._configuration = _configuration \ No newline at end of file + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache index bcafb71368f1..f4a36e42f25b 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/method_set_attribute.mustache @@ -6,9 +6,8 @@ path_to_item.extend(self._path_to_item) path_to_item.append(name) - openapi_types = self.openapi_types() - if name in openapi_types: - required_types_mixed = openapi_types[name] + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache index d53d89cef2be..002b2a578952 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_composed.mustache @@ -26,7 +26,7 @@ class {{unescapedDescription}}(ModelComposed): {{> python-experimental/model_templates/method_init_composed }} - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache index 8bfe6ada48d8..f9d82ef2a802 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_normal.mustache @@ -24,9 +24,7 @@ class {{unescapedDescription}}(ModelNormal): {{/optionalVars}} } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} {{> python-experimental/model_templates/method_init_normal}}{{#discriminator}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache index 465918dfa5c0..95b8a81715b2 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_templates/model_simple.mustache @@ -11,8 +11,6 @@ class {{unescapedDescription}}(ModelSimple): {{> python-experimental/model_templates/classvars }} - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None {{> python-experimental/model_templates/method_init_normal}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache index 58da408a19eb..e6b1df6b0e99 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_utils.mustache @@ -35,6 +35,24 @@ else: from builtins import int, str +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + try: + return vars(self)[self.result_key] + except KeyError: + result = self._fn() + setattr(self, self.result_key, result) + return result + + class OpenApiModel(object): """The base class for all OpenAPIModels""" @@ -42,6 +60,55 @@ class OpenApiModel(object): {{> python-experimental/model_templates/methods_shared }} + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # we don't have a discriminator + # or we have already visited this class before and are sure that we + # want to instantiate it this time + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_classes = [] + oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) + oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) + new_cls = cls.get_discriminator_class(kwargs) + if new_cls is None: + disc_prop_name_py = list(cls.discriminator.keys())[0] + disc_prop_name_js = cls.attribute_map[disc_prop_name_py] + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + disc_prop_name_js, kwargs.get(disc_prop_name_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (disc_prop_name_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are coming from the chosen new_cls use cls instead + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + class ModelSimple(OpenApiModel): """the parent class of models whose type != object in their @@ -473,10 +540,12 @@ def change_keys_js_to_python(input_dict, model_class): document). """ + if getattr(model_class, 'attribute_map', None) is None: + return input_dict output_dict = {} reversed_attr_map = {value: key for key, value in - six.iteritems(model_class.attribute_map)} - for javascript_key, value in six.iteritems(input_dict): + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): python_key = reversed_attr_map.get(javascript_key) if python_key is None: # if the key is unknown, it is in error or it is an @@ -553,21 +622,6 @@ def deserialize_primitive(data, klass, path_to_item): ) -def fix_model_input_data(model_data, model_class): - # this is only called on classes where the input data is a dict - fixed_model_data = change_keys_js_to_python( - model_data, - model_class - ) - if model_class._composed_schemas() is not None: - for allof_class in model_class._composed_schemas()['allOf']: - fixed_model_data = change_keys_js_to_python( - fixed_model_data, - allof_class - ) - return fixed_model_data - - def deserialize_model(model_data, model_class, path_to_item, check_type, configuration, from_server): """Deserializes model_data to model instance. @@ -596,23 +650,14 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, _configuration=configuration, _from_server=from_server) - used_model_class = model_class - if model_class.discriminator() is not None: - used_model_class = model_class.get_discriminator_class( - from_server, model_data) - - if issubclass(used_model_class, ModelSimple): - instance = used_model_class(value=model_data, **kw_args) + if issubclass(model_class, ModelSimple): + instance = model_class(value=model_data, **kw_args) return instance if isinstance(model_data, list): - instance = used_model_class(*model_data, **kw_args) + instance = model_class(*model_data, **kw_args) if isinstance(model_data, dict): - fixed_model_data = change_keys_js_to_python( - model_data, - used_model_class - ) - kw_args.update(fixed_model_data) - instance = used_model_class(**kw_args) + kw_args.update(model_data) + instance = model_class(**kw_args) return instance @@ -833,7 +878,7 @@ def model_to_dict(model_instance, serialize=True): result = {} model_instances = [model_instance] - if model_instance._composed_schemas() is not None: + if model_instance._composed_schemas: model_instances.extend(model_instance._composed_instances) for model_instance in model_instances: for attr, value in six.iteritems(model_instance._data_store): @@ -914,6 +959,17 @@ def get_py3_class_name(input_class): return input_class.__name__ +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + from_server = kwargs.get('_from_server', False) + if from_server: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + def get_allof_instances(self, model_args, constant_args): """ Args: @@ -927,18 +983,17 @@ def get_allof_instances(self, model_args, constant_args): composed_instances (list) """ composed_instances = [] - for allof_class in self._composed_schemas()['allOf']: - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_args, allof_class) + for allof_class in self._composed_schemas['allOf']: + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(allof_class.openapi_types().keys()) + var_names = set(allof_class.openapi_types.keys()) for var_name in var_names: - if var_name in fixed_model_args: - kwargs[var_name] = fixed_model_args[var_name] + if var_name in model_args: + kwargs[var_name] = model_args[var_name] # and use it to make the instance kwargs.update(constant_args) @@ -950,8 +1005,8 @@ def get_allof_instances(self, model_args, constant_args): "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( - allof_class.__class__.__name__, - allof_class.__class__.__name__, + allof_class.__name__, + allof_class.__name__, self.__class__.__name__, str(ex) ) @@ -979,13 +1034,13 @@ def get_oneof_instance(self, model_args, constant_args): Returns oneof_instance (instance/None) """ - if len(self._composed_schemas()['oneOf']) == 0: + if len(self._composed_schemas['oneOf']) == 0: return None oneof_instances = [] # Iterate over each oneOf schema and determine if the input data # matches the oneOf schemas. - for oneof_class in self._composed_schemas()['oneOf']: + for oneof_class in self._composed_schemas['oneOf']: # transform js keys from input data to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python( model_args, oneof_class) @@ -995,7 +1050,7 @@ def get_oneof_instance(self, model_args, constant_args): # additionalProperties attribute in the OAS document) are not added to # the dict. kwargs = {} - var_names = set(oneof_class.openapi_types().keys()) + var_names = set(oneof_class.openapi_types.keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1039,16 +1094,16 @@ def get_anyof_instances(self, model_args, constant_args): anyof_instances (list) """ anyof_instances = [] - if len(self._composed_schemas()['anyOf']) == 0: + if len(self._composed_schemas['anyOf']) == 0: return anyof_instances - for anyof_class in self._composed_schemas()['anyOf']: + for anyof_class in self._composed_schemas['anyOf']: # transform js keys to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python(model_args, anyof_class) # extract a dict of only required keys from these_model_vars kwargs = {} - var_names = set(anyof_class.openapi_types().keys()) + var_names = set(anyof_class.openapi_types.keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1089,7 +1144,7 @@ def get_var_name_to_model_instances(self, composed_instances): all_instances = [self] all_instances.extend(composed_instances) for instance in all_instances: - for var_name in instance.openapi_types(): + for var_name in instance.openapi_types: if var_name not in var_name_to_model_instances: var_name_to_model_instances[var_name] = [instance] else: @@ -1105,7 +1160,7 @@ def get_unused_args(self, composed_instances, model_args): if var_name_py in unused_args: del unused_args[var_name_py] for instance in composed_instances: - if instance.__class__ in self._composed_schemas()['allOf']: + if instance.__class__ in self._composed_schemas['allOf']: for var_name_py in instance.attribute_map: if var_name_py in unused_args: del unused_args[var_name_py] @@ -1125,9 +1180,7 @@ def validate_get_composed_info(constant_args, model_args, self): Openapi schemas are python classes. Exceptions are raised if: - - no oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data + - 0 or > 1 oneOf schema matches the model_args input data - no anyOf schema matches the model_args input data - any of the allOf schemas do not match the model_args input data @@ -1136,7 +1189,7 @@ def validate_get_composed_info(constant_args, model_args, self): model_args (dict): these are the required and optional spec args that were passed in to make this model self (class): the class that we are instantiating - This class contains self._composed_schemas() + This class contains self._composed_schemas Returns: composed_info (list): length three diff --git a/modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml new file mode 100644 index 000000000000..066d7f295127 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -0,0 +1,1936 @@ +openapi: 3.0.0 +info: + description: >- + This spec is mainly for testing Petstore server and contains fake endpoints, + models. Please do not use this for any other purpose. Special characters: " + \ + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /foo: + get: + responses: + default: + description: response + content: + application/json: + schema: + type: object + properties: + string: + $ref: '#/components/schemas/Foo' + /pet: + servers: + - url: 'http://petstore.swagger.io/v2' + - url: 'http://path-server-test.petstore.local/v2' + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '405': + description: Invalid input + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: >- + Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid tag value + security: + - http_signature_test: [] + - petstore_auth: + - 'write:pets' + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + '/store/order/{order_id}': + get: + tags: + - store + summary: Find purchase order by ID + description: >- + For valid response try integer IDs with value <= 5 or > 10. Other values + will generated exceptions + operationId: getOrderById + parameters: + - name: order_id + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: >- + For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: order_id + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + /fake_classname_test: + patch: + tags: + - 'fake_classname_tags 123#$%^' + summary: To test class name in snake case + description: To test class name in snake case + operationId: testClassname + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + security: + - api_key_query: [] + requestBody: + $ref: '#/components/requestBodies/Client' + /fake: + patch: + tags: + - fake + summary: To test "client" model + description: To test "client" model + operationId: testClientModel + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + requestBody: + $ref: '#/components/requestBodies/Client' + get: + tags: + - fake + summary: To test enum parameters + description: To test enum parameters + operationId: testEnumParameters + parameters: + - name: enum_header_string_array + in: header + description: Header parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + - name: enum_header_string + in: header + description: Header parameter enum test (string) + schema: + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + - name: enum_query_string_array + in: query + description: Query parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + - name: enum_query_string + in: query + description: Query parameter enum test (string) + schema: + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + - name: enum_query_integer + in: query + description: Query parameter enum test (double) + schema: + type: integer + format: int32 + enum: + - 1 + - -2 + - name: enum_query_double + in: query + description: Query parameter enum test (double) + schema: + type: number + format: double + enum: + - 1.1 + - -1.2 + responses: + '400': + description: Invalid request + '404': + description: Not found + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + enum_form_string: + description: Form parameter enum test (string) + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + post: + tags: + - fake + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - http_basic_test: [] + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + integer: + description: None + type: integer + minimum: 10 + maximum: 100 + int32: + description: None + type: integer + format: int32 + minimum: 20 + maximum: 200 + int64: + description: None + type: integer + format: int64 + number: + description: None + type: number + minimum: 32.1 + maximum: 543.2 + float: + description: None + type: number + format: float + maximum: 987.6 + double: + description: None + type: number + format: double + minimum: 67.8 + maximum: 123.4 + string: + description: None + type: string + pattern: '/[a-z]/i' + pattern_without_delimiter: + description: None + type: string + pattern: '^[A-Z].*' + byte: + description: None + type: string + format: byte + binary: + description: None + type: string + format: binary + date: + description: None + type: string + format: date + dateTime: + description: None + type: string + format: date-time + password: + description: None + type: string + format: password + minLength: 10 + maxLength: 64 + callback: + description: None + type: string + required: + - number + - double + - pattern_without_delimiter + - byte + delete: + tags: + - fake + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + x-group-parameters: true + parameters: + - name: required_string_group + in: query + description: Required String in group parameters + required: true + schema: + type: integer + - name: required_boolean_group + in: header + description: Required Boolean in group parameters + required: true + schema: + type: boolean + - name: required_int64_group + in: query + description: Required Integer in group parameters + required: true + schema: + type: integer + format: int64 + - name: string_group + in: query + description: String in group parameters + schema: + type: integer + - name: boolean_group + in: header + description: Boolean in group parameters + schema: + type: boolean + - name: int64_group + in: query + description: Integer in group parameters + schema: + type: integer + format: int64 + responses: + '400': + description: Someting wrong + /fake/outer/number: + post: + tags: + - fake + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + responses: + '200': + description: Output number + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + /fake/outer/string: + post: + tags: + - fake + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + responses: + '200': + description: Output string + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + /fake/outer/boolean: + post: + tags: + - fake + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + responses: + '200': + description: Output boolean + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + /fake/outer/composite: + post: + tags: + - fake + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + responses: + '200': + description: Output composite + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + /fake/jsonFormData: + get: + tags: + - fake + summary: test json serialization of form data + description: '' + operationId: testJsonFormData + responses: + '200': + description: successful operation + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + /fake/inline-additionalProperties: + post: + tags: + - fake + summary: test inline additionalProperties + description: '' + operationId: testInlineAdditionalProperties + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + type: object + additionalProperties: + type: string + description: request body + required: true + /fake/body-with-query-params: + put: + tags: + - fake + operationId: testBodyWithQueryParams + parameters: + - name: query + in: query + required: true + schema: + type: string + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + /another-fake/dummy: + patch: + tags: + - $another-fake? + summary: To test special tags + description: To test special tags and operation ID starting with number + operationId: '123_test_@#$%_special_tags' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + requestBody: + $ref: '#/components/requestBodies/Client' + /fake/body-with-file-schema: + put: + tags: + - fake + description: >- + For this test, the body for this request much reference a schema named + `File`. + operationId: testBodyWithFileSchema + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + /fake/test-query-paramters: + put: + tags: + - fake + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - name: pipe + in: query + required: true + schema: + type: array + items: + type: string + - name: ioutil + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: http + in: query + required: true + style: spaceDelimited + schema: + type: array + items: + type: string + - name: url + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: context + in: query + required: true + explode: true + schema: + type: array + items: + type: string + responses: + "200": + description: Success + '/fake/{petId}/uploadImageWithRequiredFile': + post: + tags: + - pet + summary: uploads an image (required) + description: '' + operationId: uploadFileWithRequiredFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + type: string + format: binary + required: + - requiredFile + /fake/health: + get: + tags: + - fake + summary: Health check endpoint + responses: + 200: + description: The instance started successfully + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' +servers: + - url: 'http://{server}.swagger.io:{port}/v2' + description: petstore server + variables: + server: + enum: + - 'petstore' + - 'qa-petstore' + - 'dev-petstore' + default: 'petstore' + port: + enum: + - 80 + - 8080 + default: 80 + - url: https://localhost:8080/{version} + description: The local server + variables: + version: + enum: + - 'v1' + - 'v2' + default: 'v2' +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header + api_key_query: + type: apiKey + name: api_key_query + in: query + http_basic_test: + type: http + scheme: basic + bearer_test: + type: http + scheme: bearer + bearerFormat: JWT + http_signature_test: + # Test the 'HTTP signature' security scheme. + # Each HTTP request is cryptographically signed as specified + # in https://datatracker.ietf.org/doc/draft-cavage-http-signatures/ + type: http + scheme: signature + schemas: + Foo: + type: object + properties: + bar: + $ref: '#/components/schemas/Bar' + Bar: + type: string + default: bar + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + default: default-name + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + arbitraryObject: + type: object + description: test code generation for objects + Value must be a map of strings to values. It cannot be the 'null' value. + arbitraryNullableObject: + type: object + description: test code generation for nullable objects. + Value must be a map of strings to values or the 'null' value. + nullable: true + arbitraryTypeValue: + description: test code generation for any type + Value can be any type - string, number, boolean, array or object. + arbitraryNullableTypeValue: + description: test code generation for any type + Value can be any type - string, number, boolean, array, object or + the 'null' value. + nullable: true + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + property: + type: string + 123Number: + type: integer + readOnly: true + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - type: object + properties: + declawed: + type: boolean + Address: + type: object + additionalProperties: + type: integer + Animal: + type: object + discriminator: + propertyName: className + required: + - className + properties: + className: + type: string + color: + type: string + default: red + AnimalFarm: + type: array + items: + $ref: '#/components/schemas/Animal' + format_test: + type: object + required: + - number + - byte + - date + - password + properties: + integer: + type: integer + maximum: 100 + minimum: 10 + int32: + type: integer + format: int32 + maximum: 200 + minimum: 20 + int64: + type: integer + format: int64 + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + type: number + format: float + maximum: 987.6 + minimum: 54.3 + double: + type: number + format: double + maximum: 123.4 + minimum: 67.8 + string: + type: string + pattern: '/[a-z]/i' + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + password: + type: string + format: password + maxLength: 64 + minLength: 10 + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + type: string + pattern: '^\d{10}$' + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + type: string + pattern: '/^image_\d{1,3}$/i' + EnumClass: + type: string + default: '-efg' + enum: + - _abc + - '-efg' + - (xyz) + Enum_Test: + type: object + required: + - enum_string_required + properties: + enum_string: + type: string + enum: + - UPPER + - lower + - '' + enum_string_required: + type: string + enum: + - UPPER + - lower + - '' + enum_integer: + type: integer + format: int32 + enum: + - 1 + - -1 + enum_number: + type: number + format: double + enum: + - 1.1 + - -1.2 + outerEnum: + $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' + AdditionalPropertiesClass: + type: object + properties: + map_property: + type: object + additionalProperties: + type: string + map_of_map_property: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + MixedPropertiesAndAdditionalPropertiesClass: + type: object + properties: + uuid: + type: string + format: uuid + dateTime: + type: string + format: date-time + map: + type: object + additionalProperties: + $ref: '#/components/schemas/Animal' + List: + type: object + properties: + 123-list: + type: string + Client: + type: object + properties: + client: + type: string + ReadOnlyFirst: + type: object + properties: + bar: + type: string + readOnly: true + baz: + type: string + hasOnlyReadOnly: + type: object + properties: + bar: + type: string + readOnly: true + foo: + type: string + readOnly: true + Capitalization: + type: object + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + MapTest: + type: object + properties: + map_map_of_string: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + map_of_enum_string: + type: object + additionalProperties: + type: string + enum: + - UPPER + - lower + direct_map: + type: object + additionalProperties: + type: boolean + indirect_map: + $ref: '#/components/schemas/StringBooleanMap' + ArrayTest: + type: object + properties: + array_of_string: + type: array + items: + type: string + array_array_of_integer: + type: array + items: + type: array + items: + type: integer + format: int64 + array_array_of_model: + type: array + items: + type: array + items: + $ref: '#/components/schemas/ReadOnlyFirst' + NumberOnly: + type: object + properties: + JustNumber: + type: number + ArrayOfNumberOnly: + type: object + properties: + ArrayNumber: + type: array + items: + type: number + ArrayOfArrayOfNumberOnly: + type: object + properties: + ArrayArrayNumber: + type: array + items: + type: array + items: + type: number + EnumArrays: + type: object + properties: + just_symbol: + type: string + enum: + - '>=' + - $ + array_enum: + type: array + items: + type: string + enum: + - fish + - crab + OuterEnum: + nullable: true + type: string + enum: + - placed + - approved + - delivered + OuterEnumInteger: + type: integer + enum: + - 0 + - 1 + - 2 + OuterEnumDefaultValue: + type: string + enum: + - placed + - approved + - delivered + default: placed + OuterEnumIntegerDefaultValue: + type: integer + enum: + - 0 + - 1 + - 2 + default: 0 + OuterComposite: + type: object + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + FileSchemaTestClass: + type: object + properties: + file: + $ref: '#/components/schemas/File' + files: + type: array + items: + $ref: '#/components/schemas/File' + File: + type: object + description: Must be named `File` for test. + properties: + sourceURI: + description: Test capitalization + type: string + _special_model.name_: + properties: + '$special[property.name]': + type: integer + format: int64 + xml: + name: '$special[model.name]' + HealthCheckResult: + type: object + properties: + NullableMessage: + nullable: true + type: string + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + NullableClass: + type: object + properties: + integer_prop: + type: integer + nullable: true + number_prop: + type: number + nullable: true + boolean_prop: + type: boolean + nullable: true + string_prop: + type: string + nullable: true + date_prop: + type: string + format: date + nullable: true + datetime_prop: + type: string + format: date-time + nullable: true + array_nullable_prop: + type: array + nullable: true + items: + type: object + array_and_items_nullable_prop: + type: array + nullable: true + items: + type: object + nullable: true + array_items_nullable: + type: array + items: + type: object + nullable: true + object_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + object_and_items_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + object_items_nullable: + type: object + additionalProperties: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + fruit: + properties: + color: + type: string + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + apple: + type: object + properties: + cultivar: + type: string + banana: + type: object + properties: + lengthCm: + type: number + mammal: + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + discriminator: + propertyName: className + mapping: + whale: '#/components/schemas/whale' + zebra: '#/components/schemas/zebra' + whale: + type: object + properties: + hasBaleen: + type: boolean + hasTeeth: + type: boolean + className: + type: string + required: + - className + zebra: + type: object + properties: + type: + type: string + enum: + - plains + - mountain + - grevys + className: + type: string + required: + - className + gmFruit: + properties: + color: + type: string + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + fruitReq: + oneOf: + - $ref: '#/components/schemas/appleReq' + - $ref: '#/components/schemas/bananaReq' + appleReq: + type: object + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + bananaReq: + type: object + properties: + lengthCm: + type: number + sweet: + type: boolean + required: + - lengthCm + # go-experimental is unable to make Triangle and Quadrilateral models + # correctly https://github.com/OpenAPITools/openapi-generator/issues/6149 + Shape: + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + discriminator: + propertyName: shapeType + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + discriminator: + propertyName: triangleType + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + discriminator: + propertyName: quadrilateralType + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' diff --git a/samples/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/client/petstore/python-experimental/petstore_api/model_utils.py index b905f7d347a5..519b5f7a5ed5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/client/petstore/python-experimental/petstore_api/model_utils.py @@ -43,6 +43,24 @@ from builtins import int, str +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + try: + return vars(self)[self.result_key] + except KeyError: + result = self._fn() + setattr(self, self.result_key, result) + return result + + class OpenApiModel(object): """The base class for all OpenAPIModels""" @@ -54,9 +72,8 @@ def set_attribute(self, name, value): path_to_item.extend(self._path_to_item) path_to_item.append(name) - openapi_types = self.openapi_types() - if name in openapi_types: - required_types_mixed = openapi_types[name] + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), @@ -113,6 +130,55 @@ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # we don't have a discriminator + # or we have already visited this class before and are sure that we + # want to instantiate it this time + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_classes = [] + oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) + oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) + new_cls = cls.get_discriminator_class(kwargs) + if new_cls is None: + disc_prop_name_py = list(cls.discriminator.keys())[0] + disc_prop_name_js = cls.attribute_map[disc_prop_name_py] + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + disc_prop_name_js, kwargs.get(disc_prop_name_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (disc_prop_name_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are coming from the chosen new_cls use cls instead + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + class ModelSimple(OpenApiModel): """the parent class of models whose type != object in their @@ -735,10 +801,12 @@ def change_keys_js_to_python(input_dict, model_class): document). """ + if getattr(model_class, 'attribute_map', None) is None: + return input_dict output_dict = {} reversed_attr_map = {value: key for key, value in - six.iteritems(model_class.attribute_map)} - for javascript_key, value in six.iteritems(input_dict): + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): python_key = reversed_attr_map.get(javascript_key) if python_key is None: # if the key is unknown, it is in error or it is an @@ -815,21 +883,6 @@ def deserialize_primitive(data, klass, path_to_item): ) -def fix_model_input_data(model_data, model_class): - # this is only called on classes where the input data is a dict - fixed_model_data = change_keys_js_to_python( - model_data, - model_class - ) - if model_class._composed_schemas() is not None: - for allof_class in model_class._composed_schemas()['allOf']: - fixed_model_data = change_keys_js_to_python( - fixed_model_data, - allof_class - ) - return fixed_model_data - - def deserialize_model(model_data, model_class, path_to_item, check_type, configuration, from_server): """Deserializes model_data to model instance. @@ -858,23 +911,14 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, _configuration=configuration, _from_server=from_server) - used_model_class = model_class - if model_class.discriminator() is not None: - used_model_class = model_class.get_discriminator_class( - from_server, model_data) - - if issubclass(used_model_class, ModelSimple): - instance = used_model_class(value=model_data, **kw_args) + if issubclass(model_class, ModelSimple): + instance = model_class(value=model_data, **kw_args) return instance if isinstance(model_data, list): - instance = used_model_class(*model_data, **kw_args) + instance = model_class(*model_data, **kw_args) if isinstance(model_data, dict): - fixed_model_data = change_keys_js_to_python( - model_data, - used_model_class - ) - kw_args.update(fixed_model_data) - instance = used_model_class(**kw_args) + kw_args.update(model_data) + instance = model_class(**kw_args) return instance @@ -1095,7 +1139,7 @@ def model_to_dict(model_instance, serialize=True): result = {} model_instances = [model_instance] - if model_instance._composed_schemas() is not None: + if model_instance._composed_schemas: model_instances.extend(model_instance._composed_instances) for model_instance in model_instances: for attr, value in six.iteritems(model_instance._data_store): @@ -1176,6 +1220,17 @@ def get_py3_class_name(input_class): return input_class.__name__ +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + from_server = kwargs.get('_from_server', False) + if from_server: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + def get_allof_instances(self, model_args, constant_args): """ Args: @@ -1189,18 +1244,17 @@ def get_allof_instances(self, model_args, constant_args): composed_instances (list) """ composed_instances = [] - for allof_class in self._composed_schemas()['allOf']: - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_args, allof_class) + for allof_class in self._composed_schemas['allOf']: + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(allof_class.openapi_types().keys()) + var_names = set(allof_class.openapi_types.keys()) for var_name in var_names: - if var_name in fixed_model_args: - kwargs[var_name] = fixed_model_args[var_name] + if var_name in model_args: + kwargs[var_name] = model_args[var_name] # and use it to make the instance kwargs.update(constant_args) @@ -1212,8 +1266,8 @@ def get_allof_instances(self, model_args, constant_args): "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( - allof_class.__class__.__name__, - allof_class.__class__.__name__, + allof_class.__name__, + allof_class.__name__, self.__class__.__name__, str(ex) ) @@ -1241,13 +1295,13 @@ def get_oneof_instance(self, model_args, constant_args): Returns oneof_instance (instance/None) """ - if len(self._composed_schemas()['oneOf']) == 0: + if len(self._composed_schemas['oneOf']) == 0: return None oneof_instances = [] # Iterate over each oneOf schema and determine if the input data # matches the oneOf schemas. - for oneof_class in self._composed_schemas()['oneOf']: + for oneof_class in self._composed_schemas['oneOf']: # transform js keys from input data to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python( model_args, oneof_class) @@ -1257,7 +1311,7 @@ def get_oneof_instance(self, model_args, constant_args): # additionalProperties attribute in the OAS document) are not added to # the dict. kwargs = {} - var_names = set(oneof_class.openapi_types().keys()) + var_names = set(oneof_class.openapi_types.keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1301,16 +1355,16 @@ def get_anyof_instances(self, model_args, constant_args): anyof_instances (list) """ anyof_instances = [] - if len(self._composed_schemas()['anyOf']) == 0: + if len(self._composed_schemas['anyOf']) == 0: return anyof_instances - for anyof_class in self._composed_schemas()['anyOf']: + for anyof_class in self._composed_schemas['anyOf']: # transform js keys to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python(model_args, anyof_class) # extract a dict of only required keys from these_model_vars kwargs = {} - var_names = set(anyof_class.openapi_types().keys()) + var_names = set(anyof_class.openapi_types.keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1351,7 +1405,7 @@ def get_var_name_to_model_instances(self, composed_instances): all_instances = [self] all_instances.extend(composed_instances) for instance in all_instances: - for var_name in instance.openapi_types(): + for var_name in instance.openapi_types: if var_name not in var_name_to_model_instances: var_name_to_model_instances[var_name] = [instance] else: @@ -1367,7 +1421,7 @@ def get_unused_args(self, composed_instances, model_args): if var_name_py in unused_args: del unused_args[var_name_py] for instance in composed_instances: - if instance.__class__ in self._composed_schemas()['allOf']: + if instance.__class__ in self._composed_schemas['allOf']: for var_name_py in instance.attribute_map: if var_name_py in unused_args: del unused_args[var_name_py] @@ -1387,9 +1441,7 @@ def validate_get_composed_info(constant_args, model_args, self): Openapi schemas are python classes. Exceptions are raised if: - - no oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data + - 0 or > 1 oneOf schema matches the model_args input data - no anyOf schema matches the model_args input data - any of the allOf schemas do not match the model_args input data @@ -1398,7 +1450,7 @@ def validate_get_composed_info(constant_args, model_args, self): model_args (dict): these are the required and optional spec args that were passed in to make this model self (class): the class that we are instantiating - This class contains self._composed_schemas() + This class contains self._composed_schemas Returns: composed_info (list): length three diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py index d1a06123ea88..4fec91d87358 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesAnyType(ModelNormal): additional_properties_type = (bool, date, datetime, dict, float, int, list, str,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_any_type.AdditionalPropertiesAnyType - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py index bba4f0ed95f1..345d5c970c9c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesArray(ModelNormal): additional_properties_type = ([bool, date, datetime, dict, float, int, list, str],) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_array.AdditionalPropertiesArray - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py index de012c132c90..22b604b631f7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesBoolean(ModelNormal): additional_properties_type = (bool,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_boolean.AdditionalPropertiesBoolean - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py index c37e9b5c73bf..4ef564793dc0 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'anytype_3': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,9 +108,7 @@ def discriminator(): 'anytype_3': 'anytype_3', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -115,9 +116,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_class.AdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -134,6 +137,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_string ({str: (str,)}): [optional] # noqa: E501 map_number ({str: (float,)}): [optional] # noqa: E501 map_integer ({str: (int,)}): [optional] # noqa: E501 @@ -152,6 +170,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py index 649fbc485896..c309826f2e82 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesInteger(ModelNormal): additional_properties_type = (int,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_integer.AdditionalPropertiesInteger - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py index ce12662a8ed0..8bbd629023ea 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesNumber(ModelNormal): additional_properties_type = (float,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_number.AdditionalPropertiesNumber - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py index e5c60015a9e1..749e3ada66e5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesObject(ModelNormal): additional_properties_type = ({str: (bool, date, datetime, dict, float, int, list, str,)},) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_object.AdditionalPropertiesObject - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py index 24cef21ba90d..88fb6a5e15bc 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesString(ModelNormal): additional_properties_type = (str,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_string.AdditionalPropertiesString - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/client/petstore/python-experimental/petstore_api/models/animal.py index 39dd9789ff8b..34ae2ab23ef5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/animal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Animal(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'Cat': cat.Cat, @@ -103,9 +106,7 @@ def discriminator(): 'color': 'color', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -113,9 +114,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """animal.Animal - a model defined in OpenAPI Args: @@ -135,6 +138,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,6 +161,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): @@ -155,12 +174,12 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it setattr(self, var_name, var_value) @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/client/petstore/python-experimental/petstore_api/models/api_response.py index f1680c87f67a..aa85a8d32c8e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/api_response.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ApiResponse(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'message': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'message': 'message', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """api_response.ApiResponse - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) code (int): [optional] # noqa: E501 type (str): [optional] # noqa: E501 message (str): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py index bf6419e5c089..8648ca8e101e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_array_number': ([[float]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_array_number': 'ArrayArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_array_of_number_only.ArrayOfArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_array_number ([[float]]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py index f3bf89e27ba3..b457b27a8cb5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_number': ([float],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_number': 'ArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_number_only.ArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_number ([float]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/client/petstore/python-experimental/petstore_api/models/array_test.py index 0a01b3cad210..3733298e843c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/array_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class ArrayTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'array_array_of_model': ([[read_only_first.ReadOnlyFirst]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'array_array_of_model': 'array_array_of_model', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_test.ArrayTest - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_of_string ([str]): [optional] # noqa: E501 array_array_of_integer ([[int]]): [optional] # noqa: E501 array_array_of_model ([[read_only_first.ReadOnlyFirst]]): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py index 6011db39400c..3ca42fba60be 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Capitalization(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -82,7 +85,7 @@ def openapi_types(): 'att_name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'att_name': 'ATT_NAME', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """capitalization.Capitalization - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) small_camel (str): [optional] # noqa: E501 capital_camel (str): [optional] # noqa: E501 small_snake (str): [optional] # noqa: E501 @@ -137,6 +155,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/client/petstore/python-experimental/petstore_api/models/cat.py index 3f3c2384ec22..d2ce6b29c10a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Cat(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -109,12 +112,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat.Cat - a model defined in OpenAPI Args: @@ -134,6 +139,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,12 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, @@ -179,7 +201,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -200,12 +222,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py index 75e856dcbcde..f008695b43ac 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class CatAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'declawed': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'declawed': 'declawed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat_all_of.CatAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/category.py b/samples/client/petstore/python-experimental/petstore_api/models/category.py index 5d3e21ddd7e9..b34ba8ac0206 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/category.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Category(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'id': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'id': 'id', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """category.Category - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child.py b/samples/client/petstore/python-experimental/petstore_api/models/child.py index 501c22427916..3587e28fdcb7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Child(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'inter_net': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,12 +108,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child.Child - a model defined in OpenAPI Keyword Args: @@ -127,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) radio_waves (bool): [optional] # noqa: E501 tele_vision (bool): [optional] # noqa: E501 inter_net (bool): [optional] # noqa: E501 @@ -137,12 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } @@ -172,7 +194,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py index 69f6b962f242..c416862240f8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'inter_net': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'inter_net': 'interNet', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_all_of.ChildAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) inter_net (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py index e7894c9c7af4..4493cc514bb3 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class ChildCat(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_cat.ChildCat - a model defined in OpenAPI Args: @@ -132,6 +137,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -140,12 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -176,7 +198,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -197,12 +219,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py index dbe4e88bcebc..2f0cf1bdc607 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildCatAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_cat_all_of.ChildCatAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py b/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py index 8544773e8843..9df796705c99 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class ChildDog(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'bark': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_dog.ChildDog - a model defined in OpenAPI Args: @@ -132,6 +137,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bark (str): [optional] # noqa: E501 """ @@ -140,12 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -176,7 +198,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -197,12 +219,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py index f95f5ff8ae74..1ab97028ee48 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildDogAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'bark': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'bark': 'bark', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_dog_all_of.ChildDogAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bark (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py index 681e99ae6665..f42269372ea8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class ChildLizard(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'loves_rocks': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_lizard.ChildLizard - a model defined in OpenAPI Args: @@ -132,6 +137,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) loves_rocks (bool): [optional] # noqa: E501 """ @@ -140,12 +160,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -176,7 +198,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -197,12 +219,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py index 27686379a890..41bd842225fd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ChildLizardAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'loves_rocks': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'loves_rocks': 'lovesRocks', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """child_lizard_all_of.ChildLizardAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) loves_rocks (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/client/petstore/python-experimental/petstore_api/models/class_model.py index 06c52dc8bee9..a492a47164e7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/class_model.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ClassModel(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_class': '_class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """class_model.ClassModel - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _class (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/client.py b/samples/client/petstore/python-experimental/petstore_api/models/client.py index b7184b3f2b40..195e3d4209ca 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/client.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Client(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'client': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'client': 'client', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """client.Client - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) client (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/client/petstore/python-experimental/petstore_api/models/dog.py index 5d5712d428e9..edf89695f8fa 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Dog(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -109,12 +112,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog.Dog - a model defined in OpenAPI Args: @@ -134,6 +139,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,12 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, @@ -179,7 +201,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -200,12 +222,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py index 0832f4b696cc..6278289267d5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class DogAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'breed': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'breed': 'breed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog_all_of.DogAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py index 358e9f680e76..107e1f3e0f8f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -71,7 +74,7 @@ class EnumArrays(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -86,7 +89,7 @@ def openapi_types(): 'array_enum': ([str],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'array_enum': 'array_enum', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_arrays.EnumArrays - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_symbol (str): [optional] # noqa: E501 array_enum ([str]): [optional] # noqa: E501 """ @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py index 5f3f1894de47..4323ac7f0856 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class EnumClass(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_class.EnumClass - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py index 4c35c7b8c2bb..160db49fd14c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -86,7 +89,7 @@ class EnumTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -104,7 +107,7 @@ def openapi_types(): 'outer_enum': (outer_enum.OuterEnum,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -116,9 +119,7 @@ def discriminator(): 'outer_enum': 'outerEnum', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -126,9 +127,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_test.EnumTest - a model defined in OpenAPI Args: @@ -148,6 +151,21 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enum_string (str): [optional] # noqa: E501 enum_integer (int): [optional] # noqa: E501 enum_number (float): [optional] # noqa: E501 @@ -159,6 +177,7 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.enum_string_required = enum_string_required for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file.py b/samples/client/petstore/python-experimental/petstore_api/models/file.py index f71dc07b7ca8..0f21a84df498 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class File(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'source_uri': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'source_uri': 'sourceURI', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file.File - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) source_uri (str): Test capitalization. [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py index 1260e8affda2..2715cfdbfd55 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class FileSchemaTestClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'files': ([file.File],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -92,9 +95,7 @@ def discriminator(): 'files': 'files', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -102,9 +103,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file_schema_test_class.FileSchemaTestClass - a model defined in OpenAPI Keyword Args: @@ -121,6 +124,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) file (file.File): [optional] # noqa: E501 files ([file.File]): [optional] # noqa: E501 """ @@ -130,6 +148,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/client/petstore/python-experimental/petstore_api/models/format_test.py index 823c3cb88d91..b22bc0b30527 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/format_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -98,7 +101,7 @@ class FormatTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -124,7 +127,7 @@ def openapi_types(): 'uuid': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -144,9 +147,7 @@ def discriminator(): 'uuid': 'uuid', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -154,9 +155,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """format_test.FormatTest - a model defined in OpenAPI Args: @@ -179,6 +182,21 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer (int): [optional] # noqa: E501 int32 (int): [optional] # noqa: E501 int64 (int): [optional] # noqa: E501 @@ -195,6 +213,7 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.number = number self.byte = byte diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py b/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py index 98d7934f472f..bb5188acaf02 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Grandparent(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'radio_waves': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'radio_waves': 'radioWaves', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """grandparent.Grandparent - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) radio_waves (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py index db7e6f33887d..e87b751a0ee7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -83,7 +86,7 @@ class GrandparentAnimal(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'pet_type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'ChildCat': child_cat.ChildCat, @@ -113,9 +116,7 @@ def discriminator(): 'pet_type': 'pet_type', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -123,9 +124,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """grandparent_animal.GrandparentAnimal - a model defined in OpenAPI Args: @@ -145,6 +148,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -152,6 +170,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.pet_type = pet_type for var_name, var_value in six.iteritems(kwargs): @@ -164,12 +183,12 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item setattr(self, var_name, var_value) @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py index c84cf0be3f2b..974136a56a6f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class HasOnlyReadOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'foo': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'foo': 'foo', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """has_only_read_only.HasOnlyReadOnly - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 foo (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/list.py b/samples/client/petstore/python-experimental/petstore_api/models/list.py index c7c80e8bd28b..3f85acb2e4d3 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/list.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class List(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_123_list': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_123_list': '123-list', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """list.List - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _123_list (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/client/petstore/python-experimental/petstore_api/models/map_test.py index 8cc47c0a6922..e3510cef772f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/map_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class MapTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'indirect_map': (string_boolean_map.StringBooleanMap,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'indirect_map': 'indirect_map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """map_test.MapTest - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_map_of_string ({str: ({str: (str,)},)}): [optional] # noqa: E501 map_of_enum_string ({str: (str,)}): [optional] # noqa: E501 direct_map ({str: (bool,)}): [optional] # noqa: E501 @@ -140,6 +158,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py index 143a79bfa266..36f5add3db88 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'map': ({str: (animal.Animal,)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'map': 'map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) uuid (str): [optional] # noqa: E501 date_time (datetime): [optional] # noqa: E501 map ({str: (animal.Animal,)}): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py index 0c3885120210..96d39402d563 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Model200Response(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): '_class': 'class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model200_response.Model200Response - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (int): [optional] # noqa: E501 _class (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/client/petstore/python-experimental/petstore_api/models/model_return.py index 75c3cea6318b..f9213c37ea7e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/model_return.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ModelReturn(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_return': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_return': 'return', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model_return.ModelReturn - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _return (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/name.py b/samples/client/petstore/python-experimental/petstore_api/models/name.py index db81ae16916d..b2fce89ec9b7 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Name(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -80,7 +83,7 @@ def openapi_types(): '_123_number': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -91,9 +94,7 @@ def discriminator(): '_123_number': '123Number', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -101,9 +102,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """name.Name - a model defined in OpenAPI Args: @@ -123,6 +126,21 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) snake_case (int): [optional] # noqa: E501 _property (str): [optional] # noqa: E501 _123_number (int): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/client/petstore/python-experimental/petstore_api/models/number_only.py index 0c91e2ae62d0..896757360765 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class NumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'just_number': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'just_number': 'JustNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """number_only.NumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_number (float): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/order.py b/samples/client/petstore/python-experimental/petstore_api/models/order.py index 673295a8610c..6ff62a572333 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/order.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class Order(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'complete': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'complete': 'complete', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """order.Order - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 pet_id (int): [optional] # noqa: E501 quantity (int): [optional] # noqa: E501 @@ -142,6 +160,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py index c654c51daffe..d34d654e0845 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class OuterComposite(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'my_boolean': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'my_boolean': 'my_boolean', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_composite.OuterComposite - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) my_number (outer_number.OuterNumber): [optional] # noqa: E501 my_string (str): [optional] # noqa: E501 my_boolean (bool): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py index 9a933b28169b..e85ac1b87ebb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnum(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum.OuterEnum - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py b/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py index 9f7b3de76d91..df65a2d3d047 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class OuterNumber(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,13 +80,11 @@ def openapi_types(): 'value': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -91,9 +92,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_number.OuterNumber - a model defined in OpenAPI Args: @@ -113,6 +116,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -120,6 +138,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent.py b/samples/client/petstore/python-experimental/petstore_api/models/parent.py index f62abd94ceed..16bb62ed0fbd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Parent(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'tele_vision': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -103,12 +106,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """parent.Parent - a model defined in OpenAPI Keyword Args: @@ -125,6 +130,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) radio_waves (bool): [optional] # noqa: E501 tele_vision (bool): [optional] # noqa: E501 """ @@ -134,12 +154,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } @@ -169,7 +191,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py b/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py index f927649600bd..6ee6983a4abc 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ParentAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'tele_vision': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'tele_vision': 'teleVision', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """parent_all_of.ParentAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) tele_vision (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py index e7f2a6fb63f9..8d708aadf4fb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -83,7 +86,7 @@ class ParentPet(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'pet_type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'ChildCat': child_cat.ChildCat, @@ -118,12 +121,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """parent_pet.ParentPet - a model defined in OpenAPI Args: @@ -143,6 +148,21 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -150,12 +170,14 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'pet_type': pet_type, @@ -186,7 +208,7 @@ def __init__(self, pet_type, _check_type=True, _from_server=False, _path_to_item continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -206,12 +228,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/client/petstore/python-experimental/petstore_api/models/pet.py index 74cd8afef1af..1b34db901312 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/pet.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Pet(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'status': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -110,9 +113,7 @@ def discriminator(): 'status': 'status', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -120,9 +121,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """pet.Pet - a model defined in OpenAPI Args: @@ -143,6 +146,21 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 category (category.Category): [optional] # noqa: E501 tags ([tag.Tag]): [optional] # noqa: E501 @@ -154,6 +172,7 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name self.photo_urls = photo_urls diff --git a/samples/client/petstore/python-experimental/petstore_api/models/player.py b/samples/client/petstore/python-experimental/petstore_api/models/player.py index ea8d2a99456d..147bf2ff6f97 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/player.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/player.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Player(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'enemy_player': (Player,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'enemy_player': 'enemyPlayer', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """player.Player - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enemy_player (Player): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py index 329ec017d435..8c6d80c71f16 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ReadOnlyFirst(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'baz': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'baz': 'baz', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """read_only_first.ReadOnlyFirst - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 baz (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py index d4ffc608a579..168554fa343e 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class SpecialModelName(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'special_property_name': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'special_property_name': '$special[property.name]', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """special_model_name.SpecialModelName - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) special_property_name (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py index 7f797f5f1b5d..10d0a9882261 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class StringBooleanMap(ModelNormal): additional_properties_type = (bool,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -76,16 +79,14 @@ def openapi_types(): return { } - @staticmethod + @cached_property def discriminator(): return None attribute_map = { } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """string_boolean_map.StringBooleanMap - a model defined in OpenAPI Keyword Args: @@ -112,6 +115,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -119,6 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/client/petstore/python-experimental/petstore_api/models/tag.py index 9af85413b39d..fdd4ff690009 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/tag.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Tag(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'full_name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'full_name': 'fullName', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """tag.Tag - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 name (str): [optional] # noqa: E501 full_name (str): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py index acde27d37ab4..442f9837881b 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class TypeHolderDefault(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'datetime_item': (datetime,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -97,9 +100,7 @@ def discriminator(): 'datetime_item': 'datetime_item', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -107,9 +108,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, array_item, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, array_item, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """type_holder_default.TypeHolderDefault - a model defined in OpenAPI Args: @@ -133,6 +136,21 @@ def __init__(self, array_item, string_item='what', number_item=1.234, integer_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) date_item (date): [optional] # noqa: E501 datetime_item (datetime): [optional] # noqa: E501 """ @@ -142,6 +160,7 @@ def __init__(self, array_item, string_item='what', number_item=1.234, integer_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.string_item = string_item self.number_item = number_item diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py index dc8b5116da09..0c08758bf04a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class TypeHolderExample(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -90,7 +93,7 @@ def openapi_types(): 'array_item': ([int],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -102,9 +105,7 @@ def discriminator(): 'array_item': 'array_item', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -112,9 +113,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, integer_item=-2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, integer_item=-2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """type_holder_example.TypeHolderExample - a model defined in OpenAPI Args: @@ -138,6 +141,21 @@ def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -145,6 +163,7 @@ def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.string_item = string_item self.number_item = number_item diff --git a/samples/client/petstore/python-experimental/petstore_api/models/user.py b/samples/client/petstore/python-experimental/petstore_api/models/user.py index 3b2eeb54b3d9..1f1095d3773c 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/user.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class User(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'user_status': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -99,9 +102,7 @@ def discriminator(): 'user_status': 'userStatus', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -109,9 +110,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """user.User - a model defined in OpenAPI Keyword Args: @@ -128,6 +131,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 username (str): [optional] # noqa: E501 first_name (str): [optional] # noqa: E501 @@ -143,6 +161,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py b/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py index 3bcd62804dda..aad4db483aa4 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class XmlItem(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -105,7 +108,7 @@ def openapi_types(): 'prefix_ns_wrapped_array': ([int],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -141,9 +144,7 @@ def discriminator(): 'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -151,9 +152,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """xml_item.XmlItem - a model defined in OpenAPI Keyword Args: @@ -170,6 +173,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) attribute_string (str): [optional] # noqa: E501 attribute_number (float): [optional] # noqa: E501 attribute_integer (int): [optional] # noqa: E501 @@ -206,6 +224,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/client/petstore/python-experimental/test/test_child.py b/samples/client/petstore/python-experimental/test/test_child.py index 96023582c4fd..43f1341b9233 100644 --- a/samples/client/petstore/python-experimental/test/test_child.py +++ b/samples/client/petstore/python-experimental/test/test_child.py @@ -81,7 +81,7 @@ def testChild(self): # make sure that the ModelComposed class properties are correct # model.composed_schemas() stores the anyOf/allOf/oneOf info self.assertEqual( - child._composed_schemas(), + child._composed_schemas, { 'anyOf': [], 'allOf': [ diff --git a/samples/client/petstore/python-experimental/test/test_dog.py b/samples/client/petstore/python-experimental/test/test_dog.py index cb1f3230a067..cc165d8b27df 100644 --- a/samples/client/petstore/python-experimental/test/test_dog.py +++ b/samples/client/petstore/python-experimental/test/test_dog.py @@ -81,7 +81,7 @@ def testDog(self): # make sure that the ModelComposed class properties are correct # model.composed_schemas() stores the anyOf/allOf/oneOf info self.assertEqual( - dog._composed_schemas(), + dog._composed_schemas, { 'anyOf': [], 'allOf': [ diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index b2158bd96594..75c709986b76 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -139,11 +139,13 @@ Class | Method | HTTP request | Description - [category.Category](docs/Category.md) - [class_model.ClassModel](docs/ClassModel.md) - [client.Client](docs/Client.md) + - [complex_quadrilateral.ComplexQuadrilateral](docs/ComplexQuadrilateral.md) - [dog.Dog](docs/Dog.md) - [dog_all_of.DogAllOf](docs/DogAllOf.md) - [enum_arrays.EnumArrays](docs/EnumArrays.md) - [enum_class.EnumClass](docs/EnumClass.md) - [enum_test.EnumTest](docs/EnumTest.md) + - [equilateral_triangle.EquilateralTriangle](docs/EquilateralTriangle.md) - [file.File](docs/File.md) - [file_schema_test_class.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [foo.Foo](docs/Foo.md) @@ -160,6 +162,7 @@ Class | Method | HTTP request | Description - [inline_object4.InlineObject4](docs/InlineObject4.md) - [inline_object5.InlineObject5](docs/InlineObject5.md) - [inline_response_default.InlineResponseDefault](docs/InlineResponseDefault.md) + - [isosceles_triangle.IsoscelesTriangle](docs/IsoscelesTriangle.md) - [list.List](docs/List.md) - [mammal.Mammal](docs/Mammal.md) - [map_test.MapTest](docs/MapTest.md) @@ -176,10 +179,18 @@ Class | Method | HTTP request | Description - [outer_enum_integer.OuterEnumInteger](docs/OuterEnumInteger.md) - [outer_enum_integer_default_value.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [pet.Pet](docs/Pet.md) + - [quadrilateral.Quadrilateral](docs/Quadrilateral.md) + - [quadrilateral_interface.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [read_only_first.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [scalene_triangle.ScaleneTriangle](docs/ScaleneTriangle.md) + - [shape.Shape](docs/Shape.md) + - [shape_interface.ShapeInterface](docs/ShapeInterface.md) + - [simple_quadrilateral.SimpleQuadrilateral](docs/SimpleQuadrilateral.md) - [special_model_name.SpecialModelName](docs/SpecialModelName.md) - [string_boolean_map.StringBooleanMap](docs/StringBooleanMap.md) - [tag.Tag](docs/Tag.md) + - [triangle.Triangle](docs/Triangle.md) + - [triangle_interface.TriangleInterface](docs/TriangleInterface.md) - [user.User](docs/User.md) - [whale.Whale](docs/Whale.md) - [zebra.Zebra](docs/Zebra.md) diff --git a/samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md b/samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..6a7288abcb8e --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/ComplexQuadrilateral.md @@ -0,0 +1,11 @@ +# complex_quadrilateral.ComplexQuadrilateral + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..46c822e9db42 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/EquilateralTriangle.md @@ -0,0 +1,11 @@ +# equilateral_triangle.EquilateralTriangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..335edad8c0fe --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/IsoscelesTriangle.md @@ -0,0 +1,11 @@ +# isosceles_triangle.IsoscelesTriangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md b/samples/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md new file mode 100644 index 000000000000..bc43f1e9351c --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/Quadrilateral.md @@ -0,0 +1,11 @@ +# quadrilateral.Quadrilateral + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quadrilateral_type** | **str** | | +**shape_type** | **str** | | defaults to nulltype.Null + +[[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/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..d3600c6c5ba7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/QuadrilateralInterface.md @@ -0,0 +1,10 @@ +# quadrilateral_interface.QuadrilateralInterface + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quadrilateral_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md b/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..a99a1f761c2f --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/ScaleneTriangle.md @@ -0,0 +1,11 @@ +# scalene_triangle.ScaleneTriangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**triangle_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/Shape.md b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md new file mode 100644 index 000000000000..6fbc1b6d2c70 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/Shape.md @@ -0,0 +1,12 @@ +# shape.Shape + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | defaults to nulltype.Null +**triangle_type** | **str** | | defaults to nulltype.Null + +[[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/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md new file mode 100644 index 000000000000..adb207397a49 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/ShapeInterface.md @@ -0,0 +1,10 @@ +# shape_interface.ShapeInterface + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md b/samples/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..fe93f4173476 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/SimpleQuadrilateral.md @@ -0,0 +1,11 @@ +# simple_quadrilateral.SimpleQuadrilateral + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shape_type** | **str** | | +**quadrilateral_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/docs/Triangle.md b/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md new file mode 100644 index 000000000000..b6cf81066821 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/Triangle.md @@ -0,0 +1,11 @@ +# triangle.Triangle + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**triangle_type** | **str** | | +**shape_type** | **str** | | defaults to nulltype.Null + +[[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/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md b/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md new file mode 100644 index 000000000000..7a32b8572145 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/docs/TriangleInterface.md @@ -0,0 +1,10 @@ +# triangle_interface.TriangleInterface + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**triangle_type** | **str** | | + +[[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/openapi3/client/petstore/python-experimental/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py index 3aa279dd15d6..8b55c4a48b2a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py @@ -57,11 +57,13 @@ from petstore_api.models.category import Category from petstore_api.models.class_model import ClassModel from petstore_api.models.client import Client +from petstore_api.models.complex_quadrilateral import ComplexQuadrilateral from petstore_api.models.dog import Dog from petstore_api.models.dog_all_of import DogAllOf from petstore_api.models.enum_arrays import EnumArrays from petstore_api.models.enum_class import EnumClass from petstore_api.models.enum_test import EnumTest +from petstore_api.models.equilateral_triangle import EquilateralTriangle from petstore_api.models.file import File from petstore_api.models.file_schema_test_class import FileSchemaTestClass from petstore_api.models.foo import Foo @@ -78,6 +80,7 @@ from petstore_api.models.inline_object4 import InlineObject4 from petstore_api.models.inline_object5 import InlineObject5 from petstore_api.models.inline_response_default import InlineResponseDefault +from petstore_api.models.isosceles_triangle import IsoscelesTriangle from petstore_api.models.list import List from petstore_api.models.mammal import Mammal from petstore_api.models.map_test import MapTest @@ -94,10 +97,18 @@ from petstore_api.models.outer_enum_integer import OuterEnumInteger from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue from petstore_api.models.pet import Pet +from petstore_api.models.quadrilateral import Quadrilateral +from petstore_api.models.quadrilateral_interface import QuadrilateralInterface from petstore_api.models.read_only_first import ReadOnlyFirst +from petstore_api.models.scalene_triangle import ScaleneTriangle +from petstore_api.models.shape import Shape +from petstore_api.models.shape_interface import ShapeInterface +from petstore_api.models.simple_quadrilateral import SimpleQuadrilateral from petstore_api.models.special_model_name import SpecialModelName from petstore_api.models.string_boolean_map import StringBooleanMap from petstore_api.models.tag import Tag +from petstore_api.models.triangle import Triangle +from petstore_api.models.triangle_interface import TriangleInterface from petstore_api.models.user import User from petstore_api.models.whale import Whale from petstore_api.models.zebra import Zebra diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py index b905f7d347a5..519b5f7a5ed5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model_utils.py @@ -43,6 +43,24 @@ from builtins import int, str +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on fuction methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + try: + return vars(self)[self.result_key] + except KeyError: + result = self._fn() + setattr(self, self.result_key, result) + return result + + class OpenApiModel(object): """The base class for all OpenAPIModels""" @@ -54,9 +72,8 @@ def set_attribute(self, name, value): path_to_item.extend(self._path_to_item) path_to_item.append(name) - openapi_types = self.openapi_types() - if name in openapi_types: - required_types_mixed = openapi_types[name] + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] elif self.additional_properties_type is None: raise ApiKeyError( "{0} has no key '{1}'".format(type(self).__name__, name), @@ -113,6 +130,55 @@ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # we don't have a discriminator + # or we have already visited this class before and are sure that we + # want to instantiate it this time + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_classes = [] + oneof_anyof_classes.extend(cls._composed_schemas.get('oneOf', ())) + oneof_anyof_classes.extend(cls._composed_schemas.get('anyOf', ())) + new_cls = cls.get_discriminator_class(kwargs) + if new_cls is None: + disc_prop_name_py = list(cls.discriminator.keys())[0] + disc_prop_name_js = cls.attribute_map[disc_prop_name_py] + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + disc_prop_name_js, kwargs.get(disc_prop_name_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (disc_prop_name_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are coming from the chosen new_cls use cls instead + return super(OpenApiModel, cls).__new__(cls) + + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + class ModelSimple(OpenApiModel): """the parent class of models whose type != object in their @@ -735,10 +801,12 @@ def change_keys_js_to_python(input_dict, model_class): document). """ + if getattr(model_class, 'attribute_map', None) is None: + return input_dict output_dict = {} reversed_attr_map = {value: key for key, value in - six.iteritems(model_class.attribute_map)} - for javascript_key, value in six.iteritems(input_dict): + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): python_key = reversed_attr_map.get(javascript_key) if python_key is None: # if the key is unknown, it is in error or it is an @@ -815,21 +883,6 @@ def deserialize_primitive(data, klass, path_to_item): ) -def fix_model_input_data(model_data, model_class): - # this is only called on classes where the input data is a dict - fixed_model_data = change_keys_js_to_python( - model_data, - model_class - ) - if model_class._composed_schemas() is not None: - for allof_class in model_class._composed_schemas()['allOf']: - fixed_model_data = change_keys_js_to_python( - fixed_model_data, - allof_class - ) - return fixed_model_data - - def deserialize_model(model_data, model_class, path_to_item, check_type, configuration, from_server): """Deserializes model_data to model instance. @@ -858,23 +911,14 @@ def deserialize_model(model_data, model_class, path_to_item, check_type, _configuration=configuration, _from_server=from_server) - used_model_class = model_class - if model_class.discriminator() is not None: - used_model_class = model_class.get_discriminator_class( - from_server, model_data) - - if issubclass(used_model_class, ModelSimple): - instance = used_model_class(value=model_data, **kw_args) + if issubclass(model_class, ModelSimple): + instance = model_class(value=model_data, **kw_args) return instance if isinstance(model_data, list): - instance = used_model_class(*model_data, **kw_args) + instance = model_class(*model_data, **kw_args) if isinstance(model_data, dict): - fixed_model_data = change_keys_js_to_python( - model_data, - used_model_class - ) - kw_args.update(fixed_model_data) - instance = used_model_class(**kw_args) + kw_args.update(model_data) + instance = model_class(**kw_args) return instance @@ -1095,7 +1139,7 @@ def model_to_dict(model_instance, serialize=True): result = {} model_instances = [model_instance] - if model_instance._composed_schemas() is not None: + if model_instance._composed_schemas: model_instances.extend(model_instance._composed_instances) for model_instance in model_instances: for attr, value in six.iteritems(model_instance._data_store): @@ -1176,6 +1220,17 @@ def get_py3_class_name(input_class): return input_class.__name__ +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(self, *args, **kwargs): + from_server = kwargs.get('_from_server', False) + if from_server: + kwargs = change_keys_js_to_python(kwargs, self.__class__) + return fn(self, *args, **kwargs) + return wrapped_init + + def get_allof_instances(self, model_args, constant_args): """ Args: @@ -1189,18 +1244,17 @@ def get_allof_instances(self, model_args, constant_args): composed_instances (list) """ composed_instances = [] - for allof_class in self._composed_schemas()['allOf']: - - # transform js keys to python keys in fixed_model_args - fixed_model_args = change_keys_js_to_python( - model_args, allof_class) + for allof_class in self._composed_schemas['allOf']: + # no need to handle changing js keys to python because + # for composed schemas, allof parameters are included in the + # composed schema and were changed to python keys in __new__ # extract a dict of only required keys from fixed_model_args kwargs = {} - var_names = set(allof_class.openapi_types().keys()) + var_names = set(allof_class.openapi_types.keys()) for var_name in var_names: - if var_name in fixed_model_args: - kwargs[var_name] = fixed_model_args[var_name] + if var_name in model_args: + kwargs[var_name] = model_args[var_name] # and use it to make the instance kwargs.update(constant_args) @@ -1212,8 +1266,8 @@ def get_allof_instances(self, model_args, constant_args): "Invalid inputs given to generate an instance of '%s'. The " "input data was invalid for the allOf schema '%s' in the composed " "schema '%s'. Error=%s" % ( - allof_class.__class__.__name__, - allof_class.__class__.__name__, + allof_class.__name__, + allof_class.__name__, self.__class__.__name__, str(ex) ) @@ -1241,13 +1295,13 @@ def get_oneof_instance(self, model_args, constant_args): Returns oneof_instance (instance/None) """ - if len(self._composed_schemas()['oneOf']) == 0: + if len(self._composed_schemas['oneOf']) == 0: return None oneof_instances = [] # Iterate over each oneOf schema and determine if the input data # matches the oneOf schemas. - for oneof_class in self._composed_schemas()['oneOf']: + for oneof_class in self._composed_schemas['oneOf']: # transform js keys from input data to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python( model_args, oneof_class) @@ -1257,7 +1311,7 @@ def get_oneof_instance(self, model_args, constant_args): # additionalProperties attribute in the OAS document) are not added to # the dict. kwargs = {} - var_names = set(oneof_class.openapi_types().keys()) + var_names = set(oneof_class.openapi_types.keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1301,16 +1355,16 @@ def get_anyof_instances(self, model_args, constant_args): anyof_instances (list) """ anyof_instances = [] - if len(self._composed_schemas()['anyOf']) == 0: + if len(self._composed_schemas['anyOf']) == 0: return anyof_instances - for anyof_class in self._composed_schemas()['anyOf']: + for anyof_class in self._composed_schemas['anyOf']: # transform js keys to python keys in fixed_model_args fixed_model_args = change_keys_js_to_python(model_args, anyof_class) # extract a dict of only required keys from these_model_vars kwargs = {} - var_names = set(anyof_class.openapi_types().keys()) + var_names = set(anyof_class.openapi_types.keys()) for var_name in var_names: if var_name in fixed_model_args: kwargs[var_name] = fixed_model_args[var_name] @@ -1351,7 +1405,7 @@ def get_var_name_to_model_instances(self, composed_instances): all_instances = [self] all_instances.extend(composed_instances) for instance in all_instances: - for var_name in instance.openapi_types(): + for var_name in instance.openapi_types: if var_name not in var_name_to_model_instances: var_name_to_model_instances[var_name] = [instance] else: @@ -1367,7 +1421,7 @@ def get_unused_args(self, composed_instances, model_args): if var_name_py in unused_args: del unused_args[var_name_py] for instance in composed_instances: - if instance.__class__ in self._composed_schemas()['allOf']: + if instance.__class__ in self._composed_schemas['allOf']: for var_name_py in instance.attribute_map: if var_name_py in unused_args: del unused_args[var_name_py] @@ -1387,9 +1441,7 @@ def validate_get_composed_info(constant_args, model_args, self): Openapi schemas are python classes. Exceptions are raised if: - - no oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data - - > 1 oneOf schema matches the model_args input data + - 0 or > 1 oneOf schema matches the model_args input data - no anyOf schema matches the model_args input data - any of the allOf schemas do not match the model_args input data @@ -1398,7 +1450,7 @@ def validate_get_composed_info(constant_args, model_args, self): model_args (dict): these are the required and optional spec args that were passed in to make this model self (class): the class that we are instantiating - This class contains self._composed_schemas() + This class contains self._composed_schemas Returns: composed_info (list): length three diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py index 30bc3cdce6f3..0dc65073d31e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'map_of_map_property': ({str: ({str: (str,)},)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'map_of_map_property': 'map_of_map_property', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """additional_properties_class.AdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_property ({str: (str,)}): [optional] # noqa: E501 map_of_map_property ({str: ({str: (str,)},)}): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py index 05a95d57fa99..a8a541d6c21c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Address(ModelNormal): additional_properties_type = (int,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -76,16 +79,14 @@ def openapi_types(): return { } - @staticmethod + @cached_property def discriminator(): return None attribute_map = { } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """address.Address - a model defined in OpenAPI Keyword Args: @@ -112,6 +115,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -119,6 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py index 39dd9789ff8b..34ae2ab23ef5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Animal(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'Cat': cat.Cat, @@ -103,9 +106,7 @@ def discriminator(): 'color': 'color', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -113,9 +114,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """animal.Animal - a model defined in OpenAPI Args: @@ -135,6 +138,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,6 +161,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): @@ -155,12 +174,12 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it setattr(self, var_name, var_value) @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py index f1680c87f67a..aa85a8d32c8e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ApiResponse(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'message': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'message': 'message', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """api_response.ApiResponse - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) code (int): [optional] # noqa: E501 type (str): [optional] # noqa: E501 message (str): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py index 03c502690d5d..cf86835a3295 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Apple(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'cultivar': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'cultivar': 'cultivar', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """apple.Apple - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) cultivar (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py index 7aa81bf4c776..e0209f490b43 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class AppleReq(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'mealy': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'mealy': 'mealy', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """apple_req.AppleReq - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) mealy (bool): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, cultivar, _check_type=True, _from_server=False, _path_to_item self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.cultivar = cultivar for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py index bf6419e5c089..8648ca8e101e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_array_number': ([[float]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_array_number': 'ArrayArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_array_of_number_only.ArrayOfArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_array_number ([[float]]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py index f3bf89e27ba3..b457b27a8cb5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ArrayOfNumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'array_number': ([float],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'array_number': 'ArrayNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_of_number_only.ArrayOfNumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_number ([float]): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py index 0a01b3cad210..3733298e843c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class ArrayTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'array_array_of_model': ([[read_only_first.ReadOnlyFirst]],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'array_array_of_model': 'array_array_of_model', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """array_test.ArrayTest - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) array_of_string ([str]): [optional] # noqa: E501 array_array_of_integer ([[int]]): [optional] # noqa: E501 array_array_of_model ([[read_only_first.ReadOnlyFirst]]): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py index fda69a28a253..ea8e0969a483 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Banana(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'length_cm': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'length_cm': 'lengthCm', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """banana.Banana - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) length_cm (float): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py index bf7d461c469c..180a51d33a62 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class BananaReq(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'sweet': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'sweet': 'sweet', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """banana_req.BananaReq - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_ite deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) sweet (bool): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, length_cm, _check_type=True, _from_server=False, _path_to_ite self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.length_cm = length_cm for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py index 6011db39400c..3ca42fba60be 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Capitalization(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -82,7 +85,7 @@ def openapi_types(): 'att_name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'att_name': 'ATT_NAME', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """capitalization.Capitalization - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) small_camel (str): [optional] # noqa: E501 capital_camel (str): [optional] # noqa: E501 small_snake (str): [optional] # noqa: E501 @@ -137,6 +155,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py index c3641a6862b9..a99db498e685 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Cat(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -94,7 +97,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -114,12 +117,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat.Cat - a model defined in OpenAPI Args: @@ -139,6 +144,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -148,12 +168,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, @@ -184,7 +206,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -206,12 +228,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py index 75e856dcbcde..f008695b43ac 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class CatAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'declawed': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'declawed': 'declawed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """cat_all_of.CatAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) declawed (bool): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py index 5d3e21ddd7e9..b34ba8ac0206 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Category(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'id': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'id': 'id', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name='default-name', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """category.Category - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, name='default-name', _check_type=True, _from_server=False, _p self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py index 06c52dc8bee9..a492a47164e7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ClassModel(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_class': '_class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """class_model.ClassModel - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _class (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py index b7184b3f2b40..195e3d4209ca 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Client(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'client': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'client': 'client', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """client.Client - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) client (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py new file mode 100644 index 000000000000..0be63bdcd2d6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.models.quadrilateral_interface'] +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] + + +class ComplexQuadrilateral(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """complex_quadrilateral.ComplexQuadrilateral - a model defined in OpenAPI + + Args: + shape_type (str): + quadrilateral_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + quadrilateral_interface.QuadrilateralInterface, + shape_interface.ShapeInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py index 5d5712d428e9..edf89695f8fa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Dog(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'color': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { } @@ -109,12 +112,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog.Dog - a model defined in OpenAPI Args: @@ -134,6 +139,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501 """ @@ -143,12 +163,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, @@ -179,7 +201,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -200,12 +222,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py index 0832f4b696cc..6278289267d5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class DogAllOf(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'breed': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'breed': 'breed', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """dog_all_of.DogAllOf - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) breed (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py index 358e9f680e76..107e1f3e0f8f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -71,7 +74,7 @@ class EnumArrays(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -86,7 +89,7 @@ def openapi_types(): 'array_enum': ([str],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -95,9 +98,7 @@ def discriminator(): 'array_enum': 'array_enum', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -105,9 +106,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_arrays.EnumArrays - a model defined in OpenAPI Keyword Args: @@ -124,6 +127,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_symbol (str): [optional] # noqa: E501 array_enum ([str]): [optional] # noqa: E501 """ @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py index 5f3f1894de47..4323ac7f0856 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class EnumClass(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_class.EnumClass - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value='-efg', _check_type=True, _from_server=False, _path_to_ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py index bcd601f04ed3..83043b7c4315 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -101,7 +104,7 @@ class EnumTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -122,7 +125,7 @@ def openapi_types(): 'outer_enum_integer_default_value': (outer_enum_integer_default_value.OuterEnumIntegerDefaultValue,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -137,9 +140,7 @@ def discriminator(): 'outer_enum_integer_default_value': 'outerEnumIntegerDefaultValue', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -147,9 +148,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, enum_string_required, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """enum_test.EnumTest - a model defined in OpenAPI Args: @@ -169,6 +172,21 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enum_string (str): [optional] # noqa: E501 enum_integer (int): [optional] # noqa: E501 enum_number (float): [optional] # noqa: E501 @@ -183,6 +201,7 @@ def __init__(self, enum_string_required, _check_type=True, _from_server=False, _ self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.enum_string_required = enum_string_required for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py new file mode 100644 index 000000000000..90c79fd2bbcc --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] +try: + from petstore_api.models import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.models.triangle_interface'] + + +class EquilateralTriangle(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """equilateral_triangle.EquilateralTriangle - a model defined in OpenAPI + + Args: + shape_type (str): + triangle_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'triangle_type': triangle_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + shape_interface.ShapeInterface, + triangle_interface.TriangleInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py index f71dc07b7ca8..0f21a84df498 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class File(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'source_uri': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'source_uri': 'sourceURI', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file.File - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) source_uri (str): Test capitalization. [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py index 1260e8affda2..2715cfdbfd55 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class FileSchemaTestClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'files': ([file.File],), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -92,9 +95,7 @@ def discriminator(): 'files': 'files', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -102,9 +103,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """file_schema_test_class.FileSchemaTestClass - a model defined in OpenAPI Keyword Args: @@ -121,6 +124,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) file (file.File): [optional] # noqa: E501 files ([file.File]): [optional] # noqa: E501 """ @@ -130,6 +148,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py index 7a71b34dc4de..6e88c734c966 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Foo(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'bar': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'bar': 'bar', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """foo.Foo - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] if omitted the server will use the default value of 'bar' # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py index 2a7e08f4d737..e3084b719111 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -104,7 +107,7 @@ class FormatTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -132,7 +135,7 @@ def openapi_types(): 'pattern_with_digits_and_delimiter': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -154,9 +157,7 @@ def discriminator(): 'pattern_with_digits_and_delimiter': 'pattern_with_digits_and_delimiter', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -164,9 +165,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, number, byte, date, password, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """format_test.FormatTest - a model defined in OpenAPI Args: @@ -189,6 +192,21 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer (int): [optional] # noqa: E501 int32 (int): [optional] # noqa: E501 int64 (int): [optional] # noqa: E501 @@ -207,6 +225,7 @@ def __init__(self, number, byte, date, password, _check_type=True, _from_server= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.number = number self.byte = byte diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py index d5e71abd700f..dd0d21e3315b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class Fruit(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'length_cm': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,12 +108,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """fruit.Fruit - a model defined in OpenAPI Keyword Args: @@ -127,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] # noqa: E501 cultivar (str): [optional] # noqa: E501 length_cm (float): [optional] # noqa: E501 @@ -137,12 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } @@ -172,7 +194,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py index 111326fcb4f6..a1836e551c0e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class FruitReq(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -90,7 +93,7 @@ def openapi_types(): 'sweet': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -107,12 +110,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """fruit_req.FruitReq - a model defined in OpenAPI Args: @@ -133,6 +138,21 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) mealy (bool): [optional] # noqa: E501 sweet (bool): [optional] # noqa: E501 """ @@ -142,12 +162,14 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'cultivar': cultivar, @@ -179,7 +201,7 @@ def __init__(self, cultivar=nulltype.Null, length_cm=nulltype.Null, _check_type= continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py index 0888743b8ec8..9afdc0ecc95b 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -73,7 +76,7 @@ class GmFruit(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'length_cm': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -105,12 +108,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """gm_fruit.GmFruit - a model defined in OpenAPI Keyword Args: @@ -127,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) color (str): [optional] # noqa: E501 cultivar (str): [optional] # noqa: E501 length_cm (float): [optional] # noqa: E501 @@ -137,12 +157,14 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { } @@ -172,7 +194,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py index c84cf0be3f2b..974136a56a6f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class HasOnlyReadOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'foo': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'foo': 'foo', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """has_only_read_only.HasOnlyReadOnly - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 foo (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py index 873bad5451fe..662cf79189ff 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class HealthCheckResult(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'nullable_message': (str, none_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'nullable_message': 'NullableMessage', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """health_check_result.HealthCheckResult - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) nullable_message (str, none_type): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py index bba44a11c13d..5de65e44476e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'status': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'status': 'status', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object.InlineObject - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (str): Updated name of the pet. [optional] # noqa: E501 status (str): Updated status of the pet. [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py index 4262d4165fdc..03ec7a1908c9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject1(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'file': (file_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'file': 'file', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object1.InlineObject1 - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) additional_metadata (str): Additional data to pass to server. [optional] # noqa: E501 file (file_type): file to upload. [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py index 2fd4792709f5..701f8f8985b9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class InlineObject2(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'enum_form_string': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -96,9 +99,7 @@ def discriminator(): 'enum_form_string': 'enum_form_string', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -106,9 +107,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object2.InlineObject2 - a model defined in OpenAPI Keyword Args: @@ -125,6 +128,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) enum_form_string_array ([str]): Form parameter enum test (string array). [optional] # noqa: E501 enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' # noqa: E501 """ @@ -134,6 +152,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py index 209e97de6e18..e720690a0550 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -97,7 +100,7 @@ class InlineObject3(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -124,7 +127,7 @@ def openapi_types(): 'callback': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -145,9 +148,7 @@ def discriminator(): 'callback': 'callback', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -155,9 +156,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, number, double, pattern_without_delimiter, byte, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, number, double, pattern_without_delimiter, byte, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object3.InlineObject3 - a model defined in OpenAPI Args: @@ -180,6 +183,21 @@ def __init__(self, number, double, pattern_without_delimiter, byte, _check_type= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer (int): None. [optional] # noqa: E501 int32 (int): None. [optional] # noqa: E501 int64 (int): None. [optional] # noqa: E501 @@ -197,6 +215,7 @@ def __init__(self, number, double, pattern_without_delimiter, byte, _check_type= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.number = number self.double = double diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py index 67b14d2c64e5..dd5ade491376 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject4(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'param2': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'param2': 'param2', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object4.InlineObject4 - a model defined in OpenAPI Args: @@ -120,6 +123,21 @@ def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -127,6 +145,7 @@ def __init__(self, param, param2, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.param = param self.param2 = param2 diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py index ce5fc59a4aee..b133b4026884 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class InlineObject5(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'additional_metadata': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'additional_metadata': 'additionalMetadata', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, required_file, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, required_file, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_object5.InlineObject5 - a model defined in OpenAPI Args: @@ -119,6 +122,21 @@ def __init__(self, required_file, _check_type=True, _from_server=False, _path_to deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) additional_metadata (str): Additional data to pass to server. [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, required_file, _check_type=True, _from_server=False, _path_to self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.required_file = required_file for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py index ad0f356ab50b..1ef604607e67 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class InlineResponseDefault(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -82,7 +85,7 @@ def openapi_types(): 'string': (foo.Foo,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -90,9 +93,7 @@ def discriminator(): 'string': 'string', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -100,9 +101,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """inline_response_default.InlineResponseDefault - a model defined in OpenAPI Keyword Args: @@ -119,6 +122,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) string (foo.Foo): [optional] # noqa: E501 """ @@ -127,6 +145,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py new file mode 100644 index 000000000000..6ef7500c2c62 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] +try: + from petstore_api.models import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.models.triangle_interface'] + + +class IsoscelesTriangle(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """isosceles_triangle.IsoscelesTriangle - a model defined in OpenAPI + + Args: + shape_type (str): + triangle_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'triangle_type': triangle_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + shape_interface.ShapeInterface, + triangle_interface.TriangleInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py index c7c80e8bd28b..3f85acb2e4d3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class List(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_123_list': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_123_list': '123-list', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """list.List - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _123_list (str): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py index d5ee114fe25f..d57315bdd61a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Mammal(ModelComposed): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -95,7 +98,7 @@ def openapi_types(): 'type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): val = { 'whale': whale.Whale, @@ -118,12 +121,14 @@ def discriminator(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', '_composed_instances', '_var_name_to_model_instances', '_additional_properties_model_instances', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """mammal.Mammal - a model defined in OpenAPI Args: @@ -143,6 +148,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) has_baleen (bool): [optional] # noqa: E501 has_teeth (bool): [optional] # noqa: E501 type (str): [optional] # noqa: E501 @@ -153,12 +173,14 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) constant_args = { '_check_type': _check_type, '_path_to_item': _path_to_item, '_from_server': _from_server, '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, } required_args = { 'class_name': class_name, @@ -189,7 +211,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it continue setattr(self, var_name, var_value) - @staticmethod + @cached_property def _composed_schemas(): # we need this here to make our import statements work # we must store _composed_schemas in here so the code is only run @@ -210,12 +232,12 @@ def _composed_schemas(): } @classmethod - def get_discriminator_class(cls, from_server, data): + def get_discriminator_class(cls, data): """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() + discriminator = cls.discriminator discr_propertyname_py = list(discriminator.keys())[0] discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if from_server: + if discr_propertyname_js in data: class_name = data[discr_propertyname_js] else: class_name = data[discr_propertyname_py] diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py index 8cc47c0a6922..e3510cef772f 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -72,7 +75,7 @@ class MapTest(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -89,7 +92,7 @@ def openapi_types(): 'indirect_map': (string_boolean_map.StringBooleanMap,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'indirect_map': 'indirect_map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """map_test.MapTest - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) map_map_of_string ({str: ({str: (str,)},)}): [optional] # noqa: E501 map_of_enum_string ({str: (str,)}): [optional] # noqa: E501 direct_map ({str: (bool,)}): [optional] # noqa: E501 @@ -140,6 +158,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py index 143a79bfa266..36f5add3db88 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -84,7 +87,7 @@ def openapi_types(): 'map': ({str: (animal.Animal,)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -94,9 +97,7 @@ def discriminator(): 'map': 'map', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -104,9 +105,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI Keyword Args: @@ -123,6 +126,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) uuid (str): [optional] # noqa: E501 date_time (datetime): [optional] # noqa: E501 map ({str: (animal.Animal,)}): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py index 0c3885120210..96d39402d563 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Model200Response(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): '_class': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): '_class': 'class', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model200_response.Model200Response - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) name (int): [optional] # noqa: E501 _class (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py index 75c3cea6318b..f9213c37ea7e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ModelReturn(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): '_return': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): '_return': 'return', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """model_return.ModelReturn - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) _return (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py index db81ae16916d..b2fce89ec9b7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Name(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -80,7 +83,7 @@ def openapi_types(): '_123_number': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -91,9 +94,7 @@ def discriminator(): '_123_number': '123Number', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -101,9 +102,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """name.Name - a model defined in OpenAPI Args: @@ -123,6 +126,21 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) snake_case (int): [optional] # noqa: E501 _property (str): [optional] # noqa: E501 _123_number (int): [optional] # noqa: E501 @@ -133,6 +151,7 @@ def __init__(self, name, _check_type=True, _from_server=False, _path_to_item=(), self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py index c97b8227cde6..89d8720a969c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class NullableClass(ModelNormal): additional_properties_type = (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'object_items_nullable': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -107,9 +110,7 @@ def discriminator(): 'object_items_nullable': 'object_items_nullable', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -117,9 +118,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """nullable_class.NullableClass - a model defined in OpenAPI Keyword Args: @@ -136,6 +139,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) integer_prop (int, none_type): [optional] # noqa: E501 number_prop (float, none_type): [optional] # noqa: E501 boolean_prop (bool, none_type): [optional] # noqa: E501 @@ -155,6 +173,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py index 0c91e2ae62d0..896757360765 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class NumberOnly(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'just_number': (float,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'just_number': 'JustNumber', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """number_only.NumberOnly - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) just_number (float): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py index 673295a8610c..6ff62a572333 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class Order(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -87,7 +90,7 @@ def openapi_types(): 'complete': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -100,9 +103,7 @@ def discriminator(): 'complete': 'complete', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -110,9 +111,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """order.Order - a model defined in OpenAPI Keyword Args: @@ -129,6 +132,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 pet_id (int): [optional] # noqa: E501 quantity (int): [optional] # noqa: E501 @@ -142,6 +160,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py index d797e2f7d07a..da7cbd159058 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class OuterComposite(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'my_boolean': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'my_boolean': 'my_boolean', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_composite.OuterComposite - a model defined in OpenAPI Keyword Args: @@ -118,6 +121,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) my_number (float): [optional] # noqa: E501 my_string (str): [optional] # noqa: E501 my_boolean (bool): [optional] # noqa: E501 @@ -128,6 +146,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py index ad948db05274..7c09a5b8d59a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -65,7 +68,7 @@ class OuterEnum(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,13 +82,11 @@ def openapi_types(): 'value': (str, none_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum.OuterEnum - a model defined in OpenAPI Args: @@ -115,6 +118,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -122,6 +140,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py index 789bf4ae86fa..fdc882ee5dba 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnumDefaultValue(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value='placed', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value='placed', _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum_default_value.OuterEnumDefaultValue - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value='placed', _check_type=True, _from_server=False, _path_t deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value='placed', _check_type=True, _from_server=False, _path_t self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py index a6323a7fc0ea..187a714b33bf 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnumInteger(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum_integer.OuterEnumInteger - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value, _check_type=True, _from_server=False, _path_to_item=() self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py index 1098c6494504..41da57604fc8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -64,7 +67,7 @@ class OuterEnumIntegerDefaultValue(ModelSimple): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,13 +81,11 @@ def openapi_types(): 'value': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = None required_properties = set([ '_data_store', @@ -92,9 +93,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """outer_enum_integer_default_value.OuterEnumIntegerDefaultValue - a model defined in OpenAPI Args: @@ -114,6 +117,21 @@ def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item= deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -121,6 +139,7 @@ def __init__(self, value=0, _check_type=True, _from_server=False, _path_to_item= self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py index 74cd8afef1af..1b34db901312 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -78,7 +81,7 @@ class Pet(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -97,7 +100,7 @@ def openapi_types(): 'status': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -110,9 +113,7 @@ def discriminator(): 'status': 'status', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -120,9 +121,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """pet.Pet - a model defined in OpenAPI Args: @@ -143,6 +146,21 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 category (category.Category): [optional] # noqa: E501 tags ([tag.Tag]): [optional] # noqa: E501 @@ -154,6 +172,7 @@ def __init__(self, name, photo_urls, _check_type=True, _from_server=False, _path self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name self.photo_urls = photo_urls diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py new file mode 100644 index 000000000000..30443f766f02 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import complex_quadrilateral +except ImportError: + complex_quadrilateral = sys.modules[ + 'petstore_api.models.complex_quadrilateral'] +try: + from petstore_api.models import simple_quadrilateral +except ImportError: + simple_quadrilateral = sys.modules[ + 'petstore_api.models.simple_quadrilateral'] + + +class Quadrilateral(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + val = { + 'ComplexQuadrilateral': complex_quadrilateral.ComplexQuadrilateral, + 'SimpleQuadrilateral': simple_quadrilateral.SimpleQuadrilateral, + } + if not val: + return None + return {'quadrilateral_type': val} + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, quadrilateral_type, shape_type=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """quadrilateral.Quadrilateral - a model defined in OpenAPI + + Args: + quadrilateral_type (str): + + Keyword Args: + shape_type (str): defaults to nulltype.Null # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + complex_quadrilateral.ComplexQuadrilateral, + simple_quadrilateral.SimpleQuadrilateral, + ], + } + + @classmethod + def get_discriminator_class(cls, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in data: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py new file mode 100644 index 000000000000..2f60ea9362dc --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class QuadrilateralInterface(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """quadrilateral_interface.QuadrilateralInterface - a model defined in OpenAPI + + Args: + quadrilateral_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.quadrilateral_type = quadrilateral_type + for var_name, var_value in six.iteritems(kwargs): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py index 329ec017d435..8c6d80c71f16 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class ReadOnlyFirst(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'baz': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'baz': 'baz', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """read_only_first.ReadOnlyFirst - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) bar (str): [optional] # noqa: E501 baz (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py new file mode 100644 index 000000000000..8a9b46fd4c6f --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] +try: + from petstore_api.models import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.models.triangle_interface'] + + +class ScaleneTriangle(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """scalene_triangle.ScaleneTriangle - a model defined in OpenAPI + + Args: + shape_type (str): + triangle_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'triangle_type': triangle_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + shape_interface.ShapeInterface, + triangle_interface.TriangleInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py new file mode 100644 index 000000000000..bb8ec6d238ec --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py @@ -0,0 +1,239 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.models.quadrilateral'] +try: + from petstore_api.models import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.models.triangle'] + + +class Shape(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + val = { + 'Quadrilateral': quadrilateral.Quadrilateral, + 'Triangle': triangle.Triangle, + } + if not val: + return None + return {'shape_type': val} + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type=nulltype.Null, triangle_type=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """shape.Shape - a model defined in OpenAPI + + Args: + shape_type (str): + + Keyword Args: + quadrilateral_type (str): defaults to nulltype.Null # noqa: E501 + triangle_type (str): defaults to nulltype.Null # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + 'triangle_type': triangle_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + quadrilateral.Quadrilateral, + triangle.Triangle, + ], + } + + @classmethod + def get_discriminator_class(cls, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in data: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py new file mode 100644 index 000000000000..1152adfc8a48 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class ShapeInterface(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """shape_interface.ShapeInterface - a model defined in OpenAPI + + Args: + shape_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shape_type = shape_type + for var_name, var_value in six.iteritems(kwargs): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py new file mode 100644 index 000000000000..cd92ebf412e8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py @@ -0,0 +1,216 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.models.quadrilateral_interface'] +try: + from petstore_api.models import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.models.shape_interface'] + + +class SimpleQuadrilateral(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'quadrilateral_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'quadrilateral_type': 'quadrilateralType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, shape_type, quadrilateral_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """simple_quadrilateral.SimpleQuadrilateral - a model defined in OpenAPI + + Args: + shape_type (str): + quadrilateral_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'quadrilateral_type': quadrilateral_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + quadrilateral_interface.QuadrilateralInterface, + shape_interface.ShapeInterface, + ], + 'oneOf': [ + ], + } diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py index d4ffc608a579..168554fa343e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class SpecialModelName(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -77,7 +80,7 @@ def openapi_types(): 'special_property_name': (int,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -85,9 +88,7 @@ def discriminator(): 'special_property_name': '$special[property.name]', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -95,9 +96,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """special_model_name.SpecialModelName - a model defined in OpenAPI Keyword Args: @@ -114,6 +117,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) special_property_name (int): [optional] # noqa: E501 """ @@ -122,6 +140,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py index 7f797f5f1b5d..10d0a9882261 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class StringBooleanMap(ModelNormal): additional_properties_type = (bool,) # noqa: E501 - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -76,16 +79,14 @@ def openapi_types(): return { } - @staticmethod + @cached_property def discriminator(): return None attribute_map = { } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -93,9 +94,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """string_boolean_map.StringBooleanMap - a model defined in OpenAPI Keyword Args: @@ -112,6 +115,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) """ self._data_store = {} @@ -119,6 +137,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py index 8ffba1b13071..26cdd6f50922 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Tag(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -78,7 +81,7 @@ def openapi_types(): 'name': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -87,9 +90,7 @@ def discriminator(): 'name': 'name', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -97,9 +98,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """tag.Tag - a model defined in OpenAPI Keyword Args: @@ -116,6 +119,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 name (str): [optional] # noqa: E501 """ @@ -125,6 +143,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py new file mode 100644 index 000000000000..fb3536503993 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py @@ -0,0 +1,242 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) +try: + from petstore_api.models import equilateral_triangle +except ImportError: + equilateral_triangle = sys.modules[ + 'petstore_api.models.equilateral_triangle'] +try: + from petstore_api.models import isosceles_triangle +except ImportError: + isosceles_triangle = sys.modules[ + 'petstore_api.models.isosceles_triangle'] +try: + from petstore_api.models import scalene_triangle +except ImportError: + scalene_triangle = sys.modules[ + 'petstore_api.models.scalene_triangle'] + + +class Triangle(ModelComposed): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shape_type': (str,), # noqa: E501 + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + val = { + 'EquilateralTriangle': equilateral_triangle.EquilateralTriangle, + 'IsoscelesTriangle': isosceles_triangle.IsoscelesTriangle, + 'ScaleneTriangle': scalene_triangle.ScaleneTriangle, + } + if not val: + return None + return {'triangle_type': val} + + attribute_map = { + 'shape_type': 'shapeType', # noqa: E501 + 'triangle_type': 'triangleType', # noqa: E501 + } + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, triangle_type, shape_type=nulltype.Null, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """triangle.Triangle - a model defined in OpenAPI + + Args: + triangle_type (str): + + Keyword Args: + shape_type (str): defaults to nulltype.Null # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_from_server': _from_server, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + required_args = { + 'shape_type': shape_type, + 'triangle_type': triangle_type, + } + # remove args whose value is Null because they are unset + required_arg_names = list(required_args.keys()) + for required_arg_name in required_arg_names: + if required_args[required_arg_name] is nulltype.Null: + del required_args[required_arg_name] + model_args = {} + model_args.update(required_args) + model_args.update(kwargs) + composed_info = validate_get_composed_info( + constant_args, model_args, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + unused_args = composed_info[3] + + for var_name, var_value in required_args.items(): + setattr(self, var_name, var_value) + for var_name, var_value in six.iteritems(kwargs): + if var_name in unused_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + not self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + @cached_property + def _composed_schemas(): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + equilateral_triangle.EquilateralTriangle, + isosceles_triangle.IsoscelesTriangle, + scalene_triangle.ScaleneTriangle, + ], + } + + @classmethod + def get_discriminator_class(cls, data): + """Returns the child class specified by the discriminator""" + discriminator = cls.discriminator + discr_propertyname_py = list(discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in data: + class_name = data[discr_propertyname_js] + else: + class_name = data[discr_propertyname_py] + class_name_to_discr_class = discriminator[discr_propertyname_py] + return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py new file mode 100644 index 000000000000..5881e3c94728 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import +import re # noqa: F401 +import sys # noqa: F401 + +import six # noqa: F401 +import nulltype # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + int, + none_type, + str, + validate_get_composed_info, +) + + +class TriangleInterface(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + @cached_property + def openapi_types(): + """ + This must be a class method so a model may have properties that are + of type self, this ensures that we don't create a cyclic import + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'triangle_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + attribute_map = { + 'triangle_type': 'triangleType', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_from_server', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, triangle_type, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 + """triangle_interface.TriangleInterface - a model defined in OpenAPI + + Args: + triangle_type (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _from_server (bool): True if the data is from the server + False if the data is from the client (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + self._data_store = {} + self._check_type = _check_type + self._from_server = _from_server + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.triangle_type = triangle_type + for var_name, var_value in six.iteritems(kwargs): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py index 31e9e36b1ad0..7a571040a2fa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class User(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -88,7 +91,7 @@ def openapi_types(): 'arbitrary_nullable_type_value': (object, none_type,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -107,9 +110,7 @@ def discriminator(): 'arbitrary_nullable_type_value': 'arbitraryNullableTypeValue', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -117,9 +118,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """user.User - a model defined in OpenAPI Keyword Args: @@ -136,6 +139,21 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) id (int): [optional] # noqa: E501 username (str): [optional] # noqa: E501 first_name (str): [optional] # noqa: E501 @@ -155,6 +173,7 @@ def __init__(self, _check_type=True, _from_server=False, _path_to_item=(), _conf self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in six.iteritems(kwargs): if var_name not in self.attribute_map and \ diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py index 0c166e663015..c89497b6b556 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -63,7 +66,7 @@ class Whale(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -79,7 +82,7 @@ def openapi_types(): 'has_teeth': (bool,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -89,9 +92,7 @@ def discriminator(): 'has_teeth': 'hasTeeth', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -99,9 +100,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """whale.Whale - a model defined in OpenAPI Args: @@ -121,6 +124,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) has_baleen (bool): [optional] # noqa: E501 has_teeth (bool): [optional] # noqa: E501 """ @@ -130,6 +148,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py index 56c0b34c2672..53c8a1dc2dee 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py @@ -21,6 +21,9 @@ ModelComposed, ModelNormal, ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, date, datetime, file_type, @@ -68,7 +71,7 @@ class Zebra(ModelNormal): additional_properties_type = None - @staticmethod + @cached_property def openapi_types(): """ This must be a class method so a model may have properties that are @@ -83,7 +86,7 @@ def openapi_types(): 'type': (str,), # noqa: E501 } - @staticmethod + @cached_property def discriminator(): return None @@ -92,9 +95,7 @@ def discriminator(): 'type': 'type', # noqa: E501 } - @staticmethod - def _composed_schemas(): - return None + _composed_schemas = {} required_properties = set([ '_data_store', @@ -102,9 +103,11 @@ def _composed_schemas(): '_from_server', '_path_to_item', '_configuration', + '_visited_composed_classes', ]) - def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 + @convert_js_args_to_python_args + def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_item=(), _configuration=None, _visited_composed_classes=(), **kwargs): # noqa: E501 """zebra.Zebra - a model defined in OpenAPI Args: @@ -124,6 +127,21 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) type (str): [optional] # noqa: E501 """ @@ -132,6 +150,7 @@ def __init__(self, class_name, _check_type=True, _from_server=False, _path_to_it self._from_server = _from_server self._path_to_item = _path_to_item self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.class_name = class_name for var_name, var_value in six.iteritems(kwargs): diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py new file mode 100644 index 000000000000..b1d4fc9079bd --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestComplexQuadrilateral(unittest.TestCase): + """ComplexQuadrilateral unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testComplexQuadrilateral(self): + """Test ComplexQuadrilateral""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.ComplexQuadrilateral() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py new file mode 100644 index 000000000000..cdef216105eb --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestEquilateralTriangle(unittest.TestCase): + """EquilateralTriangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEquilateralTriangle(self): + """Test EquilateralTriangle""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.EquilateralTriangle() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py index ee32229a8bbd..3b16da852e3d 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py @@ -66,9 +66,9 @@ def testFruit(self): invalid_variable = getattr(fruit, 'cultivar', 'some value') # make sure that the ModelComposed class properties are correct - # model.composed_schemas() stores the anyOf/allOf/oneOf info + # model._composed_schemas stores the anyOf/allOf/oneOf info self.assertEqual( - fruit._composed_schemas(), + fruit._composed_schemas, { 'anyOf': [], 'allOf': [], @@ -79,7 +79,7 @@ def testFruit(self): } ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Banana: banana_instance = composed_instance @@ -147,7 +147,7 @@ def testFruit(self): ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Apple: apple_instance = composed_instance diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py index 2fa26fac0aa5..89905eca7504 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py @@ -61,9 +61,9 @@ def testFruitReq(self): invalid_variable = getattr(fruit, 'cultivar', 'some value') # make sure that the ModelComposed class properties are correct - # model.composed_schemas() stores the anyOf/allOf/oneOf info + # model._composed_schemas stores the anyOf/allOf/oneOf info self.assertEqual( - fruit._composed_schemas(), + fruit._composed_schemas, { 'anyOf': [], 'allOf': [], @@ -74,7 +74,7 @@ def testFruitReq(self): } ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.BananaReq: banana_instance = composed_instance @@ -137,7 +137,7 @@ def testFruitReq(self): ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.AppleReq: apple_instance = composed_instance diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py index dd9605bd8a1b..b8e02ed45a74 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py @@ -66,9 +66,9 @@ def testGmFruit(self): invalid_variable = getattr(fruit, 'cultivar', 'some value') # make sure that the ModelComposed class properties are correct - # model.composed_schemas() stores the anyOf/allOf/oneOf info + # model._composed_schemas stores the anyOf/allOf/oneOf info self.assertEqual( - fruit._composed_schemas(), + fruit._composed_schemas, { 'anyOf': [ petstore_api.Apple, @@ -79,7 +79,7 @@ def testGmFruit(self): } ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Banana: banana_instance = composed_instance @@ -137,7 +137,7 @@ def testGmFruit(self): self.assertEqual(getattr(fruit, 'length_cm'), length_cm) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Apple: apple_instance = composed_instance @@ -180,7 +180,7 @@ def testGmFruit(self): ) # model._composed_instances is a list of the instances that were - # made from the anyOf/allOf/OneOf classes in model._composed_schemas() + # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: if composed_instance.__class__ == petstore_api.Apple: apple_instance = composed_instance diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py new file mode 100644 index 000000000000..1f27f751d061 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestIsoscelesTriangle(unittest.TestCase): + """IsoscelesTriangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testIsoscelesTriangle(self): + """Test IsoscelesTriangle""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.IsoscelesTriangle() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py new file mode 100644 index 000000000000..9bb838811892 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestQuadrilateral(unittest.TestCase): + """Quadrilateral unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testQuadrilateral(self): + """Test Quadrilateral""" + complex_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral") + assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) + simple_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral") + assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py new file mode 100644 index 000000000000..7a48ce64a9df --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestQuadrilateralInterface(unittest.TestCase): + """QuadrilateralInterface unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testQuadrilateralInterface(self): + """Test QuadrilateralInterface""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.QuadrilateralInterface() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py new file mode 100644 index 000000000000..8452fc183137 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestScaleneTriangle(unittest.TestCase): + """ScaleneTriangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testScaleneTriangle(self): + """Test ScaleneTriangle""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.ScaleneTriangle() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py new file mode 100644 index 000000000000..c8296aad8ef8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestShape(unittest.TestCase): + """Shape unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testShape(self): + """Test Shape""" + equilateral_triangle = petstore_api.Triangle( + shape_type="Triangle", + triangle_type="EquilateralTriangle" + ) + assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) + + isosceles_triangle = petstore_api.Triangle( + shape_type="Triangle", + triangle_type="IsoscelesTriangle" + ) + assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) + + scalene_triangle = petstore_api.Triangle( + shape_type="Triangle", + triangle_type="ScaleneTriangle" + ) + assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + + complex_quadrilateral = petstore_api.Shape( + shape_type="Quadrilateral", + quadrilateral_type="ComplexQuadrilateral" + ) + assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) + + simple_quadrilateral = petstore_api.Shape( + shape_type="Quadrilateral", + quadrilateral_type="SimpleQuadrilateral" + ) + assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + + # invalid shape_type (first discriminator) + err_msg = ("Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '{}'='{}' at path: ()" + ) + with self.assertRaisesRegexp( + petstore_api.ApiValueError, + err_msg.format("shapeType", "Circle") + ): + petstore_api.Shape(shape_type="Circle") + + # invalid quadrilateral_type (second discriminator) + with self.assertRaisesRegexp( + petstore_api.ApiValueError, + err_msg.format("quadrilateralType", "Triangle") + ): + petstore_api.Shape( + shape_type="Quadrilateral", + quadrilateral_type="Triangle" + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py new file mode 100644 index 000000000000..a768951489a0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestShapeInterface(unittest.TestCase): + """ShapeInterface unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testShapeInterface(self): + """Test ShapeInterface""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.ShapeInterface() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py new file mode 100644 index 000000000000..f51722093445 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestSimpleQuadrilateral(unittest.TestCase): + """SimpleQuadrilateral unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSimpleQuadrilateral(self): + """Test SimpleQuadrilateral""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.SimpleQuadrilateral() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py new file mode 100644 index 000000000000..42037a1ec79b --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestTriangle(unittest.TestCase): + """Triangle unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTriangle(self): + """Test Triangle""" + equilateral_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle") + assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) + isosceles_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="IsoscelesTriangle") + assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) + scalene_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="ScaleneTriangle") + assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py new file mode 100644 index 000000000000..4d87e647e61e --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestTriangleInterface(unittest.TestCase): + """TriangleInterface unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTriangleInterface(self): + """Test TriangleInterface""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.TriangleInterface() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py index f1a71a67378b..1cff538a15fc 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py @@ -27,6 +27,48 @@ def setUp(self): self.api_client = petstore_api.ApiClient() self.deserialize = self.api_client.deserialize + def test_deserialize_shape(self): + """ + + deserialize Shape to an instance of: + - EquilateralTriangle + - IsoscelesTriangle + - IsoscelesTriangle + - ScaleneTriangle + - ComplexQuadrilateral + - SimpleQuadrilateral + by traveling through 2 discriminators + """ + shape_type, triangle_type = ['Triangle', 'EquilateralTriangle'] + data = { + 'shapeType': shape_type, + 'triangleType': triangle_type, + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, (petstore_api.Shape,), True) + self.assertTrue(isinstance(deserialized, petstore_api.EquilateralTriangle)) + self.assertEqual(deserialized.shape_type, shape_type) + self.assertEqual(deserialized.triangle_type, triangle_type) + + # invalid second discriminator value + shape_type, quadrilateral_type = ['Quadrilateral', 'Triangle'] + data = { + 'shapeType': shape_type, + 'quadrilateralType': quadrilateral_type, + } + response = MockResponse(data=json.dumps(data)) + + err_msg = ("Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '{}'='{}' at path: ()" + ) + with self.assertRaisesRegexp( + petstore_api.ApiValueError, + err_msg.format("quadrilateralType", "Triangle") + ): + self.deserialize(response, (petstore_api.Shape,), True) + def test_deserialize_animal(self): """ deserialize Animal to a Dog instance From 138276a7c4d15e4a855206cd2e2d92b20ada2840 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 4 May 2020 10:45:02 +0800 Subject: [PATCH 61/78] skip web.config for aspnetcore 3.x (#6147) --- .../codegen/languages/AspNetCoreServerCodegen.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java index c39677a10216..fcd882f6d9ef 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java @@ -325,7 +325,7 @@ public void processOpts() { if (!additionalProperties.containsKey(NEWTONSOFT_VERSION)) { additionalProperties.put(NEWTONSOFT_VERSION, newtonsoftVersion); } else { - newtonsoftVersion = (String)additionalProperties.get(NEWTONSOFT_VERSION); + newtonsoftVersion = (String) additionalProperties.get(NEWTONSOFT_VERSION); } // CHeck for the modifiers etc. @@ -383,8 +383,6 @@ public void processOpts() { // wwwroot files. supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "README.md", packageFolder + File.separator + "wwwroot", "README.md")); supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "index.html", packageFolder + File.separator + "wwwroot", "index.html")); - supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "web.config", packageFolder + File.separator + "wwwroot", "web.config")); - supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "openapi-original.mustache", packageFolder + File.separator + "wwwroot", "openapi-original.json")); } else { @@ -398,7 +396,7 @@ public void processOpts() { packageFolder + File.separator + "Filters", "GeneratePathParamsValidationFilter.cs")); } - supportingFiles.add(new SupportingFile("Authentication" + File.separator + "ApiAuthentication.mustache",packageFolder + File.separator + "Authentication", "ApiAuthentication.cs")); + supportingFiles.add(new SupportingFile("Authentication" + File.separator + "ApiAuthentication.mustache", packageFolder + File.separator + "Authentication", "ApiAuthentication.cs")); } public void setPackageGuid(String packageGuid) { @@ -542,6 +540,8 @@ private void setAspnetCoreVersion(String packageFolder) { } else if ("2.0".equals(aspnetCoreVersion.getOptValue())) { supportingFiles.add(new SupportingFile("web.config", packageFolder, "web.config")); compatibilityVersion = null; + } else if ("2.2".equals(aspnetCoreVersion.getOptValue()) || "2.1".equals(aspnetCoreVersion.getOptValue())) { + supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "web.config", packageFolder + File.separator + "wwwroot", "web.config")); } else { // default, do nothing compatibilityVersion = "Version_" + aspnetCoreVersion.getOptValue().replace(".", "_"); From b369f9bfea31cb0893c666ad7dfbc1a579517168 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 4 May 2020 14:28:54 +0800 Subject: [PATCH 62/78] fix bearer auth in c# netcore async call (#6136) --- .../src/main/resources/csharp-netcore/api.mustache | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache index acb38af063a4..700486f37688 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/api.mustache @@ -493,11 +493,20 @@ namespace {{packageName}}.{{apiPackage}} {{/isKeyInQuery}} {{/isApiKey}} {{#isBasic}} + {{#isBasicBasic}} // http basic authentication required if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password)) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); } + {{/isBasicBasic}} + {{#isBasicBearer}} + // bearer authentication required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} // oauth required From 9afa154a5e838b7b9e822287c3a7a16602554643 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 4 May 2020 15:09:28 +0800 Subject: [PATCH 63/78] [aspnetcore] test petstore samples in drone.io (#6148) * test aspnetcore 3.0/3.1 in drone.io * switch images * trigger build failure * Revert "trigger build failure" This reverts commit f5c2c1578db1a0e7b90a668f095e1d6eb1766fca. --- CI/.drone.yml | 6 + README.md | 1 + bin/aspnetcore-petstore-server-3.0.sh | 32 + bin/aspnetcore-petstore-server-3.1.sh | 32 + .../aspnetcore-3.0/.openapi-generator-ignore | 23 + .../aspnetcore-3.0/.openapi-generator/VERSION | 1 + .../aspnetcore-3.0/Org.OpenAPITools.sln | 22 + .../server/petstore/aspnetcore-3.0/README.md | 24 + .../server/petstore/aspnetcore-3.0/build.bat | 9 + .../server/petstore/aspnetcore-3.0/build.sh | 8 + .../src/Org.OpenAPITools/.gitignore | 208 ++++ .../Attributes/ValidateModelStateAttribute.cs | 61 + .../Authentication/ApiAuthentication.cs | 63 + .../Org.OpenAPITools/Controllers/PetApi.cs | 232 ++++ .../Org.OpenAPITools/Controllers/StoreApi.cs | 139 +++ .../Org.OpenAPITools/Controllers/UserApi.cs | 207 ++++ .../Converters/CustomEnumConverter.cs | 42 + .../src/Org.OpenAPITools/Dockerfile | 32 + .../Filters/BasePathFilter.cs | 50 + .../GeneratePathParamsValidationFilter.cs | 98 ++ .../Org.OpenAPITools/Models/ApiResponse.cs | 147 +++ .../src/Org.OpenAPITools/Models/Category.cs | 133 +++ .../src/Org.OpenAPITools/Models/Order.cs | 219 ++++ .../src/Org.OpenAPITools/Models/Pet.cs | 223 ++++ .../src/Org.OpenAPITools/Models/Tag.cs | 133 +++ .../src/Org.OpenAPITools/Models/User.cs | 218 ++++ .../OpenApi/TypeExtensions.cs | 51 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 24 + .../src/Org.OpenAPITools/Program.cs | 33 + .../Properties/launchSettings.json | 37 + .../src/Org.OpenAPITools/Startup.cs | 150 +++ .../src/Org.OpenAPITools/appsettings.json | 8 + .../src/Org.OpenAPITools/wwwroot/README.md | 42 + .../src/Org.OpenAPITools/wwwroot/index.html | 1 + .../wwwroot/openapi-original.json | 1012 +++++++++++++++++ .../aspnetcore-3.1/.openapi-generator-ignore | 23 + .../aspnetcore-3.1/.openapi-generator/VERSION | 1 + .../aspnetcore-3.1/Org.OpenAPITools.sln | 22 + .../server/petstore/aspnetcore-3.1/README.md | 24 + .../server/petstore/aspnetcore-3.1/build.bat | 9 + .../server/petstore/aspnetcore-3.1/build.sh | 8 + .../src/Org.OpenAPITools/.gitignore | 208 ++++ .../Attributes/ValidateModelStateAttribute.cs | 61 + .../Authentication/ApiAuthentication.cs | 63 + .../Org.OpenAPITools/Controllers/PetApi.cs | 232 ++++ .../Org.OpenAPITools/Controllers/StoreApi.cs | 139 +++ .../Org.OpenAPITools/Controllers/UserApi.cs | 207 ++++ .../Converters/CustomEnumConverter.cs | 42 + .../src/Org.OpenAPITools/Dockerfile | 32 + .../Filters/BasePathFilter.cs | 50 + .../GeneratePathParamsValidationFilter.cs | 98 ++ .../Org.OpenAPITools/Models/ApiResponse.cs | 147 +++ .../src/Org.OpenAPITools/Models/Category.cs | 133 +++ .../src/Org.OpenAPITools/Models/Order.cs | 219 ++++ .../src/Org.OpenAPITools/Models/Pet.cs | 223 ++++ .../src/Org.OpenAPITools/Models/Tag.cs | 133 +++ .../src/Org.OpenAPITools/Models/User.cs | 218 ++++ .../OpenApi/TypeExtensions.cs | 51 + .../Org.OpenAPITools/Org.OpenAPITools.csproj | 24 + .../src/Org.OpenAPITools/Program.cs | 33 + .../Properties/launchSettings.json | 37 + .../src/Org.OpenAPITools/Startup.cs | 150 +++ .../src/Org.OpenAPITools/appsettings.json | 8 + .../src/Org.OpenAPITools/wwwroot/README.md | 42 + .../src/Org.OpenAPITools/wwwroot/index.html | 1 + .../wwwroot/openapi-original.json | 1012 +++++++++++++++++ 66 files changed, 7371 insertions(+) create mode 100755 bin/aspnetcore-petstore-server-3.0.sh create mode 100755 bin/aspnetcore-petstore-server-3.1.sh create mode 100644 samples/server/petstore/aspnetcore-3.0/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnetcore-3.0/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnetcore-3.0/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnetcore-3.0/README.md create mode 100644 samples/server/petstore/aspnetcore-3.0/build.bat create mode 100644 samples/server/petstore/aspnetcore-3.0/build.sh create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/.gitignore create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Dockerfile create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/BasePathFilter.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Startup.cs create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/README.md create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/index.html create mode 100644 samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/openapi-original.json create mode 100644 samples/server/petstore/aspnetcore-3.1/.openapi-generator-ignore create mode 100644 samples/server/petstore/aspnetcore-3.1/.openapi-generator/VERSION create mode 100644 samples/server/petstore/aspnetcore-3.1/Org.OpenAPITools.sln create mode 100644 samples/server/petstore/aspnetcore-3.1/README.md create mode 100644 samples/server/petstore/aspnetcore-3.1/build.bat create mode 100644 samples/server/petstore/aspnetcore-3.1/build.sh create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/.gitignore create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Dockerfile create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/BasePathFilter.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/ApiResponse.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Category.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Order.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Pet.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Tag.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/User.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Program.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Properties/launchSettings.json create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Startup.cs create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/appsettings.json create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/README.md create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/index.html create mode 100644 samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/openapi-original.json diff --git a/CI/.drone.yml b/CI/.drone.yml index b65d5d3e720e..3cb1983fbb54 100644 --- a/CI/.drone.yml +++ b/CI/.drone.yml @@ -2,6 +2,12 @@ kind: pipeline name: default steps: +# test aspnetcore 3.x +- name: aspnetcore-test + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + commands: + - (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh) + - (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh) # test ocaml petstore client - name: ocaml-test image: ocaml/opam2:4.07 diff --git a/README.md b/README.md index c9bec50e1147..3d0746a6dbf2 100644 --- a/README.md +++ b/README.md @@ -849,6 +849,7 @@ Here is a list of template creators: * Ada: @stcarrez * C# ASP.NET 5: @jimschubert [:heart:](https://www.patreon.com/jimschubert) * C# ASP.NET Core 3.0: @A-Joshi + * C# APS.NET Core 3.1: @phatcher * C# NancyFX: @mstefaniuk * C++ (Qt5 QHttpEngine): @etherealjoy * C++ Pistache: @sebymiano diff --git a/bin/aspnetcore-petstore-server-3.0.sh b/bin/aspnetcore-petstore-server-3.0.sh new file mode 100755 index 000000000000..9dcb4845e065 --- /dev/null +++ b/bin/aspnetcore-petstore-server-3.0.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/2.1/ -o samples/server/petstore/aspnetcore-3.0 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/aspnetcore-petstore-server-3.1.sh b/bin/aspnetcore-petstore-server-3.1.sh new file mode 100755 index 000000000000..e85d2ce69692 --- /dev/null +++ b/bin/aspnetcore-petstore-server-3.1.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn -B clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/2.1/ -o samples/server/petstore/aspnetcore-3.1 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.1 $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/samples/server/petstore/aspnetcore-3.0/.openapi-generator-ignore b/samples/server/petstore/aspnetcore-3.0/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.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/server/petstore/aspnetcore-3.0/.openapi-generator/VERSION b/samples/server/petstore/aspnetcore-3.0/.openapi-generator/VERSION new file mode 100644 index 000000000000..b5d898602c2c --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.0/Org.OpenAPITools.sln b/samples/server/petstore/aspnetcore-3.0/Org.OpenAPITools.sln new file mode 100644 index 000000000000..c2bc38764202 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/Org.OpenAPITools.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2043 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3C799344-F285-4669-8FD5-7ED9B795D5C5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnetcore-3.0/README.md b/samples/server/petstore/aspnetcore-3.0/README.md new file mode 100644 index 000000000000..ad46d4e125cc --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/README.md @@ -0,0 +1,24 @@ +# Org.OpenAPITools - ASP.NET Core 3.0 Server + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Run + +Linux/OS X: + +``` +sh build.sh +``` + +Windows: + +``` +build.bat +``` +## Run in Docker + +``` +cd src/Org.OpenAPITools +docker build -t org.openapitools . +docker run -p 5000:8080 org.openapitools +``` diff --git a/samples/server/petstore/aspnetcore-3.0/build.bat b/samples/server/petstore/aspnetcore-3.0/build.bat new file mode 100644 index 000000000000..cd65518e4287 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/build.bat @@ -0,0 +1,9 @@ +:: Generated by: https://openapi-generator.tech +:: + +@echo off + +dotnet restore src\Org.OpenAPITools +dotnet build src\Org.OpenAPITools +echo Now, run the following to start the project: dotnet run -p src\Org.OpenAPITools\Org.OpenAPITools.csproj --launch-profile web. +echo. diff --git a/samples/server/petstore/aspnetcore-3.0/build.sh b/samples/server/petstore/aspnetcore-3.0/build.sh new file mode 100644 index 000000000000..afbeddb83782 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Generated by: https://openapi-generator.tech +# + +dotnet restore src/Org.OpenAPITools/ && \ + dotnet build src/Org.OpenAPITools/ && \ + echo "Now, run the following to start the project: dotnet run -p src/Org.OpenAPITools/Org.OpenAPITools.csproj --launch-profile web" diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/.gitignore b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/.gitignore new file mode 100644 index 000000000000..cd9b840e5498 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/.gitignore @@ -0,0 +1,208 @@ +PID + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# 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 +# TODO: 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 + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# 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/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ +orleans.codegen.cs + +# 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 + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs new file mode 100644 index 000000000000..f388cfdf9831 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs @@ -0,0 +1,61 @@ +using System.ComponentModel.DataAnnotations; +using System.Reflection; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace Org.OpenAPITools.Attributes +{ + /// <summary> + /// Model state validation attribute + /// </summary> + public class ValidateModelStateAttribute : ActionFilterAttribute + { + /// <summary> + /// Called before the action method is invoked + /// </summary> + /// <param name="context"></param> + public override void OnActionExecuting(ActionExecutingContext context) + { + // Per https://blog.markvincze.com/how-to-validate-action-parameters-with-dataannotation-attributes/ + var descriptor = context.ActionDescriptor as ControllerActionDescriptor; + if (descriptor != null) + { + foreach (var parameter in descriptor.MethodInfo.GetParameters()) + { + object args = null; + if (context.ActionArguments.ContainsKey(parameter.Name)) + { + args = context.ActionArguments[parameter.Name]; + } + + ValidateAttributes(parameter, args, context.ModelState); + } + } + + if (!context.ModelState.IsValid) + { + context.Result = new BadRequestObjectResult(context.ModelState); + } + } + + private void ValidateAttributes(ParameterInfo parameter, object args, ModelStateDictionary modelState) + { + foreach (var attributeData in parameter.CustomAttributes) + { + var attributeInstance = parameter.GetCustomAttribute(attributeData.AttributeType); + + var validationAttribute = attributeInstance as ValidationAttribute; + if (validationAttribute != null) + { + var isValid = validationAttribute.IsValid(args); + if (!isValid) + { + modelState.AddModelError(parameter.Name, validationAttribute.FormatErrorMessage(parameter.Name)); + } + } + } + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs new file mode 100644 index 000000000000..92b2512e441d --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc.Filters; + +namespace Org.OpenAPITools.Authentication +{ + /// <summary> + /// A requirement that an ApiKey must be present. + /// </summary> + public class ApiKeyRequirement : IAuthorizationRequirement + { + /// <summary> + /// Get the list of api keys + /// </summary> + public IReadOnlyList<string> ApiKeys { get; } + + /// <summary> + /// Get the policy name, + /// </summary> + public string PolicyName { get; } + + /// <summary> + /// Create a new instance of the <see cref="ApiKeyRequirement"/> class. + /// </summary> + /// <param name="apiKeys"></param> + /// <param name="policyName"></param> + public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) + { + ApiKeys = apiKeys?.ToList() ?? new List<string>(); + PolicyName = policyName; + } + } + + /// <summary> + /// Enforce that an api key is present. + /// </summary> + public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement> + { + /// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" /> + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + SucceedRequirementIfApiKeyPresentAndValid(context, requirement); + return Task.CompletedTask; + } + + private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + + if (context.Resource is AuthorizationFilterContext authorizationFilterContext) + { + var apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault(); + if (requirement.PolicyName == "api_key" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) + { + context.Succeed(requirement); + } + } + + } + } +} + diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs new file mode 100644 index 000000000000..2102b82d8fe6 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -0,0 +1,232 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class PetApiController : ControllerBase + { + /// <summary> + /// Add a new pet to the store + /// </summary> + /// <param name="body">Pet object that needs to be added to the store</param> + /// <response code="405">Invalid input</response> + [HttpPost] + [Route("/v2/pet")] + [ValidateModelState] + [SwaggerOperation("AddPet")] + public virtual IActionResult AddPet([FromBody]Pet body) + { + + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// Deletes a pet + /// </summary> + /// <param name="petId">Pet id to delete</param> + /// <param name="apiKey"></param> + /// <response code="400">Invalid pet value</response> + [HttpDelete] + [Route("/v2/pet/{petId}")] + [ValidateModelState] + [SwaggerOperation("DeletePet")] + public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + + throw new NotImplementedException(); + } + + /// <summary> + /// Finds Pets by status + /// </summary> + /// <remarks>Multiple status values can be provided with comma separated strings</remarks> + /// <param name="status">Status values that need to be considered for filter</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid status value</response> + [HttpGet] + [Route("/v2/pet/findByStatus")] + [ValidateModelState] + [SwaggerOperation("FindPetsByStatus")] + [SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")] + public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string> status) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(List<Pet>)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<List<Pet>>(exampleJson) + : default(List<Pet>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Finds Pets by tags + /// </summary> + /// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks> + /// <param name="tags">Tags to filter by</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid tag value</response> + [HttpGet] + [Route("/v2/pet/findByTags")] + [ValidateModelState] + [SwaggerOperation("FindPetsByTags")] + [SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")] + public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string> tags) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(List<Pet>)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<List<Pet>>(exampleJson) + : default(List<Pet>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Find pet by ID + /// </summary> + /// <remarks>Returns a single pet</remarks> + /// <param name="petId">ID of pet to return</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Pet not found</response> + [HttpGet] + [Route("/v2/pet/{petId}")] + [Authorize(Policy = "api_key")] + [ValidateModelState] + [SwaggerOperation("GetPetById")] + [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] + public virtual IActionResult GetPetById([FromRoute][Required]long petId) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Pet)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Pet>(exampleJson) + : default(Pet); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Update an existing pet + /// </summary> + /// <param name="body">Pet object that needs to be added to the store</param> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Pet not found</response> + /// <response code="405">Validation exception</response> + [HttpPut] + [Route("/v2/pet")] + [ValidateModelState] + [SwaggerOperation("UpdatePet")] + public virtual IActionResult UpdatePet([FromBody]Pet body) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// Updates a pet in the store with form data + /// </summary> + /// <param name="petId">ID of pet that needs to be updated</param> + /// <param name="name">Updated name of the pet</param> + /// <param name="status">Updated status of the pet</param> + /// <response code="405">Invalid input</response> + [HttpPost] + [Route("/v2/pet/{petId}")] + [ValidateModelState] + [SwaggerOperation("UpdatePetWithForm")] + public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + { + + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// uploads an image + /// </summary> + /// <param name="petId">ID of pet to update</param> + /// <param name="additionalMetadata">Additional data to pass to server</param> + /// <param name="file">file to upload</param> + /// <response code="200">successful operation</response> + [HttpPost] + [Route("/v2/pet/{petId}/uploadImage")] + [ValidateModelState] + [SwaggerOperation("UploadFile")] + [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] + public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(ApiResponse)); + string exampleJson = null; + exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<ApiResponse>(exampleJson) + : default(ApiResponse); + //TODO: Change the data returned + return new ObjectResult(example); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs new file mode 100644 index 000000000000..fa909a61a146 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -0,0 +1,139 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class StoreApiController : ControllerBase + { + /// <summary> + /// Delete purchase order by ID + /// </summary> + /// <remarks>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</remarks> + /// <param name="orderId">ID of the order that needs to be deleted</param> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Order not found</response> + [HttpDelete] + [Route("/v2/store/order/{orderId}")] + [ValidateModelState] + [SwaggerOperation("DeleteOrder")] + public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + + /// <summary> + /// Returns pet inventories by status + /// </summary> + /// <remarks>Returns a map of status codes to quantities</remarks> + /// <response code="200">successful operation</response> + [HttpGet] + [Route("/v2/store/inventory")] + [Authorize(Policy = "api_key")] + [ValidateModelState] + [SwaggerOperation("GetInventory")] + [SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int>), description: "successful operation")] + public virtual IActionResult GetInventory() + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Dictionary<string, int>)); + string exampleJson = null; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson) + : default(Dictionary<string, int>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Find purchase order by ID + /// </summary> + /// <remarks>For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions</remarks> + /// <param name="orderId">ID of pet that needs to be fetched</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Order not found</response> + [HttpGet] + [Route("/v2/store/order/{orderId}")] + [ValidateModelState] + [SwaggerOperation("GetOrderById")] + [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] + public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Order)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Order>(exampleJson) + : default(Order); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Place an order for a pet + /// </summary> + /// <param name="body">order placed for purchasing the pet</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid Order</response> + [HttpPost] + [Route("/v2/store/order")] + [ValidateModelState] + [SwaggerOperation("PlaceOrder")] + [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] + public virtual IActionResult PlaceOrder([FromBody]Order body) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Order)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Order>(exampleJson) + : default(Order); + //TODO: Change the data returned + return new ObjectResult(example); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs new file mode 100644 index 000000000000..c37f0251d3bc --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -0,0 +1,207 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class UserApiController : ControllerBase + { + /// <summary> + /// Create user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="body">Created user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user")] + [ValidateModelState] + [SwaggerOperation("CreateUser")] + public virtual IActionResult CreateUser([FromBody]User body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Creates list of users with given input array + /// </summary> + /// <param name="body">List of user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user/createWithArray")] + [ValidateModelState] + [SwaggerOperation("CreateUsersWithArrayInput")] + public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Creates list of users with given input array + /// </summary> + /// <param name="body">List of user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user/createWithList")] + [ValidateModelState] + [SwaggerOperation("CreateUsersWithListInput")] + public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Delete user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="username">The name that needs to be deleted</param> + /// <response code="400">Invalid username supplied</response> + /// <response code="404">User not found</response> + [HttpDelete] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("DeleteUser")] + public virtual IActionResult DeleteUser([FromRoute][Required]string username) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + + /// <summary> + /// Get user by user name + /// </summary> + /// <param name="username">The name that needs to be fetched. Use user1 for testing.</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid username supplied</response> + /// <response code="404">User not found</response> + [HttpGet] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("GetUserByName")] + [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] + public virtual IActionResult GetUserByName([FromRoute][Required]string username) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(User)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}"; + exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<User>(exampleJson) + : default(User); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Logs user into the system + /// </summary> + /// <param name="username">The user name for login</param> + /// <param name="password">The password for login in clear text</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid username/password supplied</response> + [HttpGet] + [Route("/v2/user/login")] + [ValidateModelState] + [SwaggerOperation("LoginUser")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] + public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(string)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<string>(exampleJson) + : default(string); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Logs out current logged in user session + /// </summary> + /// <response code="0">successful operation</response> + [HttpGet] + [Route("/v2/user/logout")] + [ValidateModelState] + [SwaggerOperation("LogoutUser")] + public virtual IActionResult LogoutUser() + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Updated user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="username">name that need to be deleted</param> + /// <param name="body">Updated user object</param> + /// <response code="400">Invalid user supplied</response> + /// <response code="404">User not found</response> + [HttpPut] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("UpdateUser")] + public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs new file mode 100644 index 000000000000..00b75a3cc7c7 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs @@ -0,0 +1,42 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Converters +{ + /// <summary> + /// Custom string to enum converter + /// </summary> + public class CustomEnumConverter<T> : TypeConverter + { + /// <summary> + /// Determine if we can convert a type to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="sourceType"></param> + /// <returns></returns> + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// <summary> + /// Convert from a type value to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="culture"></param> + /// <param name="value"></param> + /// <returns></returns> + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var s = value as string; + if (string.IsNullOrEmpty(s)) + { + return null; + } + + return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @""""); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Dockerfile b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Dockerfile new file mode 100644 index 000000000000..a054cdee5ac5 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Dockerfile @@ -0,0 +1,32 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# Container we use for final publish +FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +# Build container +FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build + +# Copy the code into the container +WORKDIR /src +COPY ["src/Org.OpenAPITools/Org.OpenAPITools.csproj", "Org.OpenAPITools/"] + +# NuGet restore +RUN dotnet restore "Org.OpenAPITools/Org.OpenAPITools.csproj" +COPY ["src/Org.OpenAPITools/", "Org.OpenAPITools/"] + +# Build the API +WORKDIR "Org.OpenAPITools" +RUN dotnet build "Org.OpenAPITools.csproj" -c Release -o /app/build + +# Publish it +FROM build AS publish +RUN dotnet publish "Org.OpenAPITools.csproj" -c Release -o /app/publish + +# Make the final image for publishing +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Org.OpenAPITools.dll"] diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/BasePathFilter.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/BasePathFilter.cs new file mode 100644 index 000000000000..09ab6006a7bd --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/BasePathFilter.cs @@ -0,0 +1,50 @@ +using System.Linq; +using System.Text.RegularExpressions; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Org.OpenAPITools.Filters +{ + /// <summary> + /// BasePath Document Filter sets BasePath property of Swagger and removes it from the individual URL paths + /// </summary> + public class BasePathFilter : IDocumentFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="basePath">BasePath to remove from Operations</param> + public BasePathFilter(string basePath) + { + BasePath = basePath; + } + + /// <summary> + /// Gets the BasePath of the Swagger Doc + /// </summary> + /// <returns>The BasePath of the Swagger Doc</returns> + public string BasePath { get; } + + /// <summary> + /// Apply the filter + /// </summary> + /// <param name="swaggerDoc">SwaggerDocument</param> + /// <param name="context">FilterContext</param> + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + //swaggerDoc.BasePath = BasePath; + + var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList(); + + foreach (var (key, value) in pathsToModify) + { + if (key.StartsWith(BasePath)) + { + var newKey = Regex.Replace(key, $"^{BasePath}", string.Empty); + swaggerDoc.Paths.Remove(key); + swaggerDoc.Paths.Add(newKey, value); + } + } + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs new file mode 100644 index 000000000000..823aa34de41f --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs @@ -0,0 +1,98 @@ +using System.ComponentModel.DataAnnotations; +using System.Linq; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Org.OpenAPITools.Filters +{ + /// <summary> + /// Path Parameter Validation Rules Filter + /// </summary> + public class GeneratePathParamsValidationFilter : IOperationFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="operation">Operation</param> + /// <param name="context">OperationFilterContext</param> + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + var pars = context.ApiDescription.ParameterDescriptions; + + foreach (var par in pars) + { + var swaggerParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); + + var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes.ToList(); + + // See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1147 + // and https://mikeralphson.github.io/openapi/2017/03/15/openapi3.0.0-rc0 + // Basically OpenAPI v3 body parameters are split out into RequestBody and the properties have moved to schema + if (attributes.Any() && swaggerParam != null) + { + // Required - [Required] + var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); + if (requiredAttr != null) + { + swaggerParam.Required = true; + } + + // Regex Pattern [RegularExpression] + var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); + if (regexAttr != null) + { + var regex = (string)regexAttr.ConstructorArguments[0].Value; + swaggerParam.Schema.Pattern = regex; + } + + // String Length [StringLength] + int? minLength = null, maxLength = null; + var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); + if (stringLengthAttr != null) + { + if (stringLengthAttr.NamedArguments.Count == 1) + { + minLength = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; + } + maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value; + } + + var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); + if (minLengthAttr != null) + { + minLength = (int)minLengthAttr.ConstructorArguments[0].Value; + } + + var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); + if (maxLengthAttr != null) + { + maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value; + } + + if (minLength != null) + { + swaggerParam.Schema.MinLength = minLength; + } + + if (maxLength != null) + { + swaggerParam.Schema.MaxLength = maxLength; + } + + // Range [Range] + var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); + if (rangeAttr != null) + { + var rangeMin = (int)rangeAttr.ConstructorArguments[0].Value; + var rangeMax = (int)rangeAttr.ConstructorArguments[1].Value; + + swaggerParam.Schema.MinLength = rangeMin; + swaggerParam.Schema.MaxLength = rangeMax; + } + } + } + } + } +} + diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..ef3413980eac --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,147 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// Describes the result of uploading an image resource + /// </summary> + [DataContract] + public partial class ApiResponse : IEquatable<ApiResponse> + { + /// <summary> + /// Gets or Sets Code + /// </summary> + [DataMember(Name="code", EmitDefaultValue=false)] + public int Code { get; set; } + + /// <summary> + /// Gets or Sets Type + /// </summary> + [DataMember(Name="type", EmitDefaultValue=false)] + public string Type { get; set; } + + /// <summary> + /// Gets or Sets Message + /// </summary> + [DataMember(Name="message", EmitDefaultValue=false)] + public string Message { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((ApiResponse)obj); + } + + /// <summary> + /// Returns true if ApiResponse instances are equal + /// </summary> + /// <param name="other">Instance of ApiResponse to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(ApiResponse other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Code == other.Code || + + Code.Equals(other.Code) + ) && + ( + Type == other.Type || + Type != null && + Type.Equals(other.Type) + ) && + ( + Message == other.Message || + Message != null && + Message.Equals(other.Message) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Code.GetHashCode(); + if (Type != null) + hashCode = hashCode * 59 + Type.GetHashCode(); + if (Message != null) + hashCode = hashCode * 59 + Message.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(ApiResponse left, ApiResponse right) + { + return Equals(left, right); + } + + public static bool operator !=(ApiResponse left, ApiResponse right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..6ac6a181baf6 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,133 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A category for a pet + /// </summary> + [DataContract] + public partial class Category : IEquatable<Category> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Category)obj); + } + + /// <summary> + /// Returns true if Category instances are equal + /// </summary> + /// <param name="other">Instance of Category to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Category other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Category left, Category right) + { + return Equals(left, right); + } + + public static bool operator !=(Category left, Category right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..77a4c75a1b17 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,219 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// An order for a pets from the pet store + /// </summary> + [DataContract] + public partial class Order : IEquatable<Order> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets PetId + /// </summary> + [DataMember(Name="petId", EmitDefaultValue=false)] + public long PetId { get; set; } + + /// <summary> + /// Gets or Sets Quantity + /// </summary> + [DataMember(Name="quantity", EmitDefaultValue=false)] + public int Quantity { get; set; } + + /// <summary> + /// Gets or Sets ShipDate + /// </summary> + [DataMember(Name="shipDate", EmitDefaultValue=false)] + public DateTime ShipDate { get; set; } + + + /// <summary> + /// Order Status + /// </summary> + /// <value>Order Status</value> + [TypeConverter(typeof(CustomEnumConverter<StatusEnum>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StatusEnum + { + + /// <summary> + /// Enum PlacedEnum for placed + /// </summary> + [EnumMember(Value = "placed")] + PlacedEnum = 1, + + /// <summary> + /// Enum ApprovedEnum for approved + /// </summary> + [EnumMember(Value = "approved")] + ApprovedEnum = 2, + + /// <summary> + /// Enum DeliveredEnum for delivered + /// </summary> + [EnumMember(Value = "delivered")] + DeliveredEnum = 3 + } + + /// <summary> + /// Order Status + /// </summary> + /// <value>Order Status</value> + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum Status { get; set; } + + /// <summary> + /// Gets or Sets Complete + /// </summary> + [DataMember(Name="complete", EmitDefaultValue=false)] + public bool Complete { get; set; } = false; + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Order)obj); + } + + /// <summary> + /// Returns true if Order instances are equal + /// </summary> + /// <param name="other">Instance of Order to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Order other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + PetId == other.PetId || + + PetId.Equals(other.PetId) + ) && + ( + Quantity == other.Quantity || + + Quantity.Equals(other.Quantity) + ) && + ( + ShipDate == other.ShipDate || + ShipDate != null && + ShipDate.Equals(other.ShipDate) + ) && + ( + Status == other.Status || + + Status.Equals(other.Status) + ) && + ( + Complete == other.Complete || + + Complete.Equals(other.Complete) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + + hashCode = hashCode * 59 + PetId.GetHashCode(); + + hashCode = hashCode * 59 + Quantity.GetHashCode(); + if (ShipDate != null) + hashCode = hashCode * 59 + ShipDate.GetHashCode(); + + hashCode = hashCode * 59 + Status.GetHashCode(); + + hashCode = hashCode * 59 + Complete.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Order left, Order right) + { + return Equals(left, right); + } + + public static bool operator !=(Order left, Order right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..a814c6e1edfe --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,223 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A pet for sale in the pet store + /// </summary> + [DataContract] + public partial class Pet : IEquatable<Pet> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Category + /// </summary> + [DataMember(Name="category", EmitDefaultValue=false)] + public Category Category { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [Required] + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Gets or Sets PhotoUrls + /// </summary> + [Required] + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + public List<string> PhotoUrls { get; set; } + + /// <summary> + /// Gets or Sets Tags + /// </summary> + [DataMember(Name="tags", EmitDefaultValue=false)] + public List<Tag> Tags { get; set; } + + + /// <summary> + /// pet status in the store + /// </summary> + /// <value>pet status in the store</value> + [TypeConverter(typeof(CustomEnumConverter<StatusEnum>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StatusEnum + { + + /// <summary> + /// Enum AvailableEnum for available + /// </summary> + [EnumMember(Value = "available")] + AvailableEnum = 1, + + /// <summary> + /// Enum PendingEnum for pending + /// </summary> + [EnumMember(Value = "pending")] + PendingEnum = 2, + + /// <summary> + /// Enum SoldEnum for sold + /// </summary> + [EnumMember(Value = "sold")] + SoldEnum = 3 + } + + /// <summary> + /// pet status in the store + /// </summary> + /// <value>pet status in the store</value> + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum Status { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Pet)obj); + } + + /// <summary> + /// Returns true if Pet instances are equal + /// </summary> + /// <param name="other">Instance of Pet to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Pet other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Category == other.Category || + Category != null && + Category.Equals(other.Category) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ) && + ( + PhotoUrls == other.PhotoUrls || + PhotoUrls != null && + other.PhotoUrls != null && + PhotoUrls.SequenceEqual(other.PhotoUrls) + ) && + ( + Tags == other.Tags || + Tags != null && + other.Tags != null && + Tags.SequenceEqual(other.Tags) + ) && + ( + Status == other.Status || + + Status.Equals(other.Status) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Category != null) + hashCode = hashCode * 59 + Category.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + if (PhotoUrls != null) + hashCode = hashCode * 59 + PhotoUrls.GetHashCode(); + if (Tags != null) + hashCode = hashCode * 59 + Tags.GetHashCode(); + + hashCode = hashCode * 59 + Status.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Pet left, Pet right) + { + return Equals(left, right); + } + + public static bool operator !=(Pet left, Pet right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..f0a131f617ca --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,133 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A tag for a pet + /// </summary> + [DataContract] + public partial class Tag : IEquatable<Tag> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Tag)obj); + } + + /// <summary> + /// Returns true if Tag instances are equal + /// </summary> + /// <param name="other">Instance of Tag to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Tag other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Tag left, Tag right) + { + return Equals(left, right); + } + + public static bool operator !=(Tag left, Tag right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..3c8a18d63cf7 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Models/User.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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A User who is purchasing from the pet store + /// </summary> + [DataContract] + public partial class User : IEquatable<User> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Username + /// </summary> + [DataMember(Name="username", EmitDefaultValue=false)] + public string Username { get; set; } + + /// <summary> + /// Gets or Sets FirstName + /// </summary> + [DataMember(Name="firstName", EmitDefaultValue=false)] + public string FirstName { get; set; } + + /// <summary> + /// Gets or Sets LastName + /// </summary> + [DataMember(Name="lastName", EmitDefaultValue=false)] + public string LastName { get; set; } + + /// <summary> + /// Gets or Sets Email + /// </summary> + [DataMember(Name="email", EmitDefaultValue=false)] + public string Email { get; set; } + + /// <summary> + /// Gets or Sets Password + /// </summary> + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// <summary> + /// Gets or Sets Phone + /// </summary> + [DataMember(Name="phone", EmitDefaultValue=false)] + public string Phone { get; set; } + + /// <summary> + /// User Status + /// </summary> + /// <value>User Status</value> + [DataMember(Name="userStatus", EmitDefaultValue=false)] + public int UserStatus { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((User)obj); + } + + /// <summary> + /// Returns true if User instances are equal + /// </summary> + /// <param name="other">Instance of User to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(User other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Username == other.Username || + Username != null && + Username.Equals(other.Username) + ) && + ( + FirstName == other.FirstName || + FirstName != null && + FirstName.Equals(other.FirstName) + ) && + ( + LastName == other.LastName || + LastName != null && + LastName.Equals(other.LastName) + ) && + ( + Email == other.Email || + Email != null && + Email.Equals(other.Email) + ) && + ( + Password == other.Password || + Password != null && + Password.Equals(other.Password) + ) && + ( + Phone == other.Phone || + Phone != null && + Phone.Equals(other.Phone) + ) && + ( + UserStatus == other.UserStatus || + + UserStatus.Equals(other.UserStatus) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Username != null) + hashCode = hashCode * 59 + Username.GetHashCode(); + if (FirstName != null) + hashCode = hashCode * 59 + FirstName.GetHashCode(); + if (LastName != null) + hashCode = hashCode * 59 + LastName.GetHashCode(); + if (Email != null) + hashCode = hashCode * 59 + Email.GetHashCode(); + if (Password != null) + hashCode = hashCode * 59 + Password.GetHashCode(); + if (Phone != null) + hashCode = hashCode * 59 + Phone.GetHashCode(); + + hashCode = hashCode * 59 + UserStatus.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(User left, User right) + { + return Equals(left, right); + } + + public static bool operator !=(User left, User right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs new file mode 100644 index 000000000000..b862226f2c1b --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs @@ -0,0 +1,51 @@ +using System; +using System.Linq; +using System.Text; + +namespace Org.OpenAPITools.OpenApi +{ + /// <summary> + /// Replacement utilities from Swashbuckle.AspNetCore.SwaggerGen which are not in 5.x + /// </summary> + public static class TypeExtensions + { + /// <summary> + /// Produce a friendly name for the type which is unique. + /// </summary> + /// <param name="type"></param> + /// <param name="fullyQualified"></param> + public static string FriendlyId(this Type type, bool fullyQualified = false) + { + var typeName = fullyQualified + ? type.FullNameSansTypeParameters().Replace("+", ".") + : type.Name; + + if (type.IsGenericType) + { + var genericArgumentIds = type.GetGenericArguments() + .Select(t => t.FriendlyId(fullyQualified)) + .ToArray(); + + return new StringBuilder(typeName) + .Replace($"`{genericArgumentIds.Count()}", string.Empty) + .Append($"[{string.Join(",", genericArgumentIds).TrimEnd(',')}]") + .ToString(); + } + + return typeName; + } + + /// <summary> + /// Determine the fully qualified type name without type parameters. + /// </summary> + /// <param name="type"></param> + public static string FullNameSansTypeParameters(this Type type) + { + var fullName = type.FullName; + if (string.IsNullOrEmpty(fullName)) + fullName = type.Name; + var chopIndex = fullName.IndexOf("[[", StringComparison.Ordinal); + return (chopIndex == -1) ? fullName : fullName.Substring(0, chopIndex); + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..50af1ce51104 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,24 @@ +<Project Sdk="Microsoft.NET.Sdk.Web"> + <PropertyGroup> + <Description>Org.OpenAPITools</Description> + <Copyright>Org.OpenAPITools</Copyright> + <TargetFramework>netcoreapp3.0</TargetFramework> + <GenerateDocumentationFile>true</GenerateDocumentationFile> + <PreserveCompilationContext>true</PreserveCompilationContext> + <AssemblyName>Org.OpenAPITools</AssemblyName> + <PackageId>Org.OpenAPITools</PackageId> + <UserSecretsId>6f694806-4622-45c8-9b52-bbc7029b4a96</UserSecretsId> + <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> + <DockerfileContext>..\..</DockerfileContext> + </PropertyGroup> + <ItemGroup> + <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0"/> + <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" /> + <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.0.0"/> + <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0"/> + <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.0.0" /> + </ItemGroup> + <ItemGroup> + <!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />--> + </ItemGroup> +</Project> diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..28b87acf7538 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace Org.OpenAPITools +{ + /// <summary> + /// Program + /// </summary> + public class Program + { + /// <summary> + /// Main + /// </summary> + /// <param name="args"></param> + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + /// <summary> + /// Create the host builder. + /// </summary> + /// <param name="args"></param> + /// <returns>IHostBuilder</returns> + public static IHostBuilder CreateWebHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup<Startup>() + .UseUrls("http://0.0.0.0:8080/"); + }); + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..57b03cc43aa3 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61788", + "sslPort": 44301 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OpenAPI": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Startup.cs new file mode 100644 index 000000000000..3035ce51ea9e --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/Startup.cs @@ -0,0 +1,150 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.OpenApi.Models; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Serialization; +using Org.OpenAPITools.Authentication; +using Org.OpenAPITools.Filters; +using Org.OpenAPITools.OpenApi; + +namespace Org.OpenAPITools +{ + /// <summary> + /// Startup + /// </summary> + public class Startup + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="env"></param> + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + /// <summary> + /// The application configuration. + /// </summary> + public IConfiguration Configuration { get; } + + /// <summary> + /// This method gets called by the runtime. Use this method to add services to the container. + /// </summary> + /// <param name="services"></param> + public void ConfigureServices(IServiceCollection services) + { + services.AddTransient<IAuthorizationHandler, ApiKeyRequirementHandler>(); + services.AddAuthorization(authConfig => + { + authConfig.AddPolicy("api_key", policyBuilder => + { + policyBuilder + .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"api_key")); + }); + }); + + // Add framework services. + services + // Don't need the full MVC stack for an API, see https://andrewlock.net/comparing-startup-between-the-asp-net-core-3-templates/ + .AddControllers() + .AddNewtonsoftJson(opts => + { + opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + opts.SerializerSettings.Converters.Add(new StringEnumConverter + { + NamingStrategy = new CamelCaseNamingStrategy() + }); + }); + + services + .AddSwaggerGen(c => + { + c.SwaggerDoc("1.0.0", new OpenApiInfo + { + Title = "OpenAPI Petstore", + Description = "OpenAPI Petstore (ASP.NET Core 3.0)", + TermsOfService = new Uri("https://github.com/openapitools/openapi-generator"), + Contact = new OpenApiContact + { + Name = "OpenAPI-Generator Contributors", + Url = new Uri("https://github.com/openapitools/openapi-generator"), + Email = "" + }, + License = new OpenApiLicense + { + Name = "NoLicense", + Url = new Uri("https://www.apache.org/licenses/LICENSE-2.0.html") + }, + Version = "1.0.0", + }); + c.CustomSchemaIds(type => type.FriendlyId(true)); + c.DescribeAllEnumsAsStrings(); + c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml"); + // Sets the basePath property in the Swagger document generated + c.DocumentFilter<BasePathFilter>("/v2"); + + // Include DataAnnotation attributes on Controller Action parameters as Swagger validation rules (e.g required, pattern, ..) + // Use [ValidateModelState] on Actions to actually validate it in C# as well! + c.OperationFilter<GeneratePathParamsValidationFilter>(); + }); + services + .AddSwaggerGenNewtonsoftSupport(); + } + + /// <summary> + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// </summary> + /// <param name="app"></param> + /// <param name="env"></param> + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseDefaultFiles(); + app.UseStaticFiles(); + app.UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) + .UseSwaggerUI(c => + { + //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) + c.SwaggerEndpoint("/swagger/1.0.0/openapi.json", "OpenAPI Petstore"); + + //TODO: Or alternatively use the original Swagger contract that's included in the static files + // c.SwaggerEndpoint("/openapi-original.json", "OpenAPI Petstore Original"); + }); + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..def9159a7d94 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/README.md b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/README.md new file mode 100644 index 000000000000..6a0b78471a33 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/README.md @@ -0,0 +1,42 @@ +# Welcome to ASP.NET 5 Preview + +We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. + +ASP.NET 5 has been rearchitected to make it **lean** and **composable**. It's fully **open source** and available on [GitHub](http://go.microsoft.com/fwlink/?LinkID=517854). +Your new project automatically takes advantage of modern client-side utilities like [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) and [npm](http://go.microsoft.com/fwlink/?LinkId=518005) (to add client-side libraries) and [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) (for client-side build and automation tasks). + +We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015. +The ASP.NET Team + +### You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016) + +### This application consists of: +* Sample pages using ASP.NET MVC 6 +* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side resources +* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939) + +#### NEW CONCEPTS +* [The 'wwwroot' explained](http://go.microsoft.com/fwlink/?LinkId=518008) +* [Configuration in ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518012) +* [Dependency Injection](http://go.microsoft.com/fwlink/?LinkId=518013) +* [Razor TagHelpers](http://go.microsoft.com/fwlink/?LinkId=518014) +* [Manage client packages using Gulp](http://go.microsoft.com/fwlink/?LinkID=517849) +* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=517850) + +#### CUSTOMIZE APP +* [Add Controllers and Views](http://go.microsoft.com/fwlink/?LinkID=398600) +* [Add Data using EntityFramework](http://go.microsoft.com/fwlink/?LinkID=398602) +* [Add Authentication using Identity](http://go.microsoft.com/fwlink/?LinkID=398603) +* [Add real time support using SignalR](http://go.microsoft.com/fwlink/?LinkID=398606) +* [Add Class library](http://go.microsoft.com/fwlink/?LinkID=398604) +* [Add Web APIs with MVC 6](http://go.microsoft.com/fwlink/?LinkId=518009) +* [Add client packages using Bower](http://go.microsoft.com/fwlink/?LinkID=517848) + +#### DEPLOY +* [Run your app locally](http://go.microsoft.com/fwlink/?LinkID=517851) +* [Run your app on ASP.NET Core 5](http://go.microsoft.com/fwlink/?LinkID=517852) +* [Run commands in your 'project.json'](http://go.microsoft.com/fwlink/?LinkID=517853) +* [Publish to Microsoft Azure Web Sites](http://go.microsoft.com/fwlink/?LinkID=398609) +* [Publish to the file system](http://go.microsoft.com/fwlink/?LinkId=518019) + +We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015) diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/index.html b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/index.html new file mode 100644 index 000000000000..cde1f2f90b92 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/index.html @@ -0,0 +1 @@ +<meta http-equiv="refresh" content="0;URL='./swagger/'" /> \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/openapi-original.json b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/openapi-original.json new file mode 100644 index 000000000000..c72a9d39daa2 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.0/src/Org.OpenAPITools/wwwroot/openapi-original.json @@ -0,0 +1,1012 @@ +{ + "openapi" : "3.0.1", + "info" : { + "description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.", + "license" : { + "name" : "Apache-2.0", + "url" : "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + "title" : "OpenAPI Petstore", + "version" : "1.0.0" + }, + "servers" : [ { + "url" : "http://petstore.swagger.io/v2" + } ], + "tags" : [ { + "description" : "Everything about your Pets", + "name" : "pet" + }, { + "description" : "Access to Petstore orders", + "name" : "store" + }, { + "description" : "Operations about user", + "name" : "user" + } ], + "paths" : { + "/pet" : { + "post" : { + "operationId" : "addPet", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "Pet object that needs to be added to the store", + "required" : true + }, + "responses" : { + "405" : { + "content" : { }, + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Add a new pet to the store", + "tags" : [ "pet" ], + "x-codegen-request-body-name" : "body" + }, + "put" : { + "operationId" : "updatePet", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "Pet object that needs to be added to the store", + "required" : true + }, + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Pet not found" + }, + "405" : { + "content" : { }, + "description" : "Validation exception" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Update an existing pet", + "tags" : [ "pet" ], + "x-codegen-request-body-name" : "body" + } + }, + "/pet/findByStatus" : { + "get" : { + "description" : "Multiple status values can be provided with comma separated strings", + "operationId" : "findPetsByStatus", + "parameters" : [ { + "description" : "Status values that need to be considered for filter", + "explode" : false, + "in" : "query", + "name" : "status", + "required" : true, + "schema" : { + "items" : { + "default" : "available", + "enum" : [ "available", "pending", "sold" ], + "type" : "string" + }, + "type" : "array" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + }, + "application/json" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid status value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Finds Pets by status", + "tags" : [ "pet" ] + } + }, + "/pet/findByTags" : { + "get" : { + "deprecated" : true, + "description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId" : "findPetsByTags", + "parameters" : [ { + "description" : "Tags to filter by", + "explode" : false, + "in" : "query", + "name" : "tags", + "required" : true, + "schema" : { + "items" : { + "type" : "string" + }, + "type" : "array" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + }, + "application/json" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid tag value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Finds Pets by tags", + "tags" : [ "pet" ] + } + }, + "/pet/{petId}" : { + "delete" : { + "operationId" : "deletePet", + "parameters" : [ { + "in" : "header", + "name" : "api_key", + "schema" : { + "type" : "string" + } + }, { + "description" : "Pet id to delete", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid pet value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Deletes a pet", + "tags" : [ "pet" ] + }, + "get" : { + "description" : "Returns a single pet", + "operationId" : "getPetById", + "parameters" : [ { + "description" : "ID of pet to return", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Pet not found" + } + }, + "security" : [ { + "api_key" : [ ] + } ], + "summary" : "Find pet by ID", + "tags" : [ "pet" ] + }, + "post" : { + "operationId" : "updatePetWithForm", + "parameters" : [ { + "description" : "ID of pet that needs to be updated", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "requestBody" : { + "content" : { + "application/x-www-form-urlencoded" : { + "schema" : { + "properties" : { + "name" : { + "description" : "Updated name of the pet", + "type" : "string" + }, + "status" : { + "description" : "Updated status of the pet", + "type" : "string" + } + } + } + } + } + }, + "responses" : { + "405" : { + "content" : { }, + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Updates a pet in the store with form data", + "tags" : [ "pet" ] + } + }, + "/pet/{petId}/uploadImage" : { + "post" : { + "operationId" : "uploadFile", + "parameters" : [ { + "description" : "ID of pet to update", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "properties" : { + "additionalMetadata" : { + "description" : "Additional data to pass to server", + "type" : "string" + }, + "file" : { + "description" : "file to upload", + "format" : "binary", + "type" : "string" + } + } + } + } + } + }, + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ApiResponse" + } + } + }, + "description" : "successful operation" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "uploads an image", + "tags" : [ "pet" ] + } + }, + "/store/inventory" : { + "get" : { + "description" : "Returns a map of status codes to quantities", + "operationId" : "getInventory", + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "additionalProperties" : { + "format" : "int32", + "type" : "integer" + }, + "type" : "object" + } + } + }, + "description" : "successful operation" + } + }, + "security" : [ { + "api_key" : [ ] + } ], + "summary" : "Returns pet inventories by status", + "tags" : [ "store" ] + } + }, + "/store/order" : { + "post" : { + "operationId" : "placeOrder", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "order placed for purchasing the pet", + "required" : true + }, + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid Order" + } + }, + "summary" : "Place an order for a pet", + "tags" : [ "store" ], + "x-codegen-request-body-name" : "body" + } + }, + "/store/order/{orderId}" : { + "delete" : { + "description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId" : "deleteOrder", + "parameters" : [ { + "description" : "ID of the order that needs to be deleted", + "in" : "path", + "name" : "orderId", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Order not found" + } + }, + "summary" : "Delete purchase order by ID", + "tags" : [ "store" ] + }, + "get" : { + "description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId" : "getOrderById", + "parameters" : [ { + "description" : "ID of pet that needs to be fetched", + "in" : "path", + "name" : "orderId", + "required" : true, + "schema" : { + "format" : "int64", + "maximum" : 5, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Order not found" + } + }, + "summary" : "Find purchase order by ID", + "tags" : [ "store" ] + } + }, + "/user" : { + "post" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "createUser", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "Created user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Create user", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/createWithArray" : { + "post" : { + "operationId" : "createUsersWithArrayInput", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/User" + }, + "type" : "array" + } + } + }, + "description" : "List of user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Creates list of users with given input array", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/createWithList" : { + "post" : { + "operationId" : "createUsersWithListInput", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/User" + }, + "type" : "array" + } + } + }, + "description" : "List of user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Creates list of users with given input array", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/login" : { + "get" : { + "operationId" : "loginUser", + "parameters" : [ { + "description" : "The user name for login", + "in" : "query", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "description" : "The password for login in clear text", + "in" : "query", + "name" : "password", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "type" : "string" + } + }, + "application/json" : { + "schema" : { + "type" : "string" + } + } + }, + "description" : "successful operation", + "headers" : { + "X-Rate-Limit" : { + "description" : "calls per hour allowed by the user", + "schema" : { + "format" : "int32", + "type" : "integer" + } + }, + "X-Expires-After" : { + "description" : "date in UTC when toekn expires", + "schema" : { + "format" : "date-time", + "type" : "string" + } + } + } + }, + "400" : { + "content" : { }, + "description" : "Invalid username/password supplied" + } + }, + "summary" : "Logs user into the system", + "tags" : [ "user" ] + } + }, + "/user/logout" : { + "get" : { + "operationId" : "logoutUser", + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Logs out current logged in user session", + "tags" : [ "user" ] + } + }, + "/user/{username}" : { + "delete" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "deleteUser", + "parameters" : [ { + "description" : "The name that needs to be deleted", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid username supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Delete user", + "tags" : [ "user" ] + }, + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "description" : "The name that needs to be fetched. Use user1 for testing.", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid username supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Get user by user name", + "tags" : [ "user" ] + }, + "put" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "updateUser", + "parameters" : [ { + "description" : "name that need to be deleted", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "Updated user object", + "required" : true + }, + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid user supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Updated user", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + } + }, + "components" : { + "schemas" : { + "Order" : { + "description" : "An order for a pets from the pet store", + "example" : { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "petId" : { + "format" : "int64", + "type" : "integer" + }, + "quantity" : { + "format" : "int32", + "type" : "integer" + }, + "shipDate" : { + "format" : "date-time", + "type" : "string" + }, + "status" : { + "description" : "Order Status", + "enum" : [ "placed", "approved", "delivered" ], + "type" : "string" + }, + "complete" : { + "default" : false, + "type" : "boolean" + } + }, + "title" : "Pet Order", + "type" : "object", + "xml" : { + "name" : "Order" + } + }, + "Category" : { + "description" : "A category for a pet", + "example" : { + "name" : "name", + "id" : 6 + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "name" : { + "type" : "string" + } + }, + "title" : "Pet category", + "type" : "object", + "xml" : { + "name" : "Category" + } + }, + "User" : { + "description" : "A User who is purchasing from the pet store", + "example" : { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "username" : { + "type" : "string" + }, + "firstName" : { + "type" : "string" + }, + "lastName" : { + "type" : "string" + }, + "email" : { + "type" : "string" + }, + "password" : { + "type" : "string" + }, + "phone" : { + "type" : "string" + }, + "userStatus" : { + "description" : "User Status", + "format" : "int32", + "type" : "integer" + } + }, + "title" : "a User", + "type" : "object", + "xml" : { + "name" : "User" + } + }, + "Tag" : { + "description" : "A tag for a pet", + "example" : { + "name" : "name", + "id" : 1 + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "name" : { + "type" : "string" + } + }, + "title" : "Pet Tag", + "type" : "object", + "xml" : { + "name" : "Tag" + } + }, + "Pet" : { + "description" : "A pet for sale in the pet store", + "example" : { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "category" : { + "$ref" : "#/components/schemas/Category" + }, + "name" : { + "example" : "doggie", + "type" : "string" + }, + "photoUrls" : { + "items" : { + "type" : "string" + }, + "type" : "array", + "xml" : { + "name" : "photoUrl", + "wrapped" : true + } + }, + "tags" : { + "items" : { + "$ref" : "#/components/schemas/Tag" + }, + "type" : "array", + "xml" : { + "name" : "tag", + "wrapped" : true + } + }, + "status" : { + "description" : "pet status in the store", + "enum" : [ "available", "pending", "sold" ], + "type" : "string" + } + }, + "required" : [ "name", "photoUrls" ], + "title" : "a Pet", + "type" : "object", + "xml" : { + "name" : "Pet" + } + }, + "ApiResponse" : { + "description" : "Describes the result of uploading an image resource", + "example" : { + "code" : 0, + "type" : "type", + "message" : "message" + }, + "properties" : { + "code" : { + "format" : "int32", + "type" : "integer" + }, + "type" : { + "type" : "string" + }, + "message" : { + "type" : "string" + } + }, + "title" : "An uploaded response", + "type" : "object" + } + }, + "securitySchemes" : { + "petstore_auth" : { + "flows" : { + "implicit" : { + "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", + "scopes" : { + "write:pets" : "modify pets in your account", + "read:pets" : "read your pets" + } + } + }, + "type" : "oauth2" + }, + "api_key" : { + "in" : "header", + "name" : "api_key", + "type" : "apiKey" + } + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/.openapi-generator-ignore b/samples/server/petstore/aspnetcore-3.1/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/.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/server/petstore/aspnetcore-3.1/.openapi-generator/VERSION b/samples/server/petstore/aspnetcore-3.1/.openapi-generator/VERSION new file mode 100644 index 000000000000..b5d898602c2c --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.1/Org.OpenAPITools.sln b/samples/server/petstore/aspnetcore-3.1/Org.OpenAPITools.sln new file mode 100644 index 000000000000..c2bc38764202 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/Org.OpenAPITools.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2043 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3C799344-F285-4669-8FD5-7ED9B795D5C5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C799344-F285-4669-8FD5-7ED9B795D5C5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/server/petstore/aspnetcore-3.1/README.md b/samples/server/petstore/aspnetcore-3.1/README.md new file mode 100644 index 000000000000..82fdf63ad6f6 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/README.md @@ -0,0 +1,24 @@ +# Org.OpenAPITools - ASP.NET Core 3.1 Server + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Run + +Linux/OS X: + +``` +sh build.sh +``` + +Windows: + +``` +build.bat +``` +## Run in Docker + +``` +cd src/Org.OpenAPITools +docker build -t org.openapitools . +docker run -p 5000:8080 org.openapitools +``` diff --git a/samples/server/petstore/aspnetcore-3.1/build.bat b/samples/server/petstore/aspnetcore-3.1/build.bat new file mode 100644 index 000000000000..cd65518e4287 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/build.bat @@ -0,0 +1,9 @@ +:: Generated by: https://openapi-generator.tech +:: + +@echo off + +dotnet restore src\Org.OpenAPITools +dotnet build src\Org.OpenAPITools +echo Now, run the following to start the project: dotnet run -p src\Org.OpenAPITools\Org.OpenAPITools.csproj --launch-profile web. +echo. diff --git a/samples/server/petstore/aspnetcore-3.1/build.sh b/samples/server/petstore/aspnetcore-3.1/build.sh new file mode 100644 index 000000000000..afbeddb83782 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Generated by: https://openapi-generator.tech +# + +dotnet restore src/Org.OpenAPITools/ && \ + dotnet build src/Org.OpenAPITools/ && \ + echo "Now, run the following to start the project: dotnet run -p src/Org.OpenAPITools/Org.OpenAPITools.csproj --launch-profile web" diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/.gitignore b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/.gitignore new file mode 100644 index 000000000000..cd9b840e5498 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/.gitignore @@ -0,0 +1,208 @@ +PID + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# 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 +# TODO: 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 + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# 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/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ +orleans.codegen.cs + +# 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 + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs new file mode 100644 index 000000000000..f388cfdf9831 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Attributes/ValidateModelStateAttribute.cs @@ -0,0 +1,61 @@ +using System.ComponentModel.DataAnnotations; +using System.Reflection; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace Org.OpenAPITools.Attributes +{ + /// <summary> + /// Model state validation attribute + /// </summary> + public class ValidateModelStateAttribute : ActionFilterAttribute + { + /// <summary> + /// Called before the action method is invoked + /// </summary> + /// <param name="context"></param> + public override void OnActionExecuting(ActionExecutingContext context) + { + // Per https://blog.markvincze.com/how-to-validate-action-parameters-with-dataannotation-attributes/ + var descriptor = context.ActionDescriptor as ControllerActionDescriptor; + if (descriptor != null) + { + foreach (var parameter in descriptor.MethodInfo.GetParameters()) + { + object args = null; + if (context.ActionArguments.ContainsKey(parameter.Name)) + { + args = context.ActionArguments[parameter.Name]; + } + + ValidateAttributes(parameter, args, context.ModelState); + } + } + + if (!context.ModelState.IsValid) + { + context.Result = new BadRequestObjectResult(context.ModelState); + } + } + + private void ValidateAttributes(ParameterInfo parameter, object args, ModelStateDictionary modelState) + { + foreach (var attributeData in parameter.CustomAttributes) + { + var attributeInstance = parameter.GetCustomAttribute(attributeData.AttributeType); + + var validationAttribute = attributeInstance as ValidationAttribute; + if (validationAttribute != null) + { + var isValid = validationAttribute.IsValid(args); + if (!isValid) + { + modelState.AddModelError(parameter.Name, validationAttribute.FormatErrorMessage(parameter.Name)); + } + } + } + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs new file mode 100644 index 000000000000..92b2512e441d --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc.Filters; + +namespace Org.OpenAPITools.Authentication +{ + /// <summary> + /// A requirement that an ApiKey must be present. + /// </summary> + public class ApiKeyRequirement : IAuthorizationRequirement + { + /// <summary> + /// Get the list of api keys + /// </summary> + public IReadOnlyList<string> ApiKeys { get; } + + /// <summary> + /// Get the policy name, + /// </summary> + public string PolicyName { get; } + + /// <summary> + /// Create a new instance of the <see cref="ApiKeyRequirement"/> class. + /// </summary> + /// <param name="apiKeys"></param> + /// <param name="policyName"></param> + public ApiKeyRequirement(IEnumerable<string> apiKeys, string policyName) + { + ApiKeys = apiKeys?.ToList() ?? new List<string>(); + PolicyName = policyName; + } + } + + /// <summary> + /// Enforce that an api key is present. + /// </summary> + public class ApiKeyRequirementHandler : AuthorizationHandler<ApiKeyRequirement> + { + /// <copydoc cref="AuthorizationHandler{T}.HandleRequirementAsync" /> + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + SucceedRequirementIfApiKeyPresentAndValid(context, requirement); + return Task.CompletedTask; + } + + private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + + if (context.Resource is AuthorizationFilterContext authorizationFilterContext) + { + var apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault(); + if (requirement.PolicyName == "api_key" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) + { + context.Succeed(requirement); + } + } + + } + } +} + diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs new file mode 100644 index 000000000000..2102b82d8fe6 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -0,0 +1,232 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class PetApiController : ControllerBase + { + /// <summary> + /// Add a new pet to the store + /// </summary> + /// <param name="body">Pet object that needs to be added to the store</param> + /// <response code="405">Invalid input</response> + [HttpPost] + [Route("/v2/pet")] + [ValidateModelState] + [SwaggerOperation("AddPet")] + public virtual IActionResult AddPet([FromBody]Pet body) + { + + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// Deletes a pet + /// </summary> + /// <param name="petId">Pet id to delete</param> + /// <param name="apiKey"></param> + /// <response code="400">Invalid pet value</response> + [HttpDelete] + [Route("/v2/pet/{petId}")] + [ValidateModelState] + [SwaggerOperation("DeletePet")] + public virtual IActionResult DeletePet([FromRoute][Required]long petId, [FromHeader]string apiKey) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + + throw new NotImplementedException(); + } + + /// <summary> + /// Finds Pets by status + /// </summary> + /// <remarks>Multiple status values can be provided with comma separated strings</remarks> + /// <param name="status">Status values that need to be considered for filter</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid status value</response> + [HttpGet] + [Route("/v2/pet/findByStatus")] + [ValidateModelState] + [SwaggerOperation("FindPetsByStatus")] + [SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")] + public virtual IActionResult FindPetsByStatus([FromQuery][Required()]List<string> status) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(List<Pet>)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<List<Pet>>(exampleJson) + : default(List<Pet>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Finds Pets by tags + /// </summary> + /// <remarks>Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.</remarks> + /// <param name="tags">Tags to filter by</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid tag value</response> + [HttpGet] + [Route("/v2/pet/findByTags")] + [ValidateModelState] + [SwaggerOperation("FindPetsByTags")] + [SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")] + public virtual IActionResult FindPetsByTags([FromQuery][Required()]List<string> tags) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(List<Pet>)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<List<Pet>>(exampleJson) + : default(List<Pet>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Find pet by ID + /// </summary> + /// <remarks>Returns a single pet</remarks> + /// <param name="petId">ID of pet to return</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Pet not found</response> + [HttpGet] + [Route("/v2/pet/{petId}")] + [Authorize(Policy = "api_key")] + [ValidateModelState] + [SwaggerOperation("GetPetById")] + [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] + public virtual IActionResult GetPetById([FromRoute][Required]long petId) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Pet)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\n \"name\" : \"doggie\",\n \"id\" : 0,\n \"category\" : {\n \"name\" : \"name\",\n \"id\" : 6\n },\n \"tags\" : [ {\n \"name\" : \"name\",\n \"id\" : 1\n }, {\n \"name\" : \"name\",\n \"id\" : 1\n } ],\n \"status\" : \"available\"\n}"; + exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Pet>(exampleJson) + : default(Pet); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Update an existing pet + /// </summary> + /// <param name="body">Pet object that needs to be added to the store</param> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Pet not found</response> + /// <response code="405">Validation exception</response> + [HttpPut] + [Route("/v2/pet")] + [ValidateModelState] + [SwaggerOperation("UpdatePet")] + public virtual IActionResult UpdatePet([FromBody]Pet body) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// Updates a pet in the store with form data + /// </summary> + /// <param name="petId">ID of pet that needs to be updated</param> + /// <param name="name">Updated name of the pet</param> + /// <param name="status">Updated status of the pet</param> + /// <response code="405">Invalid input</response> + [HttpPost] + [Route("/v2/pet/{petId}")] + [ValidateModelState] + [SwaggerOperation("UpdatePetWithForm")] + public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long petId, [FromForm]string name, [FromForm]string status) + { + + //TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(405); + + throw new NotImplementedException(); + } + + /// <summary> + /// uploads an image + /// </summary> + /// <param name="petId">ID of pet to update</param> + /// <param name="additionalMetadata">Additional data to pass to server</param> + /// <param name="file">file to upload</param> + /// <response code="200">successful operation</response> + [HttpPost] + [Route("/v2/pet/{petId}/uploadImage")] + [ValidateModelState] + [SwaggerOperation("UploadFile")] + [SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")] + public virtual IActionResult UploadFile([FromRoute][Required]long petId, [FromForm]string additionalMetadata, [FromForm]System.IO.Stream file) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(ApiResponse)); + string exampleJson = null; + exampleJson = "{\n \"code\" : 0,\n \"type\" : \"type\",\n \"message\" : \"message\"\n}"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<ApiResponse>(exampleJson) + : default(ApiResponse); + //TODO: Change the data returned + return new ObjectResult(example); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs new file mode 100644 index 000000000000..fa909a61a146 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -0,0 +1,139 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class StoreApiController : ControllerBase + { + /// <summary> + /// Delete purchase order by ID + /// </summary> + /// <remarks>For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors</remarks> + /// <param name="orderId">ID of the order that needs to be deleted</param> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Order not found</response> + [HttpDelete] + [Route("/v2/store/order/{orderId}")] + [ValidateModelState] + [SwaggerOperation("DeleteOrder")] + public virtual IActionResult DeleteOrder([FromRoute][Required]string orderId) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + + /// <summary> + /// Returns pet inventories by status + /// </summary> + /// <remarks>Returns a map of status codes to quantities</remarks> + /// <response code="200">successful operation</response> + [HttpGet] + [Route("/v2/store/inventory")] + [Authorize(Policy = "api_key")] + [ValidateModelState] + [SwaggerOperation("GetInventory")] + [SwaggerResponse(statusCode: 200, type: typeof(Dictionary<string, int>), description: "successful operation")] + public virtual IActionResult GetInventory() + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Dictionary<string, int>)); + string exampleJson = null; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Dictionary<string, int>>(exampleJson) + : default(Dictionary<string, int>); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Find purchase order by ID + /// </summary> + /// <remarks>For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions</remarks> + /// <param name="orderId">ID of pet that needs to be fetched</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid ID supplied</response> + /// <response code="404">Order not found</response> + [HttpGet] + [Route("/v2/store/order/{orderId}")] + [ValidateModelState] + [SwaggerOperation("GetOrderById")] + [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] + public virtual IActionResult GetOrderById([FromRoute][Required][Range(1, 5)]long orderId) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Order)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Order>(exampleJson) + : default(Order); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Place an order for a pet + /// </summary> + /// <param name="body">order placed for purchasing the pet</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid Order</response> + [HttpPost] + [Route("/v2/store/order")] + [ValidateModelState] + [SwaggerOperation("PlaceOrder")] + [SwaggerResponse(statusCode: 200, type: typeof(Order), description: "successful operation")] + public virtual IActionResult PlaceOrder([FromBody]Order body) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(Order)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + exampleJson = "{\n \"petId\" : 6,\n \"quantity\" : 1,\n \"id\" : 0,\n \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\",\n \"complete\" : false,\n \"status\" : \"placed\"\n}"; + exampleJson = "<Order>\n <id>123456789</id>\n <petId>123456789</petId>\n <quantity>123</quantity>\n <shipDate>2000-01-23T04:56:07.000Z</shipDate>\n <status>aeiou</status>\n <complete>true</complete>\n</Order>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<Order>(exampleJson) + : default(Order); + //TODO: Change the data returned + return new ObjectResult(example); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs new file mode 100644 index 000000000000..c37f0251d3bc --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -0,0 +1,207 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; +using Microsoft.AspNetCore.Authorization; +using Swashbuckle.AspNetCore.SwaggerGen; +using Newtonsoft.Json; +using Org.OpenAPITools.Attributes; +using Org.OpenAPITools.Models; + +namespace Org.OpenAPITools.Controllers +{ + /// <summary> + /// + /// </summary> + [ApiController] + public class UserApiController : ControllerBase + { + /// <summary> + /// Create user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="body">Created user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user")] + [ValidateModelState] + [SwaggerOperation("CreateUser")] + public virtual IActionResult CreateUser([FromBody]User body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Creates list of users with given input array + /// </summary> + /// <param name="body">List of user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user/createWithArray")] + [ValidateModelState] + [SwaggerOperation("CreateUsersWithArrayInput")] + public virtual IActionResult CreateUsersWithArrayInput([FromBody]List<User> body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Creates list of users with given input array + /// </summary> + /// <param name="body">List of user object</param> + /// <response code="0">successful operation</response> + [HttpPost] + [Route("/v2/user/createWithList")] + [ValidateModelState] + [SwaggerOperation("CreateUsersWithListInput")] + public virtual IActionResult CreateUsersWithListInput([FromBody]List<User> body) + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Delete user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="username">The name that needs to be deleted</param> + /// <response code="400">Invalid username supplied</response> + /// <response code="404">User not found</response> + [HttpDelete] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("DeleteUser")] + public virtual IActionResult DeleteUser([FromRoute][Required]string username) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + + /// <summary> + /// Get user by user name + /// </summary> + /// <param name="username">The name that needs to be fetched. Use user1 for testing.</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid username supplied</response> + /// <response code="404">User not found</response> + [HttpGet] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("GetUserByName")] + [SwaggerResponse(statusCode: 200, type: typeof(User), description: "successful operation")] + public virtual IActionResult GetUserByName([FromRoute][Required]string username) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(User)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + string exampleJson = null; + exampleJson = "{\n \"firstName\" : \"firstName\",\n \"lastName\" : \"lastName\",\n \"password\" : \"password\",\n \"userStatus\" : 6,\n \"phone\" : \"phone\",\n \"id\" : 0,\n \"email\" : \"email\",\n \"username\" : \"username\"\n}"; + exampleJson = "<User>\n <id>123456789</id>\n <username>aeiou</username>\n <firstName>aeiou</firstName>\n <lastName>aeiou</lastName>\n <email>aeiou</email>\n <password>aeiou</password>\n <phone>aeiou</phone>\n <userStatus>123</userStatus>\n</User>"; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<User>(exampleJson) + : default(User); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Logs user into the system + /// </summary> + /// <param name="username">The user name for login</param> + /// <param name="password">The password for login in clear text</param> + /// <response code="200">successful operation</response> + /// <response code="400">Invalid username/password supplied</response> + [HttpGet] + [Route("/v2/user/login")] + [ValidateModelState] + [SwaggerOperation("LoginUser")] + [SwaggerResponse(statusCode: 200, type: typeof(string), description: "successful operation")] + public virtual IActionResult LoginUser([FromQuery][Required()]string username, [FromQuery][Required()]string password) + { + + //TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(200, default(string)); + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + string exampleJson = null; + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<string>(exampleJson) + : default(string); + //TODO: Change the data returned + return new ObjectResult(example); + } + + /// <summary> + /// Logs out current logged in user session + /// </summary> + /// <response code="0">successful operation</response> + [HttpGet] + [Route("/v2/user/logout")] + [ValidateModelState] + [SwaggerOperation("LogoutUser")] + public virtual IActionResult LogoutUser() + { + + //TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(0); + + throw new NotImplementedException(); + } + + /// <summary> + /// Updated user + /// </summary> + /// <remarks>This can only be done by the logged in user.</remarks> + /// <param name="username">name that need to be deleted</param> + /// <param name="body">Updated user object</param> + /// <response code="400">Invalid user supplied</response> + /// <response code="404">User not found</response> + [HttpPut] + [Route("/v2/user/{username}")] + [ValidateModelState] + [SwaggerOperation("UpdateUser")] + public virtual IActionResult UpdateUser([FromRoute][Required]string username, [FromBody]User body) + { + + //TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(400); + //TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode(404); + + throw new NotImplementedException(); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs new file mode 100644 index 000000000000..00b75a3cc7c7 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Converters/CustomEnumConverter.cs @@ -0,0 +1,42 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Converters +{ + /// <summary> + /// Custom string to enum converter + /// </summary> + public class CustomEnumConverter<T> : TypeConverter + { + /// <summary> + /// Determine if we can convert a type to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="sourceType"></param> + /// <returns></returns> + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); + } + + /// <summary> + /// Convert from a type value to an enum + /// </summary> + /// <param name="context"></param> + /// <param name="culture"></param> + /// <param name="value"></param> + /// <returns></returns> + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + var s = value as string; + if (string.IsNullOrEmpty(s)) + { + return null; + } + + return JsonConvert.DeserializeObject<T>(@"""" + value.ToString() + @""""); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Dockerfile b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Dockerfile new file mode 100644 index 000000000000..9fe18ee2ba3c --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Dockerfile @@ -0,0 +1,32 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# Container we use for final publish +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +# Build container +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build + +# Copy the code into the container +WORKDIR /src +COPY ["src/Org.OpenAPITools/Org.OpenAPITools.csproj", "Org.OpenAPITools/"] + +# NuGet restore +RUN dotnet restore "Org.OpenAPITools/Org.OpenAPITools.csproj" +COPY ["src/Org.OpenAPITools/", "Org.OpenAPITools/"] + +# Build the API +WORKDIR "Org.OpenAPITools" +RUN dotnet build "Org.OpenAPITools.csproj" -c Release -o /app/build + +# Publish it +FROM build AS publish +RUN dotnet publish "Org.OpenAPITools.csproj" -c Release -o /app/publish + +# Make the final image for publishing +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Org.OpenAPITools.dll"] diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/BasePathFilter.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/BasePathFilter.cs new file mode 100644 index 000000000000..09ab6006a7bd --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/BasePathFilter.cs @@ -0,0 +1,50 @@ +using System.Linq; +using System.Text.RegularExpressions; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Org.OpenAPITools.Filters +{ + /// <summary> + /// BasePath Document Filter sets BasePath property of Swagger and removes it from the individual URL paths + /// </summary> + public class BasePathFilter : IDocumentFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="basePath">BasePath to remove from Operations</param> + public BasePathFilter(string basePath) + { + BasePath = basePath; + } + + /// <summary> + /// Gets the BasePath of the Swagger Doc + /// </summary> + /// <returns>The BasePath of the Swagger Doc</returns> + public string BasePath { get; } + + /// <summary> + /// Apply the filter + /// </summary> + /// <param name="swaggerDoc">SwaggerDocument</param> + /// <param name="context">FilterContext</param> + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + //swaggerDoc.BasePath = BasePath; + + var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList(); + + foreach (var (key, value) in pathsToModify) + { + if (key.StartsWith(BasePath)) + { + var newKey = Regex.Replace(key, $"^{BasePath}", string.Empty); + swaggerDoc.Paths.Remove(key); + swaggerDoc.Paths.Add(newKey, value); + } + } + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs new file mode 100644 index 000000000000..823aa34de41f --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Filters/GeneratePathParamsValidationFilter.cs @@ -0,0 +1,98 @@ +using System.ComponentModel.DataAnnotations; +using System.Linq; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Org.OpenAPITools.Filters +{ + /// <summary> + /// Path Parameter Validation Rules Filter + /// </summary> + public class GeneratePathParamsValidationFilter : IOperationFilter + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="operation">Operation</param> + /// <param name="context">OperationFilterContext</param> + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + var pars = context.ApiDescription.ParameterDescriptions; + + foreach (var par in pars) + { + var swaggerParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); + + var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes.ToList(); + + // See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1147 + // and https://mikeralphson.github.io/openapi/2017/03/15/openapi3.0.0-rc0 + // Basically OpenAPI v3 body parameters are split out into RequestBody and the properties have moved to schema + if (attributes.Any() && swaggerParam != null) + { + // Required - [Required] + var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); + if (requiredAttr != null) + { + swaggerParam.Required = true; + } + + // Regex Pattern [RegularExpression] + var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); + if (regexAttr != null) + { + var regex = (string)regexAttr.ConstructorArguments[0].Value; + swaggerParam.Schema.Pattern = regex; + } + + // String Length [StringLength] + int? minLength = null, maxLength = null; + var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); + if (stringLengthAttr != null) + { + if (stringLengthAttr.NamedArguments.Count == 1) + { + minLength = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; + } + maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value; + } + + var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); + if (minLengthAttr != null) + { + minLength = (int)minLengthAttr.ConstructorArguments[0].Value; + } + + var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); + if (maxLengthAttr != null) + { + maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value; + } + + if (minLength != null) + { + swaggerParam.Schema.MinLength = minLength; + } + + if (maxLength != null) + { + swaggerParam.Schema.MaxLength = maxLength; + } + + // Range [Range] + var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); + if (rangeAttr != null) + { + var rangeMin = (int)rangeAttr.ConstructorArguments[0].Value; + var rangeMax = (int)rangeAttr.ConstructorArguments[1].Value; + + swaggerParam.Schema.MinLength = rangeMin; + swaggerParam.Schema.MaxLength = rangeMax; + } + } + } + } + } +} + diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/ApiResponse.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/ApiResponse.cs new file mode 100644 index 000000000000..ef3413980eac --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/ApiResponse.cs @@ -0,0 +1,147 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// Describes the result of uploading an image resource + /// </summary> + [DataContract] + public partial class ApiResponse : IEquatable<ApiResponse> + { + /// <summary> + /// Gets or Sets Code + /// </summary> + [DataMember(Name="code", EmitDefaultValue=false)] + public int Code { get; set; } + + /// <summary> + /// Gets or Sets Type + /// </summary> + [DataMember(Name="type", EmitDefaultValue=false)] + public string Type { get; set; } + + /// <summary> + /// Gets or Sets Message + /// </summary> + [DataMember(Name="message", EmitDefaultValue=false)] + public string Message { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((ApiResponse)obj); + } + + /// <summary> + /// Returns true if ApiResponse instances are equal + /// </summary> + /// <param name="other">Instance of ApiResponse to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(ApiResponse other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Code == other.Code || + + Code.Equals(other.Code) + ) && + ( + Type == other.Type || + Type != null && + Type.Equals(other.Type) + ) && + ( + Message == other.Message || + Message != null && + Message.Equals(other.Message) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Code.GetHashCode(); + if (Type != null) + hashCode = hashCode * 59 + Type.GetHashCode(); + if (Message != null) + hashCode = hashCode * 59 + Message.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(ApiResponse left, ApiResponse right) + { + return Equals(left, right); + } + + public static bool operator !=(ApiResponse left, ApiResponse right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Category.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Category.cs new file mode 100644 index 000000000000..6ac6a181baf6 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Category.cs @@ -0,0 +1,133 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A category for a pet + /// </summary> + [DataContract] + public partial class Category : IEquatable<Category> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Category)obj); + } + + /// <summary> + /// Returns true if Category instances are equal + /// </summary> + /// <param name="other">Instance of Category to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Category other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Category left, Category right) + { + return Equals(left, right); + } + + public static bool operator !=(Category left, Category right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Order.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Order.cs new file mode 100644 index 000000000000..77a4c75a1b17 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Order.cs @@ -0,0 +1,219 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// An order for a pets from the pet store + /// </summary> + [DataContract] + public partial class Order : IEquatable<Order> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets PetId + /// </summary> + [DataMember(Name="petId", EmitDefaultValue=false)] + public long PetId { get; set; } + + /// <summary> + /// Gets or Sets Quantity + /// </summary> + [DataMember(Name="quantity", EmitDefaultValue=false)] + public int Quantity { get; set; } + + /// <summary> + /// Gets or Sets ShipDate + /// </summary> + [DataMember(Name="shipDate", EmitDefaultValue=false)] + public DateTime ShipDate { get; set; } + + + /// <summary> + /// Order Status + /// </summary> + /// <value>Order Status</value> + [TypeConverter(typeof(CustomEnumConverter<StatusEnum>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StatusEnum + { + + /// <summary> + /// Enum PlacedEnum for placed + /// </summary> + [EnumMember(Value = "placed")] + PlacedEnum = 1, + + /// <summary> + /// Enum ApprovedEnum for approved + /// </summary> + [EnumMember(Value = "approved")] + ApprovedEnum = 2, + + /// <summary> + /// Enum DeliveredEnum for delivered + /// </summary> + [EnumMember(Value = "delivered")] + DeliveredEnum = 3 + } + + /// <summary> + /// Order Status + /// </summary> + /// <value>Order Status</value> + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum Status { get; set; } + + /// <summary> + /// Gets or Sets Complete + /// </summary> + [DataMember(Name="complete", EmitDefaultValue=false)] + public bool Complete { get; set; } = false; + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Order)obj); + } + + /// <summary> + /// Returns true if Order instances are equal + /// </summary> + /// <param name="other">Instance of Order to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Order other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + PetId == other.PetId || + + PetId.Equals(other.PetId) + ) && + ( + Quantity == other.Quantity || + + Quantity.Equals(other.Quantity) + ) && + ( + ShipDate == other.ShipDate || + ShipDate != null && + ShipDate.Equals(other.ShipDate) + ) && + ( + Status == other.Status || + + Status.Equals(other.Status) + ) && + ( + Complete == other.Complete || + + Complete.Equals(other.Complete) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + + hashCode = hashCode * 59 + PetId.GetHashCode(); + + hashCode = hashCode * 59 + Quantity.GetHashCode(); + if (ShipDate != null) + hashCode = hashCode * 59 + ShipDate.GetHashCode(); + + hashCode = hashCode * 59 + Status.GetHashCode(); + + hashCode = hashCode * 59 + Complete.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Order left, Order right) + { + return Equals(left, right); + } + + public static bool operator !=(Order left, Order right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Pet.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Pet.cs new file mode 100644 index 000000000000..a814c6e1edfe --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Pet.cs @@ -0,0 +1,223 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A pet for sale in the pet store + /// </summary> + [DataContract] + public partial class Pet : IEquatable<Pet> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Category + /// </summary> + [DataMember(Name="category", EmitDefaultValue=false)] + public Category Category { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [Required] + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Gets or Sets PhotoUrls + /// </summary> + [Required] + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + public List<string> PhotoUrls { get; set; } + + /// <summary> + /// Gets or Sets Tags + /// </summary> + [DataMember(Name="tags", EmitDefaultValue=false)] + public List<Tag> Tags { get; set; } + + + /// <summary> + /// pet status in the store + /// </summary> + /// <value>pet status in the store</value> + [TypeConverter(typeof(CustomEnumConverter<StatusEnum>))] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum StatusEnum + { + + /// <summary> + /// Enum AvailableEnum for available + /// </summary> + [EnumMember(Value = "available")] + AvailableEnum = 1, + + /// <summary> + /// Enum PendingEnum for pending + /// </summary> + [EnumMember(Value = "pending")] + PendingEnum = 2, + + /// <summary> + /// Enum SoldEnum for sold + /// </summary> + [EnumMember(Value = "sold")] + SoldEnum = 3 + } + + /// <summary> + /// pet status in the store + /// </summary> + /// <value>pet status in the store</value> + [DataMember(Name="status", EmitDefaultValue=false)] + public StatusEnum Status { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Pet)obj); + } + + /// <summary> + /// Returns true if Pet instances are equal + /// </summary> + /// <param name="other">Instance of Pet to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Pet other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Category == other.Category || + Category != null && + Category.Equals(other.Category) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ) && + ( + PhotoUrls == other.PhotoUrls || + PhotoUrls != null && + other.PhotoUrls != null && + PhotoUrls.SequenceEqual(other.PhotoUrls) + ) && + ( + Tags == other.Tags || + Tags != null && + other.Tags != null && + Tags.SequenceEqual(other.Tags) + ) && + ( + Status == other.Status || + + Status.Equals(other.Status) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Category != null) + hashCode = hashCode * 59 + Category.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + if (PhotoUrls != null) + hashCode = hashCode * 59 + PhotoUrls.GetHashCode(); + if (Tags != null) + hashCode = hashCode * 59 + Tags.GetHashCode(); + + hashCode = hashCode * 59 + Status.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Pet left, Pet right) + { + return Equals(left, right); + } + + public static bool operator !=(Pet left, Pet right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Tag.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Tag.cs new file mode 100644 index 000000000000..f0a131f617ca --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/Tag.cs @@ -0,0 +1,133 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A tag for a pet + /// </summary> + [DataContract] + public partial class Tag : IEquatable<Tag> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Name + /// </summary> + [DataMember(Name="name", EmitDefaultValue=false)] + public string Name { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((Tag)obj); + } + + /// <summary> + /// Returns true if Tag instances are equal + /// </summary> + /// <param name="other">Instance of Tag to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(Tag other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Name == other.Name || + Name != null && + Name.Equals(other.Name) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Name != null) + hashCode = hashCode * 59 + Name.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(Tag left, Tag right) + { + return Equals(left, right); + } + + public static bool operator !=(Tag left, Tag right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/User.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/User.cs new file mode 100644 index 000000000000..3c8a18d63cf7 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Models/User.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://openapi-generator.tech + */ + +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Org.OpenAPITools.Converters; + +namespace Org.OpenAPITools.Models +{ + /// <summary> + /// A User who is purchasing from the pet store + /// </summary> + [DataContract] + public partial class User : IEquatable<User> + { + /// <summary> + /// Gets or Sets Id + /// </summary> + [DataMember(Name="id", EmitDefaultValue=false)] + public long Id { get; set; } + + /// <summary> + /// Gets or Sets Username + /// </summary> + [DataMember(Name="username", EmitDefaultValue=false)] + public string Username { get; set; } + + /// <summary> + /// Gets or Sets FirstName + /// </summary> + [DataMember(Name="firstName", EmitDefaultValue=false)] + public string FirstName { get; set; } + + /// <summary> + /// Gets or Sets LastName + /// </summary> + [DataMember(Name="lastName", EmitDefaultValue=false)] + public string LastName { get; set; } + + /// <summary> + /// Gets or Sets Email + /// </summary> + [DataMember(Name="email", EmitDefaultValue=false)] + public string Email { get; set; } + + /// <summary> + /// Gets or Sets Password + /// </summary> + [DataMember(Name="password", EmitDefaultValue=false)] + public string Password { get; set; } + + /// <summary> + /// Gets or Sets Phone + /// </summary> + [DataMember(Name="phone", EmitDefaultValue=false)] + public string Phone { get; set; } + + /// <summary> + /// User Status + /// </summary> + /// <value>User Status</value> + [DataMember(Name="userStatus", EmitDefaultValue=false)] + public int UserStatus { get; set; } + + /// <summary> + /// Returns the string presentation of the object + /// </summary> + /// <returns>String presentation of the object</returns> + 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("}\n"); + return sb.ToString(); + } + + /// <summary> + /// Returns the JSON string presentation of the object + /// </summary> + /// <returns>JSON string presentation of the object</returns> + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// <summary> + /// Returns true if objects are equal + /// </summary> + /// <param name="obj">Object to be compared</param> + /// <returns>Boolean</returns> + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((User)obj); + } + + /// <summary> + /// Returns true if User instances are equal + /// </summary> + /// <param name="other">Instance of User to be compared</param> + /// <returns>Boolean</returns> + public bool Equals(User other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return + ( + Id == other.Id || + + Id.Equals(other.Id) + ) && + ( + Username == other.Username || + Username != null && + Username.Equals(other.Username) + ) && + ( + FirstName == other.FirstName || + FirstName != null && + FirstName.Equals(other.FirstName) + ) && + ( + LastName == other.LastName || + LastName != null && + LastName.Equals(other.LastName) + ) && + ( + Email == other.Email || + Email != null && + Email.Equals(other.Email) + ) && + ( + Password == other.Password || + Password != null && + Password.Equals(other.Password) + ) && + ( + Phone == other.Phone || + Phone != null && + Phone.Equals(other.Phone) + ) && + ( + UserStatus == other.UserStatus || + + UserStatus.Equals(other.UserStatus) + ); + } + + /// <summary> + /// Gets the hash code + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + + hashCode = hashCode * 59 + Id.GetHashCode(); + if (Username != null) + hashCode = hashCode * 59 + Username.GetHashCode(); + if (FirstName != null) + hashCode = hashCode * 59 + FirstName.GetHashCode(); + if (LastName != null) + hashCode = hashCode * 59 + LastName.GetHashCode(); + if (Email != null) + hashCode = hashCode * 59 + Email.GetHashCode(); + if (Password != null) + hashCode = hashCode * 59 + Password.GetHashCode(); + if (Phone != null) + hashCode = hashCode * 59 + Phone.GetHashCode(); + + hashCode = hashCode * 59 + UserStatus.GetHashCode(); + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==(User left, User right) + { + return Equals(left, right); + } + + public static bool operator !=(User left, User right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs new file mode 100644 index 000000000000..b862226f2c1b --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/OpenApi/TypeExtensions.cs @@ -0,0 +1,51 @@ +using System; +using System.Linq; +using System.Text; + +namespace Org.OpenAPITools.OpenApi +{ + /// <summary> + /// Replacement utilities from Swashbuckle.AspNetCore.SwaggerGen which are not in 5.x + /// </summary> + public static class TypeExtensions + { + /// <summary> + /// Produce a friendly name for the type which is unique. + /// </summary> + /// <param name="type"></param> + /// <param name="fullyQualified"></param> + public static string FriendlyId(this Type type, bool fullyQualified = false) + { + var typeName = fullyQualified + ? type.FullNameSansTypeParameters().Replace("+", ".") + : type.Name; + + if (type.IsGenericType) + { + var genericArgumentIds = type.GetGenericArguments() + .Select(t => t.FriendlyId(fullyQualified)) + .ToArray(); + + return new StringBuilder(typeName) + .Replace($"`{genericArgumentIds.Count()}", string.Empty) + .Append($"[{string.Join(",", genericArgumentIds).TrimEnd(',')}]") + .ToString(); + } + + return typeName; + } + + /// <summary> + /// Determine the fully qualified type name without type parameters. + /// </summary> + /// <param name="type"></param> + public static string FullNameSansTypeParameters(this Type type) + { + var fullName = type.FullName; + if (string.IsNullOrEmpty(fullName)) + fullName = type.Name; + var chopIndex = fullName.IndexOf("[[", StringComparison.Ordinal); + return (chopIndex == -1) ? fullName : fullName.Substring(0, chopIndex); + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..7751241e25ad --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,24 @@ +<Project Sdk="Microsoft.NET.Sdk.Web"> + <PropertyGroup> + <Description>Org.OpenAPITools</Description> + <Copyright>Org.OpenAPITools</Copyright> + <TargetFramework>netcoreapp3.1</TargetFramework> + <GenerateDocumentationFile>true</GenerateDocumentationFile> + <PreserveCompilationContext>true</PreserveCompilationContext> + <AssemblyName>Org.OpenAPITools</AssemblyName> + <PackageId>Org.OpenAPITools</PackageId> + <UserSecretsId>e6b329a8-90bb-4944-9291-8feb57c1802d</UserSecretsId> + <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> + <DockerfileContext>..\..</DockerfileContext> + </PropertyGroup> + <ItemGroup> + <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.0"/> + <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" /> + <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.0.0"/> + <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0"/> + <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.0.0" /> + </ItemGroup> + <ItemGroup> + <!--<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />--> + </ItemGroup> +</Project> diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Program.cs new file mode 100644 index 000000000000..28b87acf7538 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Program.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace Org.OpenAPITools +{ + /// <summary> + /// Program + /// </summary> + public class Program + { + /// <summary> + /// Main + /// </summary> + /// <param name="args"></param> + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + /// <summary> + /// Create the host builder. + /// </summary> + /// <param name="args"></param> + /// <returns>IHostBuilder</returns> + public static IHostBuilder CreateWebHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup<Startup>() + .UseUrls("http://0.0.0.0:8080/"); + }); + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Properties/launchSettings.json new file mode 100644 index 000000000000..57b03cc43aa3 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Properties/launchSettings.json @@ -0,0 +1,37 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61788", + "sslPort": 44301 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OpenAPI": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Startup.cs new file mode 100644 index 000000000000..b63ad301ef6a --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/Startup.cs @@ -0,0 +1,150 @@ +/* + * 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://openapi-generator.tech + */ + +using System; +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.OpenApi.Models; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Serialization; +using Org.OpenAPITools.Authentication; +using Org.OpenAPITools.Filters; +using Org.OpenAPITools.OpenApi; + +namespace Org.OpenAPITools +{ + /// <summary> + /// Startup + /// </summary> + public class Startup + { + /// <summary> + /// Constructor + /// </summary> + /// <param name="env"></param> + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + /// <summary> + /// The application configuration. + /// </summary> + public IConfiguration Configuration { get; } + + /// <summary> + /// This method gets called by the runtime. Use this method to add services to the container. + /// </summary> + /// <param name="services"></param> + public void ConfigureServices(IServiceCollection services) + { + services.AddTransient<IAuthorizationHandler, ApiKeyRequirementHandler>(); + services.AddAuthorization(authConfig => + { + authConfig.AddPolicy("api_key", policyBuilder => + { + policyBuilder + .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"api_key")); + }); + }); + + // Add framework services. + services + // Don't need the full MVC stack for an API, see https://andrewlock.net/comparing-startup-between-the-asp-net-core-3-templates/ + .AddControllers() + .AddNewtonsoftJson(opts => + { + opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + opts.SerializerSettings.Converters.Add(new StringEnumConverter + { + NamingStrategy = new CamelCaseNamingStrategy() + }); + }); + + services + .AddSwaggerGen(c => + { + c.SwaggerDoc("1.0.0", new OpenApiInfo + { + Title = "OpenAPI Petstore", + Description = "OpenAPI Petstore (ASP.NET Core 3.1)", + TermsOfService = new Uri("https://github.com/openapitools/openapi-generator"), + Contact = new OpenApiContact + { + Name = "OpenAPI-Generator Contributors", + Url = new Uri("https://github.com/openapitools/openapi-generator"), + Email = "" + }, + License = new OpenApiLicense + { + Name = "NoLicense", + Url = new Uri("https://www.apache.org/licenses/LICENSE-2.0.html") + }, + Version = "1.0.0", + }); + c.CustomSchemaIds(type => type.FriendlyId(true)); + c.DescribeAllEnumsAsStrings(); + c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml"); + // Sets the basePath property in the Swagger document generated + c.DocumentFilter<BasePathFilter>("/v2"); + + // Include DataAnnotation attributes on Controller Action parameters as Swagger validation rules (e.g required, pattern, ..) + // Use [ValidateModelState] on Actions to actually validate it in C# as well! + c.OperationFilter<GeneratePathParamsValidationFilter>(); + }); + services + .AddSwaggerGenNewtonsoftSupport(); + } + + /// <summary> + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// </summary> + /// <param name="app"></param> + /// <param name="env"></param> + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseDefaultFiles(); + app.UseStaticFiles(); + app.UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) + .UseSwaggerUI(c => + { + //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) + c.SwaggerEndpoint("/swagger/1.0.0/openapi.json", "OpenAPI Petstore"); + + //TODO: Or alternatively use the original Swagger contract that's included in the static files + // c.SwaggerEndpoint("/openapi-original.json", "OpenAPI Petstore Original"); + }); + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/appsettings.json new file mode 100644 index 000000000000..def9159a7d94 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/README.md b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/README.md new file mode 100644 index 000000000000..6a0b78471a33 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/README.md @@ -0,0 +1,42 @@ +# Welcome to ASP.NET 5 Preview + +We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. + +ASP.NET 5 has been rearchitected to make it **lean** and **composable**. It's fully **open source** and available on [GitHub](http://go.microsoft.com/fwlink/?LinkID=517854). +Your new project automatically takes advantage of modern client-side utilities like [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) and [npm](http://go.microsoft.com/fwlink/?LinkId=518005) (to add client-side libraries) and [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) (for client-side build and automation tasks). + +We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015. +The ASP.NET Team + +### You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016) + +### This application consists of: +* Sample pages using ASP.NET MVC 6 +* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side resources +* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939) + +#### NEW CONCEPTS +* [The 'wwwroot' explained](http://go.microsoft.com/fwlink/?LinkId=518008) +* [Configuration in ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518012) +* [Dependency Injection](http://go.microsoft.com/fwlink/?LinkId=518013) +* [Razor TagHelpers](http://go.microsoft.com/fwlink/?LinkId=518014) +* [Manage client packages using Gulp](http://go.microsoft.com/fwlink/?LinkID=517849) +* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=517850) + +#### CUSTOMIZE APP +* [Add Controllers and Views](http://go.microsoft.com/fwlink/?LinkID=398600) +* [Add Data using EntityFramework](http://go.microsoft.com/fwlink/?LinkID=398602) +* [Add Authentication using Identity](http://go.microsoft.com/fwlink/?LinkID=398603) +* [Add real time support using SignalR](http://go.microsoft.com/fwlink/?LinkID=398606) +* [Add Class library](http://go.microsoft.com/fwlink/?LinkID=398604) +* [Add Web APIs with MVC 6](http://go.microsoft.com/fwlink/?LinkId=518009) +* [Add client packages using Bower](http://go.microsoft.com/fwlink/?LinkID=517848) + +#### DEPLOY +* [Run your app locally](http://go.microsoft.com/fwlink/?LinkID=517851) +* [Run your app on ASP.NET Core 5](http://go.microsoft.com/fwlink/?LinkID=517852) +* [Run commands in your 'project.json'](http://go.microsoft.com/fwlink/?LinkID=517853) +* [Publish to Microsoft Azure Web Sites](http://go.microsoft.com/fwlink/?LinkID=398609) +* [Publish to the file system](http://go.microsoft.com/fwlink/?LinkId=518019) + +We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015) diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/index.html b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/index.html new file mode 100644 index 000000000000..cde1f2f90b92 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/index.html @@ -0,0 +1 @@ +<meta http-equiv="refresh" content="0;URL='./swagger/'" /> \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/openapi-original.json b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/openapi-original.json new file mode 100644 index 000000000000..c72a9d39daa2 --- /dev/null +++ b/samples/server/petstore/aspnetcore-3.1/src/Org.OpenAPITools/wwwroot/openapi-original.json @@ -0,0 +1,1012 @@ +{ + "openapi" : "3.0.1", + "info" : { + "description" : "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.", + "license" : { + "name" : "Apache-2.0", + "url" : "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + "title" : "OpenAPI Petstore", + "version" : "1.0.0" + }, + "servers" : [ { + "url" : "http://petstore.swagger.io/v2" + } ], + "tags" : [ { + "description" : "Everything about your Pets", + "name" : "pet" + }, { + "description" : "Access to Petstore orders", + "name" : "store" + }, { + "description" : "Operations about user", + "name" : "user" + } ], + "paths" : { + "/pet" : { + "post" : { + "operationId" : "addPet", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "Pet object that needs to be added to the store", + "required" : true + }, + "responses" : { + "405" : { + "content" : { }, + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Add a new pet to the store", + "tags" : [ "pet" ], + "x-codegen-request-body-name" : "body" + }, + "put" : { + "operationId" : "updatePet", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "Pet object that needs to be added to the store", + "required" : true + }, + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Pet not found" + }, + "405" : { + "content" : { }, + "description" : "Validation exception" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Update an existing pet", + "tags" : [ "pet" ], + "x-codegen-request-body-name" : "body" + } + }, + "/pet/findByStatus" : { + "get" : { + "description" : "Multiple status values can be provided with comma separated strings", + "operationId" : "findPetsByStatus", + "parameters" : [ { + "description" : "Status values that need to be considered for filter", + "explode" : false, + "in" : "query", + "name" : "status", + "required" : true, + "schema" : { + "items" : { + "default" : "available", + "enum" : [ "available", "pending", "sold" ], + "type" : "string" + }, + "type" : "array" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + }, + "application/json" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid status value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Finds Pets by status", + "tags" : [ "pet" ] + } + }, + "/pet/findByTags" : { + "get" : { + "deprecated" : true, + "description" : "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId" : "findPetsByTags", + "parameters" : [ { + "description" : "Tags to filter by", + "explode" : false, + "in" : "query", + "name" : "tags", + "required" : true, + "schema" : { + "items" : { + "type" : "string" + }, + "type" : "array" + }, + "style" : "form" + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + }, + "application/json" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/Pet" + }, + "type" : "array" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid tag value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Finds Pets by tags", + "tags" : [ "pet" ] + } + }, + "/pet/{petId}" : { + "delete" : { + "operationId" : "deletePet", + "parameters" : [ { + "in" : "header", + "name" : "api_key", + "schema" : { + "type" : "string" + } + }, { + "description" : "Pet id to delete", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid pet value" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Deletes a pet", + "tags" : [ "pet" ] + }, + "get" : { + "description" : "Returns a single pet", + "operationId" : "getPetById", + "parameters" : [ { + "description" : "ID of pet to return", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Pet" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Pet not found" + } + }, + "security" : [ { + "api_key" : [ ] + } ], + "summary" : "Find pet by ID", + "tags" : [ "pet" ] + }, + "post" : { + "operationId" : "updatePetWithForm", + "parameters" : [ { + "description" : "ID of pet that needs to be updated", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "requestBody" : { + "content" : { + "application/x-www-form-urlencoded" : { + "schema" : { + "properties" : { + "name" : { + "description" : "Updated name of the pet", + "type" : "string" + }, + "status" : { + "description" : "Updated status of the pet", + "type" : "string" + } + } + } + } + } + }, + "responses" : { + "405" : { + "content" : { }, + "description" : "Invalid input" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "Updates a pet in the store with form data", + "tags" : [ "pet" ] + } + }, + "/pet/{petId}/uploadImage" : { + "post" : { + "operationId" : "uploadFile", + "parameters" : [ { + "description" : "ID of pet to update", + "in" : "path", + "name" : "petId", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "properties" : { + "additionalMetadata" : { + "description" : "Additional data to pass to server", + "type" : "string" + }, + "file" : { + "description" : "file to upload", + "format" : "binary", + "type" : "string" + } + } + } + } + } + }, + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ApiResponse" + } + } + }, + "description" : "successful operation" + } + }, + "security" : [ { + "petstore_auth" : [ "write:pets", "read:pets" ] + } ], + "summary" : "uploads an image", + "tags" : [ "pet" ] + } + }, + "/store/inventory" : { + "get" : { + "description" : "Returns a map of status codes to quantities", + "operationId" : "getInventory", + "responses" : { + "200" : { + "content" : { + "application/json" : { + "schema" : { + "additionalProperties" : { + "format" : "int32", + "type" : "integer" + }, + "type" : "object" + } + } + }, + "description" : "successful operation" + } + }, + "security" : [ { + "api_key" : [ ] + } ], + "summary" : "Returns pet inventories by status", + "tags" : [ "store" ] + } + }, + "/store/order" : { + "post" : { + "operationId" : "placeOrder", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "order placed for purchasing the pet", + "required" : true + }, + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid Order" + } + }, + "summary" : "Place an order for a pet", + "tags" : [ "store" ], + "x-codegen-request-body-name" : "body" + } + }, + "/store/order/{orderId}" : { + "delete" : { + "description" : "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId" : "deleteOrder", + "parameters" : [ { + "description" : "ID of the order that needs to be deleted", + "in" : "path", + "name" : "orderId", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Order not found" + } + }, + "summary" : "Delete purchase order by ID", + "tags" : [ "store" ] + }, + "get" : { + "description" : "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId" : "getOrderById", + "parameters" : [ { + "description" : "ID of pet that needs to be fetched", + "in" : "path", + "name" : "orderId", + "required" : true, + "schema" : { + "format" : "int64", + "maximum" : 5, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/Order" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid ID supplied" + }, + "404" : { + "content" : { }, + "description" : "Order not found" + } + }, + "summary" : "Find purchase order by ID", + "tags" : [ "store" ] + } + }, + "/user" : { + "post" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "createUser", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "Created user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Create user", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/createWithArray" : { + "post" : { + "operationId" : "createUsersWithArrayInput", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/User" + }, + "type" : "array" + } + } + }, + "description" : "List of user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Creates list of users with given input array", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/createWithList" : { + "post" : { + "operationId" : "createUsersWithListInput", + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "items" : { + "$ref" : "#/components/schemas/User" + }, + "type" : "array" + } + } + }, + "description" : "List of user object", + "required" : true + }, + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Creates list of users with given input array", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + }, + "/user/login" : { + "get" : { + "operationId" : "loginUser", + "parameters" : [ { + "description" : "The user name for login", + "in" : "query", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "description" : "The password for login in clear text", + "in" : "query", + "name" : "password", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "type" : "string" + } + }, + "application/json" : { + "schema" : { + "type" : "string" + } + } + }, + "description" : "successful operation", + "headers" : { + "X-Rate-Limit" : { + "description" : "calls per hour allowed by the user", + "schema" : { + "format" : "int32", + "type" : "integer" + } + }, + "X-Expires-After" : { + "description" : "date in UTC when toekn expires", + "schema" : { + "format" : "date-time", + "type" : "string" + } + } + } + }, + "400" : { + "content" : { }, + "description" : "Invalid username/password supplied" + } + }, + "summary" : "Logs user into the system", + "tags" : [ "user" ] + } + }, + "/user/logout" : { + "get" : { + "operationId" : "logoutUser", + "responses" : { + "default" : { + "content" : { }, + "description" : "successful operation" + } + }, + "summary" : "Logs out current logged in user session", + "tags" : [ "user" ] + } + }, + "/user/{username}" : { + "delete" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "deleteUser", + "parameters" : [ { + "description" : "The name that needs to be deleted", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid username supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Delete user", + "tags" : [ "user" ] + }, + "get" : { + "operationId" : "getUserByName", + "parameters" : [ { + "description" : "The name that needs to be fetched. Use user1 for testing.", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "content" : { + "application/xml" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + }, + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "successful operation" + }, + "400" : { + "content" : { }, + "description" : "Invalid username supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Get user by user name", + "tags" : [ "user" ] + }, + "put" : { + "description" : "This can only be done by the logged in user.", + "operationId" : "updateUser", + "parameters" : [ { + "description" : "name that need to be deleted", + "in" : "path", + "name" : "username", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/User" + } + } + }, + "description" : "Updated user object", + "required" : true + }, + "responses" : { + "400" : { + "content" : { }, + "description" : "Invalid user supplied" + }, + "404" : { + "content" : { }, + "description" : "User not found" + } + }, + "summary" : "Updated user", + "tags" : [ "user" ], + "x-codegen-request-body-name" : "body" + } + } + }, + "components" : { + "schemas" : { + "Order" : { + "description" : "An order for a pets from the pet store", + "example" : { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "petId" : { + "format" : "int64", + "type" : "integer" + }, + "quantity" : { + "format" : "int32", + "type" : "integer" + }, + "shipDate" : { + "format" : "date-time", + "type" : "string" + }, + "status" : { + "description" : "Order Status", + "enum" : [ "placed", "approved", "delivered" ], + "type" : "string" + }, + "complete" : { + "default" : false, + "type" : "boolean" + } + }, + "title" : "Pet Order", + "type" : "object", + "xml" : { + "name" : "Order" + } + }, + "Category" : { + "description" : "A category for a pet", + "example" : { + "name" : "name", + "id" : 6 + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "name" : { + "type" : "string" + } + }, + "title" : "Pet category", + "type" : "object", + "xml" : { + "name" : "Category" + } + }, + "User" : { + "description" : "A User who is purchasing from the pet store", + "example" : { + "firstName" : "firstName", + "lastName" : "lastName", + "password" : "password", + "userStatus" : 6, + "phone" : "phone", + "id" : 0, + "email" : "email", + "username" : "username" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "username" : { + "type" : "string" + }, + "firstName" : { + "type" : "string" + }, + "lastName" : { + "type" : "string" + }, + "email" : { + "type" : "string" + }, + "password" : { + "type" : "string" + }, + "phone" : { + "type" : "string" + }, + "userStatus" : { + "description" : "User Status", + "format" : "int32", + "type" : "integer" + } + }, + "title" : "a User", + "type" : "object", + "xml" : { + "name" : "User" + } + }, + "Tag" : { + "description" : "A tag for a pet", + "example" : { + "name" : "name", + "id" : 1 + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "name" : { + "type" : "string" + } + }, + "title" : "Pet Tag", + "type" : "object", + "xml" : { + "name" : "Tag" + } + }, + "Pet" : { + "description" : "A pet for sale in the pet store", + "example" : { + "photoUrls" : [ "photoUrls", "photoUrls" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "name", + "id" : 6 + }, + "tags" : [ { + "name" : "name", + "id" : 1 + }, { + "name" : "name", + "id" : 1 + } ], + "status" : "available" + }, + "properties" : { + "id" : { + "format" : "int64", + "type" : "integer" + }, + "category" : { + "$ref" : "#/components/schemas/Category" + }, + "name" : { + "example" : "doggie", + "type" : "string" + }, + "photoUrls" : { + "items" : { + "type" : "string" + }, + "type" : "array", + "xml" : { + "name" : "photoUrl", + "wrapped" : true + } + }, + "tags" : { + "items" : { + "$ref" : "#/components/schemas/Tag" + }, + "type" : "array", + "xml" : { + "name" : "tag", + "wrapped" : true + } + }, + "status" : { + "description" : "pet status in the store", + "enum" : [ "available", "pending", "sold" ], + "type" : "string" + } + }, + "required" : [ "name", "photoUrls" ], + "title" : "a Pet", + "type" : "object", + "xml" : { + "name" : "Pet" + } + }, + "ApiResponse" : { + "description" : "Describes the result of uploading an image resource", + "example" : { + "code" : 0, + "type" : "type", + "message" : "message" + }, + "properties" : { + "code" : { + "format" : "int32", + "type" : "integer" + }, + "type" : { + "type" : "string" + }, + "message" : { + "type" : "string" + } + }, + "title" : "An uploaded response", + "type" : "object" + } + }, + "securitySchemes" : { + "petstore_auth" : { + "flows" : { + "implicit" : { + "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", + "scopes" : { + "write:pets" : "modify pets in your account", + "read:pets" : "read your pets" + } + } + }, + "type" : "oauth2" + }, + "api_key" : { + "in" : "header", + "name" : "api_key", + "type" : "apiKey" + } + } + } +} From a58441cf68171456c3a76c9f2b1745b21a3eae69 Mon Sep 17 00:00:00 2001 From: Sebastien Rosset <serosset@cisco.com> Date: Mon, 4 May 2020 05:31:55 -0700 Subject: [PATCH 64/78] Make the array items optional (#6132) --- .../codegen/languages/AbstractGoCodegen.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index b018d22707a6..bedd7ed652a8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -328,7 +328,20 @@ public String getTypeDeclaration(Schema p) { if (ModelUtils.isArraySchema(p)) { ArraySchema ap = (ArraySchema) p; Schema inner = ap.getItems(); - return "[]" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)); + // In OAS 3.0.x, the array "items" attribute is required. + // In OAS >= 3.1, the array "items" attribute is optional such that the OAS + // specification is aligned with the JSON schema specification. + // When "items" is not specified, the elements of the array may be anything at all. + if (inner != null) { + inner = ModelUtils.unaliasSchema(this.openAPI, inner); + } + String typDecl; + if (inner != null) { + typDecl = getTypeDeclaration(inner); + } else { + typDecl = "interface{}"; + } + return "[]" + typDecl; } else if (ModelUtils.isMapSchema(p)) { Schema inner = ModelUtils.getAdditionalProperties(p); return getSchemaType(p) + "[string]" + getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, inner)); From 90ff4926b9f84f65291d9471885c7e3d49c8837d Mon Sep 17 00:00:00 2001 From: Yuriy Belenko <yura-bely@mail.ru> Date: Tue, 5 May 2020 06:23:59 +0300 Subject: [PATCH 65/78] Show description when summary is missing (#6159) --- .../src/main/resources/markdown-documentation/README.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/markdown-documentation/README.mustache b/modules/openapi-generator/src/main/resources/markdown-documentation/README.mustache index 221d4925576b..bd831612b601 100644 --- a/modules/openapi-generator/src/main/resources/markdown-documentation/README.mustache +++ b/modules/openapi-generator/src/main/resources/markdown-documentation/README.mustache @@ -8,7 +8,7 @@ All URIs are relative to *{{{basePath}}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**](Apis/{{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**](Apis/{{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}{{^summary}}{{{notes}}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} {{/generateApiDocs}} From 30ee3f343eb681514ce5b33438de3b8f4fb1f50b Mon Sep 17 00:00:00 2001 From: Luis Ballabeni <laballabeni@gmail.com> Date: Tue, 5 May 2020 01:40:22 -0400 Subject: [PATCH 66/78] Fix #6157: Updated native template to fix null async return (#6168) * Fix #6157: Updated native template to fix null async return Should fix issue: https://github.com/OpenAPITools/openapi-generator/issues/6157 * fixed uncaught json exception in java native api gen * cleaning up Co-authored-by: Luis Ballabeni <luis.ballabeni@lexisnexis.com> --- .../Java/libraries/native/api.mustache | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache index 23388d36a76d..7d6ed2d4bb7a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/api.mustache @@ -180,14 +180,18 @@ public class {{classname}} { localVarResponse.body()) ); } else { - return CompletableFuture.completedFuture( - {{#returnValue}} - memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) - {{/returnValue}} - {{^returnValue}} - null - {{/returnValue}} - ); + try { + return CompletableFuture.completedFuture( + {{#returnType}} + memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) + {{/returnType}} + {{^returnType}} + null + {{/returnType}} + ); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } } }); {{/asyncNative}} From 003165c2c254ded7817760cc1d6f97af730d9d4d Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 6 May 2020 17:10:31 +0800 Subject: [PATCH 67/78] Prepare 4.3.1 release (#6187) * prepare 4.3.1 release * update doc --- README.md | 12 ++++++------ docs/installation.md | 8 ++++---- modules/openapi-generator-cli/pom.xml | 2 +- modules/openapi-generator-core/pom.xml | 2 +- modules/openapi-generator-gradle-plugin/README.adoc | 2 +- modules/openapi-generator-gradle-plugin/pom.xml | 2 +- modules/openapi-generator-maven-plugin/README.md | 2 +- .../examples/java-client.xml | 2 +- .../examples/multi-module/java-client/pom.xml | 2 +- .../examples/non-java-invalid-spec.xml | 2 +- .../examples/non-java.xml | 2 +- modules/openapi-generator-maven-plugin/pom.xml | 2 +- modules/openapi-generator-online/pom.xml | 2 +- modules/openapi-generator/pom.xml | 2 +- pom.xml | 2 +- website/src/pages/index.js | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3d0746a6dbf2..d977d3121231 100644 --- a/README.md +++ b/README.md @@ -164,16 +164,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository. <!-- RELEASE_VERSION --> If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum): -JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar` +JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar` For **Mac/Linux** users: ```sh -wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar -O openapi-generator-cli.jar +wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar -O openapi-generator-cli.jar ``` For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. ``` -Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -394,10 +394,10 @@ openapi-generator version ``` <!-- RELEASE_VERSION --> -Or install a particular OpenAPI Generator version (e.g. v4.3.0): +Or install a particular OpenAPI Generator version (e.g. v4.3.1): ```sh -npm install @openapitools/openapi-generator-cli@cli-4.3.0 -g +npm install @openapitools/openapi-generator-cli@cli-4.3.1 -g ``` Or install it as dev-dependency: @@ -421,7 +421,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat (if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`) <!-- RELEASE_VERSION --> -You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar) +You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar) <!-- /RELEASE_VERSION --> To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate` diff --git a/docs/installation.md b/docs/installation.md index 29e8dcf10b2d..274024c9478f 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -22,7 +22,7 @@ npm install @openapitools/openapi-generator-cli -g To install a specific version of the tool, pass the version during installation: <!-- RELEASE_VERSION --> ```bash -npm install @openapitools/openapi-generator-cli@cli-4.3.0 -g +npm install @openapitools/openapi-generator-cli@cli-4.3.1 -g ``` <!-- /RELEASE_VERSION --> To install the tool as a dev dependency in your current project: @@ -80,18 +80,18 @@ docker run --rm \ <!-- RELEASE_VERSION --> If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum): -JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar` +JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar` For **Mac/Linux** users: ```bash -wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar -O openapi-generator-cli.jar +wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar -O openapi-generator-cli.jar ``` For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. ```powershell -Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar ``` <!-- /RELEASE_VERSION --> diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 2ca184ce5ada..70a1ed90efde 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -4,7 +4,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-project</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <relativePath>../..</relativePath> </parent> diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml index c4043ff58080..f4cbb2be0110 100644 --- a/modules/openapi-generator-core/pom.xml +++ b/modules/openapi-generator-core/pom.xml @@ -6,7 +6,7 @@ <artifactId>openapi-generator-project</artifactId> <groupId>org.openapitools</groupId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <relativePath>../..</relativePath> </parent> diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index 79a25cbe8b06..abbeacab2657 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -68,7 +68,7 @@ task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec']) [source,group] ---- plugins { - id "org.openapi.generator" version "4.3.0" + id "org.openapi.generator" version "4.3.1" } ---- diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index 830ae650075c..624e69b5c568 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -4,7 +4,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-project</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <relativePath>../..</relativePath> </parent> diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md index 1804977ba532..0491bbfab709 100644 --- a/modules/openapi-generator-maven-plugin/README.md +++ b/modules/openapi-generator-maven-plugin/README.md @@ -12,7 +12,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.0</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <executions> <execution> diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml index a92b09531c7d..f8213abd5abd 100644 --- a/modules/openapi-generator-maven-plugin/examples/java-client.xml +++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml @@ -13,7 +13,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <executions> <execution> diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml index 02008ec8d42d..710a1a6a2d95 100644 --- a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml +++ b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml @@ -19,7 +19,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <dependencies> <dependency> diff --git a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml index c398e99a0f7b..6b22f84ae473 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml @@ -13,7 +13,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <executions> <execution> diff --git a/modules/openapi-generator-maven-plugin/examples/non-java.xml b/modules/openapi-generator-maven-plugin/examples/non-java.xml index 159670bfa5af..e0a0b80d061e 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java.xml @@ -13,7 +13,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <executions> <execution> diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml index 995a7f859f26..126bc48942f4 100644 --- a/modules/openapi-generator-maven-plugin/pom.xml +++ b/modules/openapi-generator-maven-plugin/pom.xml @@ -5,7 +5,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-project</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <relativePath>../..</relativePath> </parent> diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml index 2babaab50cbd..23f06b54d055 100644 --- a/modules/openapi-generator-online/pom.xml +++ b/modules/openapi-generator-online/pom.xml @@ -4,7 +4,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-project</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <relativePath>../..</relativePath> </parent> diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index a6a57e4426e2..8aaa5aeedad2 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -4,7 +4,7 @@ <groupId>org.openapitools</groupId> <artifactId>openapi-generator-project</artifactId> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <relativePath>../..</relativePath> </parent> diff --git a/pom.xml b/pom.xml index 6c02ecbf7ff5..ea356d9445ba 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ <packaging>pom</packaging> <name>openapi-generator-project</name> <!-- RELEASE_VERSION --> - <version>4.3.1-SNAPSHOT</version> + <version>4.3.1</version> <!-- /RELEASE_VERSION --> <url>https://github.com/openapitools/openapi-generator</url> <scm> diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 68a9a1f8a0c4..21393e443f6a 100755 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -145,7 +145,7 @@ const callouts = [ |npm install @openapitools/openapi-generator-cli -g | |# install a specific version of "openapi-generator-cli" - |npm install @openapitools/openapi-generator-cli@cli-4.3.0 -g + |npm install @openapitools/openapi-generator-cli@cli-4.3.1 -g | |# Or install it as dev-dependency in your node.js projects |npm install @openapitools/openapi-generator-cli -D From 1b0ec0cd83aba2a35844d98fde5420a9a1ccbfa6 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 6 May 2020 22:34:48 +0800 Subject: [PATCH 68/78] update readme with new release --- README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d977d3121231..3c4889c666a5 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,13 @@ <div align="center"> -[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.3.1`): [](https://travis-ci.org/OpenAPITools/openapi-generator) +[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`): [](https://travis-ci.org/OpenAPITools/openapi-generator) [](https://circleci.com/gh/OpenAPITools/openapi-generator) [](https://app.shippable.com/github/OpenAPITools/openapi-generator) [](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) [](https://cloud.drone.io/OpenAPITools/openapi-generator) [](https://app.bitrise.io/app/4a2b10a819d12b67) -[`5.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/5.0.x) branch: [](https://travis-ci.org/OpenAPITools/openapi-generator) -[](https://circleci.com/gh/OpenAPITools/openapi-generator) -[](https://app.shippable.com/github/OpenAPITools/openapi-generator) -[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) -[](https://cloud.drone.io/OpenAPITools/openapi-generator) -[](https://app.bitrise.io/app/4a2b10a819d12b67) </div> <div align="center"> @@ -107,8 +101,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20 | OpenAPI Generator Version | Release Date | Notes | | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- | | 5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/) | 13.05.2020 | Major release with breaking changes (no fallback) | -| 4.3.1 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.3.1-SNAPSHOT/) | 27.04.2020 | Backward-compatible release | -| [4.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.0) (latest stable release) | 27.03.2020 | Minor release (breaking changes with fallbacks) | +| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) (latest stable release) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) | OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 From c588db682df948aa766a27ade0b0fa72d37895d7 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 6 May 2020 22:53:08 +0800 Subject: [PATCH 69/78] update 5.0.0 release date --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c4889c666a5..01d0277b7edd 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20 | OpenAPI Generator Version | Release Date | Notes | | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- | -| 5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/) | 13.05.2020 | Major release with breaking changes (no fallback) | +| 5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/) | 17.06.2020 | Major release with breaking changes (no fallback) | | [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) (latest stable release) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) | OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 From 4beea9d90d36198b65fe772a113edd7af4afd0db Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 7 May 2020 00:30:12 +0800 Subject: [PATCH 70/78] update samples --- .../openapi-v3/docs/ObjectUntypedProps.md | 8 +++--- .../output/openapi-v3/src/models.rs | 28 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/ObjectUntypedProps.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/ObjectUntypedProps.md index 44919a9b60a1..e8af6d7c8f8d 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/ObjectUntypedProps.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/ObjectUntypedProps.md @@ -3,10 +3,10 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**required_untyped** | [***serde_json::Value**](object.md) | | -**required_untyped_nullable** | [***serde_json::Value**](object.md) | | -**not_required_untyped** | [***serde_json::Value**](object.md) | | [optional] [default to None] -**not_required_untyped_nullable** | [***serde_json::Value**](object.md) | | [optional] [default to None] +**required_untyped** | [***AnyType**](.md) | | +**required_untyped_nullable** | [***AnyType**](.md) | | +**not_required_untyped** | [***AnyType**](.md) | | [optional] [default to None] +**not_required_untyped_nullable** | [***AnyType**](.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/src/models.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs index 19c8a7d633fd..57b9fc04c453 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 @@ -1245,23 +1245,23 @@ impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectUntypedP #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct ObjectUntypedProps { #[serde(rename = "required_untyped")] - pub required_untyped: serde_json::Value, + pub required_untyped: AnyType, #[serde(rename = "required_untyped_nullable")] - pub required_untyped_nullable: serde_json::Value, + pub required_untyped_nullable: swagger::Nullable<AnyType>, #[serde(rename = "not_required_untyped")] #[serde(skip_serializing_if="Option::is_none")] - pub not_required_untyped: Option<serde_json::Value>, + pub not_required_untyped: Option<AnyType>, #[serde(rename = "not_required_untyped_nullable")] #[serde(skip_serializing_if="Option::is_none")] - pub not_required_untyped_nullable: Option<serde_json::Value>, + pub not_required_untyped_nullable: Option<AnyType>, } impl ObjectUntypedProps { - pub fn new(required_untyped: serde_json::Value, required_untyped_nullable: serde_json::Value, ) -> ObjectUntypedProps { + pub fn new(required_untyped: AnyType, required_untyped_nullable: swagger::Nullable<AnyType>, ) -> ObjectUntypedProps { ObjectUntypedProps { required_untyped: required_untyped, required_untyped_nullable: required_untyped_nullable, @@ -1299,10 +1299,10 @@ impl std::str::FromStr for ObjectUntypedProps { #[derive(Default)] // An intermediate representation of the struct to use for parsing. struct IntermediateRep { - pub required_untyped: Vec<serde_json::Value>, - pub required_untyped_nullable: Vec<serde_json::Value>, - pub not_required_untyped: Vec<serde_json::Value>, - pub not_required_untyped_nullable: Vec<serde_json::Value>, + pub required_untyped: Vec<AnyType>, + pub required_untyped_nullable: Vec<AnyType>, + pub not_required_untyped: Vec<AnyType>, + pub not_required_untyped_nullable: Vec<AnyType>, } let mut intermediate_rep = IntermediateRep::default(); @@ -1319,10 +1319,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_nullable" => intermediate_rep.required_untyped_nullable.push(serde_json::Value::from_str(val).map_err(|x| format!("{}", x))?), - "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))?), + "required_untyped" => intermediate_rep.required_untyped.push(AnyType::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(AnyType::from_str(val).map_err(|x| format!("{}", x))?), + "not_required_untyped_nullable" => intermediate_rep.not_required_untyped_nullable.push(AnyType::from_str(val).map_err(|x| format!("{}", x))?), _ => return std::result::Result::Err("Unexpected key while parsing ObjectUntypedProps".to_string()) } } @@ -1334,7 +1334,7 @@ impl std::str::FromStr for ObjectUntypedProps { // Use the intermediate representation to return the struct std::result::Result::Ok(ObjectUntypedProps { required_untyped: intermediate_rep.required_untyped.into_iter().next().ok_or("required_untyped missing in ObjectUntypedProps".to_string())?, - required_untyped_nullable: intermediate_rep.required_untyped_nullable.into_iter().next().ok_or("required_untyped_nullable missing in ObjectUntypedProps".to_string())?, + required_untyped_nullable: std::result::Result::Err("Nullable types not supported in ObjectUntypedProps".to_string())?, not_required_untyped: intermediate_rep.not_required_untyped.into_iter().next(), not_required_untyped_nullable: intermediate_rep.not_required_untyped_nullable.into_iter().next(), }) From 046b4acdff2a3fa0c0e0cd832233119cc22d04a5 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse <richard.whitehouse@metaswitch.com> Date: Wed, 6 May 2020 19:27:52 +0100 Subject: [PATCH 71/78] [Rust Server] Support boolean headers, and fix panic handling headers (#6056) * [Rust Server] Support headers containing booleans * [Rust Server] Fix panic handling headers * [Rust Server] Fix issue with Results * Update samples --- .../rust-server/client-imports.mustache | 1 + .../rust-server/client-operation.mustache | 32 +- .../resources/rust-server/header.mustache | 149 ++- .../resources/rust-server/models.mustache | 34 +- .../rust-server/server-imports.mustache | 2 + .../rust-server/server-operation.mustache | 47 +- .../resources/3_0/rust-server/openapi-v3.yaml | 3 + .../output/multipart-v3/src/client/mod.rs | 1 + .../output/multipart-v3/src/header.rs | 149 ++- .../output/multipart-v3/src/models.rs | 136 +- .../output/multipart-v3/src/server/mod.rs | 2 + .../output/no-example-v3/src/client/mod.rs | 1 + .../output/no-example-v3/src/header.rs | 149 ++- .../output/no-example-v3/src/models.rs | 34 +- .../output/no-example-v3/src/server/mod.rs | 2 + .../output/openapi-v3/api/openapi.yaml | 5 + .../output/openapi-v3/src/client/callbacks.rs | 21 +- .../output/openapi-v3/src/client/mod.rs | 62 +- .../output/openapi-v3/src/header.rs | 149 ++- .../rust-server/output/openapi-v3/src/lib.rs | 1 + .../output/openapi-v3/src/models.rs | 408 +++++- .../output/openapi-v3/src/server/callbacks.rs | 16 +- .../output/openapi-v3/src/server/mod.rs | 85 +- .../output/ops-v3/src/client/mod.rs | 1 + .../rust-server/output/ops-v3/src/header.rs | 149 ++- .../output/ops-v3/src/server/mod.rs | 2 + .../src/client/mod.rs | 66 +- .../src/header.rs | 149 ++- .../src/models.rs | 1156 ++++++++++++++--- .../src/server/mod.rs | 83 +- .../output/rust-server-test/src/client/mod.rs | 1 + .../output/rust-server-test/src/header.rs | 149 ++- .../output/rust-server-test/src/models.rs | 238 +++- .../output/rust-server-test/src/server/mod.rs | 2 + 34 files changed, 2838 insertions(+), 647 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache index d9878a104658..1cfedfd0884b 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-imports.mustache @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache index f1a4659f2e06..cc65e176ac58 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache @@ -332,15 +332,23 @@ // Header parameters {{/-first}} {{^isMapContainer}} -{{#required}} +{{^required}} + match param_{{{paramName}}} { + Some(param_{{{paramName}}}) => { +{{/required}} request.headers_mut().append( HeaderName::from_static("{{{nameInLowerCase}}}"), - header::IntoHeaderValue(param_{{{paramName}}}.clone()).into()); -{{/required}} + match header::IntoHeaderValue(param_{{{paramName}}}.clone()).try_into() { + Ok(header) => header, + Err(e) => { + return Box::new(future::err(ApiError(format!( + "Invalid header {{{paramName}}} - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }); {{^required}} - param_{{{paramName}}}.map(|value| request.headers_mut().append( - HeaderName::from_static("{{{nameInLowerCase}}}"), - header::IntoHeaderValue(value.clone()).into())); + }, + None => {} + } {{/required}} {{/isMapContainer}} {{#isMapContainer}} @@ -359,6 +367,14 @@ Some(response_{{{name}}}) => response_{{{name}}}.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header {{{baseName}}} for response {{{code}}} was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_{{{name}}} = match TryInto::<header::IntoHeaderValue<{{{dataType}}}>>::try_into(response_{{{name}}}) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header {{baseName}} for response {{code}} - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_{{{name}}} = response_{{{name}}}.0; + {{/headers}} let body = response.into_body(); Box::new( @@ -402,7 +418,7 @@ { body: body, {{/-first}} - {{{name}}}: (*Into::<header::IntoHeaderValue<{{{dataType}}}>>::into(response_{{{name}}})).clone(), + {{{name}}}: response_{{name}}, {{#-last}} } {{/-last}} @@ -416,7 +432,7 @@ {{#-first}} { {{/-first}} - {{{name}}}: (*Into::<header::IntoHeaderValue<{{{dataType}}}>>::into(response_{{{name}}})).clone(), + {{{name}}}: response_{{name}}, {{#-last}} } {{/-last}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/header.mustache b/modules/openapi-generator/src/main/resources/rust-server/header.mustache index 92eee5d0c255..5bc6ebe929b9 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/header.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/header.mustache @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + hdr_value, e)), + } } } 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 e76ae269c4e8..58618bef5ff8 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/models.mustache @@ -124,16 +124,38 @@ impl ::std::str::FromStr for {{{classname}}} { // Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<{{{classname}}}>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<{{{classname}}}>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<{{{classname}}}>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<{{{classname}}}>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<{{{classname}}}> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<{{{classname}}} as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<{{{classname}}}> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + 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)) + } } } diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache index ade68d62fff2..2edcdd9b98ed 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-imports.mustache @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] 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 9b81b7c3771c..cbb011fe9a3e 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 @@ -87,20 +87,35 @@ {{/-first}} let param_{{{paramName}}} = headers.get(HeaderName::from_static("{{{nameInLowerCase}}}")); -{{#required}} let param_{{{paramName}}} = match param_{{{paramName}}} { - Some(v) => header::IntoHeaderValue::<{{{dataType}}}>::from((*v).clone()).0, - None => return Box::new(future::ok(Response::builder() + Some(v) => match header::IntoHeaderValue::<{{{dataType}}}>::try_from((*v).clone()) { + Ok(result) => +{{#required}} + result.0, +{{/required}} +{{^required}} + Some(result.0), +{{/required}} + Err(err) => { + return Box::new(future::ok(Response::builder() .status(StatusCode::BAD_REQUEST) - .body(Body::from("Missing or invalid required header {{{baseName}}}")) - .expect("Unable to create Bad Request response for missing required header {{{baseName}}}"))), - }; + .body(Body::from(format!("Invalid header {{{baseName}}} - {}", err))) + .expect("Unable to create Bad Request response for invalid header {{{baseName}}}"))); + + }, + }, + None => { +{{#required}} + return Box::new(future::ok(Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from("Missing required header {{{baseName}}}")) + .expect("Unable to create Bad Request response for missing required header {{{baseName}}}"))); {{/required}} {{^required}} - let param_{{{paramName}}} = param_{{{paramName}}}.map(|p| { - header::IntoHeaderValue::<{{{dataType}}}>::from((*p).clone()).0 - }); + None {{/required}} + } + }; {{#-last}} {{/-last}} @@ -486,11 +501,23 @@ {{/headers}} {{/dataType}} => { +{{#headers}} + let {{{name}}} = match header::IntoHeaderValue({{{name}}}).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling {{name}} header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + +{{/headers}} *response.status_mut() = StatusCode::from_u16({{{code}}}).expect("Unable to turn {{{code}}} into a StatusCode"); {{#headers}} response.headers_mut().insert( HeaderName::from_static("{{{nameInLowerCase}}}"), - header::IntoHeaderValue({{name}}).into() + {{name}} ); {{/headers}} {{#produces}} 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 455e60c8be5b..4f224edf40c5 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 @@ -227,6 +227,9 @@ paths: Success-Info: schema: type: String + Bool-Header: + schema: + type: bool Object-Header: schema: $ref: "#/components/schemas/ObjectHeader" diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs index 78d4402ad8c4..ed3ab5d92b72 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/header.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/header.rs index 92eee5d0c255..5bc6ebe929b9 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/header.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/header.rs @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + hdr_value, e)), + } } } 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 e4aba1221cf5..82c937bad8df 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 @@ -8,16 +8,38 @@ use crate::header; // Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<InlineObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<InlineObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<InlineObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <InlineObject 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 InlineObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -111,16 +133,38 @@ impl std::str::FromStr for InlineObject { // Methods for converting between header::IntoHeaderValue<MultipartRelatedRequest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<MultipartRelatedRequest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<MultipartRelatedRequest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<MultipartRelatedRequest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<MultipartRelatedRequest>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRelatedRequest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<MultipartRelatedRequest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRelatedRequest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <MultipartRelatedRequest 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 MultipartRelatedRequest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -223,16 +267,38 @@ impl std::str::FromStr for MultipartRelatedRequest { // Methods for converting between header::IntoHeaderValue<MultipartRequest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<MultipartRequest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<MultipartRequest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<MultipartRequest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<MultipartRequest>) -> std::result::Result<Self, Self::Error> { + 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 MultipartRequest - value: {} is invalid {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRequest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<MultipartRequest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRequest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <MultipartRequest 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 MultipartRequest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -349,16 +415,38 @@ impl std::str::FromStr for MultipartRequest { // Methods for converting between header::IntoHeaderValue<MultipartRequestObjectField> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<MultipartRequestObjectField>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<MultipartRequestObjectField>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<MultipartRequestObjectField>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<MultipartRequestObjectField>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRequestObjectField> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<MultipartRequestObjectField as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRequestObjectField> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <MultipartRequestObjectField 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 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/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index 5eca081cadbb..eb870f1833ec 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 @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs index fb53ab023a10..4e55ac6c63dd 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/client/mod.rs @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/header.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/header.rs index 92eee5d0c255..5bc6ebe929b9 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/header.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/header.rs @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + 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 1f6e445cfee3..7caa4ed9c1e3 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 @@ -8,16 +8,38 @@ use crate::header; // Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<InlineObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<InlineObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<InlineObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <InlineObject 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 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/no-example-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs index 36b8b3329880..3c1062d0f9bc 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/server/mod.rs @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] 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 f147a13b20e5..894bb1537ab6 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 @@ -214,6 +214,11 @@ paths: schema: type: String style: simple + Bool-Header: + explode: false + schema: + type: bool + style: simple Object-Header: explode: false schema: diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs index 4e601555e087..7ed0cb95aacf 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/callbacks.rs @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] @@ -151,9 +153,22 @@ where // Header parameters let param_information = headers.get(HeaderName::from_static("information")); - let param_information = param_information.map(|p| { - header::IntoHeaderValue::<String>::from((*p).clone()).0 - }); + let param_information = match param_information { + Some(v) => match header::IntoHeaderValue::<String>::try_from((*v).clone()) { + Ok(result) => + Some(result.0), + Err(err) => { + return Box::new(future::ok(Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header Information - {}", err))) + .expect("Unable to create Bad Request response for invalid header Information"))); + + }, + }, + None => { + None + } + }; Box::new({ {{ 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 cd7c768a3818..063ec490254d 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 @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; @@ -537,7 +538,13 @@ impl<C, F> Api<C> for Client<F> where // Header parameters request.headers_mut().append( HeaderName::from_static("x-header"), - header::IntoHeaderValue(param_x_header.clone()).into()); + match header::IntoHeaderValue(param_x_header.clone()).try_into() { + Ok(header) => header, + Err(e) => { + return Box::new(future::err(ApiError(format!( + "Invalid header x_header - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }); Box::new(self.client_service.request(request) .map_err(|e| ApiError(format!("No response received: {}", e))) @@ -1396,10 +1403,38 @@ impl<C, F> Api<C> for Client<F> where Some(response_success_info) => response_success_info.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header Success-Info for response 200 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_success_info = match TryInto::<header::IntoHeaderValue<String>>::try_into(response_success_info) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header Success-Info for response 200 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_success_info = response_success_info.0; + + let response_bool_header = match response.headers().get(HeaderName::from_static("bool-header")) { + Some(response_bool_header) => response_bool_header.clone(), + None => return Box::new(future::err(ApiError(String::from("Required response header Bool-Header for response 200 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, + }; + let response_bool_header = match TryInto::<header::IntoHeaderValue<bool>>::try_into(response_bool_header) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header Bool-Header for response 200 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_bool_header = response_bool_header.0; + let response_object_header = match response.headers().get(HeaderName::from_static("object-header")) { Some(response_object_header) => response_object_header.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header Object-Header for response 200 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_object_header = match TryInto::<header::IntoHeaderValue<models::ObjectHeader>>::try_into(response_object_header) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header Object-Header for response 200 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_object_header = response_object_header.0; + let body = response.into_body(); Box::new( body @@ -1417,8 +1452,9 @@ impl<C, F> Api<C> for Client<F> where ResponsesWithHeadersGetResponse::Success { body: body, - success_info: (*Into::<header::IntoHeaderValue<String>>::into(response_success_info)).clone(), - object_header: (*Into::<header::IntoHeaderValue<models::ObjectHeader>>::into(response_object_header)).clone(), + success_info: response_success_info, + bool_header: response_bool_header, + object_header: response_object_header, } }) ) as Box<dyn Future<Item=_, Error=_> + Send> @@ -1428,17 +1464,33 @@ impl<C, F> Api<C> for Client<F> where Some(response_further_info) => response_further_info.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header Further-Info for response 412 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_further_info = match TryInto::<header::IntoHeaderValue<String>>::try_into(response_further_info) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header Further-Info for response 412 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_further_info = response_further_info.0; + let response_failure_info = match response.headers().get(HeaderName::from_static("failure-info")) { Some(response_failure_info) => response_failure_info.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header Failure-Info for response 412 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_failure_info = match TryInto::<header::IntoHeaderValue<String>>::try_into(response_failure_info) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header Failure-Info for response 412 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_failure_info = response_failure_info.0; + let body = response.into_body(); Box::new( future::ok( ResponsesWithHeadersGetResponse::PreconditionFailed { - further_info: (*Into::<header::IntoHeaderValue<String>>::into(response_further_info)).clone(), - failure_info: (*Into::<header::IntoHeaderValue<String>>::into(response_failure_info)).clone(), + further_info: response_further_info, + failure_info: response_failure_info, } ) ) as Box<dyn Future<Item=_, Error=_> + Send> diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/header.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/header.rs index 92eee5d0c255..5bc6ebe929b9 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/header.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/header.rs @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + hdr_value, e)), + } } } 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 7379ce171f39..1f786e6fbfe0 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 @@ -119,6 +119,7 @@ pub enum ResponsesWithHeadersGetResponse { { body: String, success_info: String, + bool_header: bool, object_header: models::ObjectHeader } , 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 19c8a7d633fd..7b2b13b0d47f 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 @@ -8,16 +8,38 @@ use crate::header; // Methods for converting between header::IntoHeaderValue<AnotherXmlArray> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<AnotherXmlArray>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<AnotherXmlArray>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<AnotherXmlArray>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<AnotherXmlArray>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<AnotherXmlArray> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<AnotherXmlArray as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<AnotherXmlArray> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <AnotherXmlArray 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 AnotherXmlArray - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -187,16 +209,38 @@ impl AnotherXmlInner { // Methods for converting between header::IntoHeaderValue<AnotherXmlObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<AnotherXmlObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<AnotherXmlObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<AnotherXmlObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<AnotherXmlObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<AnotherXmlObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<AnotherXmlObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<AnotherXmlObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <AnotherXmlObject 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 AnotherXmlObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -301,16 +345,38 @@ impl AnotherXmlObject { // Methods for converting between header::IntoHeaderValue<DuplicateXmlObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<DuplicateXmlObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<DuplicateXmlObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<DuplicateXmlObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<DuplicateXmlObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<DuplicateXmlObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<DuplicateXmlObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<DuplicateXmlObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <DuplicateXmlObject 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 DuplicateXmlObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -577,16 +643,38 @@ impl Error { // Methods for converting between header::IntoHeaderValue<InlineResponse201> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<InlineResponse201>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<InlineResponse201>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<InlineResponse201>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<InlineResponse201>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineResponse201> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<InlineResponse201 as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineResponse201> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <InlineResponse201 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 InlineResponse201 - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -720,16 +808,38 @@ impl MyId { // Methods for converting between header::IntoHeaderValue<MyIdList> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<MyIdList>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<MyIdList>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<MyIdList>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<MyIdList>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<MyIdList> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<MyIdList as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<MyIdList> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <MyIdList 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 MyIdList - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -835,16 +945,38 @@ impl MyIdList { // Methods for converting between header::IntoHeaderValue<NullableTest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<NullableTest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<NullableTest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<NullableTest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<NullableTest>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<NullableTest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<NullableTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<NullableTest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <NullableTest 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 NullableTest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -999,16 +1131,38 @@ impl NullableTest { // Methods for converting between header::IntoHeaderValue<ObjectHeader> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectHeader>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectHeader>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectHeader>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectHeader>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectHeader> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectHeader as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectHeader> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectHeader 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 ObjectHeader - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1113,16 +1267,38 @@ impl ObjectHeader { // Methods for converting between header::IntoHeaderValue<ObjectParam> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectParam>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectParam>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectParam>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectParam>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectParam> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectParam as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectParam> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectParam 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 ObjectParam - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1227,16 +1403,38 @@ impl ObjectParam { // Methods for converting between header::IntoHeaderValue<ObjectUntypedProps> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectUntypedProps>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectUntypedProps>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectUntypedProps>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectUntypedProps>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectUntypedProps> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectUntypedProps as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectUntypedProps> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectUntypedProps 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 ObjectUntypedProps - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1354,16 +1552,38 @@ impl ObjectUntypedProps { // Methods for converting between header::IntoHeaderValue<ObjectWithArrayOfObjects> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectWithArrayOfObjects>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectWithArrayOfObjects>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectWithArrayOfObjects>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectWithArrayOfObjects>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectWithArrayOfObjects> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectWithArrayOfObjects as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectWithArrayOfObjects> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectWithArrayOfObjects 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 ObjectWithArrayOfObjects - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1778,16 +1998,38 @@ impl UuidObject { // Methods for converting between header::IntoHeaderValue<XmlArray> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<XmlArray>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<XmlArray>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<XmlArray>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<XmlArray>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<XmlArray> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<XmlArray as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<XmlArray> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <XmlArray 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 XmlArray - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1957,16 +2199,38 @@ impl XmlInner { // Methods for converting between header::IntoHeaderValue<XmlObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<XmlObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<XmlObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<XmlObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<XmlObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<XmlObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<XmlObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<XmlObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <XmlObject 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 XmlObject - {}", + 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/src/server/callbacks.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs index f93d34726a78..1d52c326e271 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/callbacks.rs @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; @@ -211,9 +212,20 @@ impl<C, F> CallbackApi<C> for Client<F> where }); // Header parameters - param_information.map(|value| request.headers_mut().append( + match param_information { + Some(param_information) => { + request.headers_mut().append( HeaderName::from_static("information"), - header::IntoHeaderValue(value.clone()).into())); + match header::IntoHeaderValue(param_information.clone()).try_into() { + Ok(header) => header, + Err(e) => { + return Box::new(future::err(ApiError(format!( + "Invalid header information - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }); + }, + None => {} + } Box::new(self.client_service.request(request) .map_err(|e| ApiError(format!("No response received: {}", e))) 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 ce43e9752488..c13904fe0642 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 @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] @@ -365,11 +367,23 @@ where let param_x_header = headers.get(HeaderName::from_static("x-header")); let param_x_header = match param_x_header { - Some(v) => header::IntoHeaderValue::<String>::from((*v).clone()).0, - None => return Box::new(future::ok(Response::builder() + Some(v) => match header::IntoHeaderValue::<String>::try_from((*v).clone()) { + Ok(result) => + result.0, + Err(err) => { + return Box::new(future::ok(Response::builder() .status(StatusCode::BAD_REQUEST) - .body(Body::from("Missing or invalid required header X-Header")) - .expect("Unable to create Bad Request response for missing required header X-Header"))), + .body(Body::from(format!("Invalid header X-Header - {}", err))) + .expect("Unable to create Bad Request response for invalid header X-Header"))); + + }, + }, + None => { + return Box::new(future::ok(Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from("Missing required header X-Header")) + .expect("Unable to create Bad Request response for missing required header X-Header"))); + } }; Box::new({ @@ -920,17 +934,52 @@ where { body, success_info, + bool_header, object_header } => { + let success_info = match header::IntoHeaderValue(success_info).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling success_info header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + + let bool_header = match header::IntoHeaderValue(bool_header).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling bool_header header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + + let object_header = match header::IntoHeaderValue(object_header).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling object_header header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( HeaderName::from_static("success-info"), - header::IntoHeaderValue(success_info).into() + success_info + ); + response.headers_mut().insert( + HeaderName::from_static("bool-header"), + bool_header ); response.headers_mut().insert( HeaderName::from_static("object-header"), - header::IntoHeaderValue(object_header).into() + object_header ); response.headers_mut().insert( CONTENT_TYPE, @@ -945,14 +994,34 @@ where failure_info } => { + let further_info = match header::IntoHeaderValue(further_info).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling further_info header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + + let failure_info = match header::IntoHeaderValue(failure_info).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling failure_info header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + *response.status_mut() = StatusCode::from_u16(412).expect("Unable to turn 412 into a StatusCode"); response.headers_mut().insert( HeaderName::from_static("further-info"), - header::IntoHeaderValue(further_info).into() + further_info ); response.headers_mut().insert( HeaderName::from_static("failure-info"), - header::IntoHeaderValue(failure_info).into() + failure_info ); }, }, diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs index f977f551cd5e..05ee715c58ff 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/header.rs b/samples/server/petstore/rust-server/output/ops-v3/src/header.rs index 92eee5d0c255..5bc6ebe929b9 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/header.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/header.rs @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + hdr_value, e)), + } } } diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs index bffd26a12475..39fc31723784 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index 695d2ffcc250..a6fd7282c342 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; @@ -1358,13 +1359,35 @@ impl<C, F> Api<C> for Client<F> where }); // Header parameters - param_enum_header_string_array.map(|value| request.headers_mut().append( + match param_enum_header_string_array { + Some(param_enum_header_string_array) => { + request.headers_mut().append( HeaderName::from_static("enum_header_string_array"), - header::IntoHeaderValue(value.clone()).into())); + match header::IntoHeaderValue(param_enum_header_string_array.clone()).try_into() { + Ok(header) => header, + Err(e) => { + return Box::new(future::err(ApiError(format!( + "Invalid header enum_header_string_array - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }); + }, + None => {} + } - param_enum_header_string.map(|value| request.headers_mut().append( + match param_enum_header_string { + Some(param_enum_header_string) => { + request.headers_mut().append( HeaderName::from_static("enum_header_string"), - header::IntoHeaderValue(value.clone()).into())); + match header::IntoHeaderValue(param_enum_header_string.clone()).try_into() { + Ok(header) => header, + Err(e) => { + return Box::new(future::err(ApiError(format!( + "Invalid header enum_header_string - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }); + }, + None => {} + } Box::new(self.client_service.request(request) .map_err(|e| ApiError(format!("No response received: {}", e))) @@ -1836,9 +1859,20 @@ impl<C, F> Api<C> for Client<F> where } // Header parameters - param_api_key.map(|value| request.headers_mut().append( + match param_api_key { + Some(param_api_key) => { + request.headers_mut().append( HeaderName::from_static("api_key"), - header::IntoHeaderValue(value.clone()).into())); + match header::IntoHeaderValue(param_api_key.clone()).try_into() { + Ok(header) => header, + Err(e) => { + return Box::new(future::err(ApiError(format!( + "Invalid header api_key - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }); + }, + None => {} + } Box::new(self.client_service.request(request) .map_err(|e| ApiError(format!("No response received: {}", e))) @@ -3431,10 +3465,26 @@ impl<C, F> Api<C> for Client<F> where Some(response_x_rate_limit) => response_x_rate_limit.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header X-Rate-Limit for response 200 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_x_rate_limit = match TryInto::<header::IntoHeaderValue<i32>>::try_into(response_x_rate_limit) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header X-Rate-Limit for response 200 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_x_rate_limit = response_x_rate_limit.0; + let response_x_expires_after = match response.headers().get(HeaderName::from_static("x-expires-after")) { Some(response_x_expires_after) => response_x_expires_after.clone(), None => return Box::new(future::err(ApiError(String::from("Required response header X-Expires-After for response 200 was not found.")))) as Box<dyn Future<Item=_, Error=_> + Send>, }; + let response_x_expires_after = match TryInto::<header::IntoHeaderValue<chrono::DateTime::<chrono::Utc>>>::try_into(response_x_expires_after) { + Ok(value) => value, + Err(e) => { + return Box::new(future::err(ApiError(format!("Invalid response header X-Expires-After for response 200 - {}", e)))) as Box<dyn Future<Item=_, Error=_> + Send>; + }, + }; + let response_x_expires_after = response_x_expires_after.0; + let body = response.into_body(); Box::new( body @@ -3454,8 +3504,8 @@ impl<C, F> Api<C> for Client<F> where LoginUserResponse::SuccessfulOperation { body: body, - x_rate_limit: (*Into::<header::IntoHeaderValue<i32>>::into(response_x_rate_limit)).clone(), - x_expires_after: (*Into::<header::IntoHeaderValue<chrono::DateTime::<chrono::Utc>>>::into(response_x_expires_after)).clone(), + x_rate_limit: response_x_rate_limit, + x_expires_after: response_x_expires_after, } }) ) as Box<dyn Future<Item=_, Error=_> + Send> diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/header.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/header.rs index 92eee5d0c255..5bc6ebe929b9 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/header.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/header.rs @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + hdr_value, e)), + } } } 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 367187cc5fc2..12dd045e2160 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 @@ -8,16 +8,38 @@ use crate::header; // Methods for converting between header::IntoHeaderValue<AdditionalPropertiesClass> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<AdditionalPropertiesClass>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<AdditionalPropertiesClass>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<AdditionalPropertiesClass>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<AdditionalPropertiesClass>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<AdditionalPropertiesClass> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<AdditionalPropertiesClass as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<AdditionalPropertiesClass> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <AdditionalPropertiesClass 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 AdditionalPropertiesClass - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -118,16 +140,38 @@ impl AdditionalPropertiesClass { // Methods for converting between header::IntoHeaderValue<Animal> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Animal>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Animal>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Animal>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Animal>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Animal> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Animal as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Animal> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Animal 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 Animal - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -232,16 +276,38 @@ impl Animal { // Methods for converting between header::IntoHeaderValue<AnimalFarm> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<AnimalFarm>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<AnimalFarm>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<AnimalFarm>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<AnimalFarm>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<AnimalFarm> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<AnimalFarm as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<AnimalFarm> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <AnimalFarm 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 AnimalFarm - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -347,16 +413,38 @@ impl AnimalFarm { // Methods for converting between header::IntoHeaderValue<ApiResponse> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ApiResponse>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ApiResponse>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ApiResponse>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ApiResponse>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ApiResponse> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ApiResponse as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ApiResponse> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ApiResponse 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 ApiResponse - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -478,16 +566,38 @@ impl ApiResponse { // Methods for converting between header::IntoHeaderValue<ArrayOfArrayOfNumberOnly> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ArrayOfArrayOfNumberOnly>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ArrayOfArrayOfNumberOnly>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ArrayOfArrayOfNumberOnly>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ArrayOfArrayOfNumberOnly>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayOfArrayOfNumberOnly> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ArrayOfArrayOfNumberOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayOfArrayOfNumberOnly> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ArrayOfArrayOfNumberOnly 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 ArrayOfArrayOfNumberOnly - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -577,16 +687,38 @@ impl ArrayOfArrayOfNumberOnly { // Methods for converting between header::IntoHeaderValue<ArrayOfNumberOnly> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ArrayOfNumberOnly>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ArrayOfNumberOnly>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ArrayOfNumberOnly>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ArrayOfNumberOnly>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayOfNumberOnly> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ArrayOfNumberOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayOfNumberOnly> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ArrayOfNumberOnly 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 ArrayOfNumberOnly - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -680,16 +812,38 @@ impl ArrayOfNumberOnly { // Methods for converting between header::IntoHeaderValue<ArrayTest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ArrayTest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ArrayTest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ArrayTest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ArrayTest>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayTest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ArrayTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayTest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ArrayTest 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 ArrayTest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -818,16 +972,38 @@ impl ArrayTest { // Methods for converting between header::IntoHeaderValue<Capitalization> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Capitalization>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Capitalization>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Capitalization>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Capitalization>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Capitalization> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Capitalization as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Capitalization> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Capitalization 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 Capitalization - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -992,16 +1168,38 @@ impl Capitalization { // Methods for converting between header::IntoHeaderValue<Cat> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Cat>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Cat>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Cat>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Cat>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Cat> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Cat as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Cat> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Cat 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 Cat - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1120,16 +1318,38 @@ impl Cat { // Methods for converting between header::IntoHeaderValue<CatAllOf> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<CatAllOf>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<CatAllOf>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<CatAllOf>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<CatAllOf>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<CatAllOf> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<CatAllOf as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<CatAllOf> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <CatAllOf 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 CatAllOf - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1223,16 +1443,38 @@ impl CatAllOf { // Methods for converting between header::IntoHeaderValue<Category> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Category>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Category>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Category>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Category>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Category> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Category as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Category> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Category 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 Category - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1342,16 +1584,38 @@ impl Category { // Methods for converting between header::IntoHeaderValue<ClassModel> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ClassModel>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ClassModel>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ClassModel>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ClassModel>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ClassModel> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ClassModel as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ClassModel> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ClassModel 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 ClassModel - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1445,16 +1709,38 @@ impl ClassModel { // Methods for converting between header::IntoHeaderValue<Client> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Client>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Client>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Client>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Client>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Client> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Client as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Client> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Client 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 Client - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1548,16 +1834,38 @@ impl Client { // Methods for converting between header::IntoHeaderValue<Dog> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Dog>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Dog>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Dog>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Dog>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Dog> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Dog as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Dog> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Dog 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 Dog - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1676,16 +1984,38 @@ impl Dog { // Methods for converting between header::IntoHeaderValue<DogAllOf> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<DogAllOf>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<DogAllOf>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<DogAllOf>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<DogAllOf>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<DogAllOf> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<DogAllOf as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<DogAllOf> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <DogAllOf 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 DogAllOf - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1779,16 +2109,38 @@ impl DogAllOf { // Methods for converting between header::IntoHeaderValue<EnumArrays> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<EnumArrays>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<EnumArrays>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<EnumArrays>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<EnumArrays>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<EnumArrays> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<EnumArrays as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<EnumArrays> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <EnumArrays 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 EnumArrays - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -1957,16 +2309,38 @@ impl EnumClass { // Methods for converting between header::IntoHeaderValue<EnumTest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<EnumTest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<EnumTest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<EnumTest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<EnumTest>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<EnumTest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<EnumTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<EnumTest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <EnumTest 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 EnumTest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2113,16 +2487,38 @@ impl EnumTest { // Methods for converting between header::IntoHeaderValue<FormatTest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<FormatTest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<FormatTest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<FormatTest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<FormatTest>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<FormatTest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<FormatTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<FormatTest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <FormatTest 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 FormatTest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2358,16 +2754,38 @@ impl FormatTest { // Methods for converting between header::IntoHeaderValue<HasOnlyReadOnly> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<HasOnlyReadOnly>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<HasOnlyReadOnly>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<HasOnlyReadOnly>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<HasOnlyReadOnly>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<HasOnlyReadOnly> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<HasOnlyReadOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<HasOnlyReadOnly> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <HasOnlyReadOnly 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 HasOnlyReadOnly - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2475,16 +2893,38 @@ impl HasOnlyReadOnly { // Methods for converting between header::IntoHeaderValue<List> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<List>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<List>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<List>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<List>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<List> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<List as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<List> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <List 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 List - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2578,16 +3018,38 @@ impl List { // Methods for converting between header::IntoHeaderValue<MapTest> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<MapTest>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<MapTest>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<MapTest>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<MapTest>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MapTest> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<MapTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<MapTest> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <MapTest 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 MapTest - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2701,16 +3163,38 @@ impl MapTest { // Methods for converting between header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<MixedPropertiesAndAdditionalPropertiesClass as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <MixedPropertiesAndAdditionalPropertiesClass 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 MixedPropertiesAndAdditionalPropertiesClass - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2822,16 +3306,38 @@ impl MixedPropertiesAndAdditionalPropertiesClass { // Methods for converting between header::IntoHeaderValue<Model200Response> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Model200Response>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Model200Response>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Model200Response>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Model200Response>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Model200Response> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Model200Response as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Model200Response> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Model200Response 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 Model200Response - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -2941,16 +3447,38 @@ impl Model200Response { // Methods for converting between header::IntoHeaderValue<ModelReturn> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ModelReturn>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ModelReturn>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ModelReturn>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ModelReturn>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ModelReturn> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ModelReturn as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ModelReturn> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ModelReturn 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 ModelReturn - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -3046,16 +3574,38 @@ impl ModelReturn { // Methods for converting between header::IntoHeaderValue<Name> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Name>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Name>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Name>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Name>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Name> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Name as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Name> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Name 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 Name - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -3189,16 +3739,38 @@ impl Name { // Methods for converting between header::IntoHeaderValue<NumberOnly> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<NumberOnly>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<NumberOnly>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<NumberOnly>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<NumberOnly>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<NumberOnly> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<NumberOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<NumberOnly> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <NumberOnly 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 NumberOnly - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -3292,16 +3864,38 @@ impl NumberOnly { // Methods for converting between header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectContainingObjectWithOnlyAdditionalProperties as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectContainingObjectWithOnlyAdditionalProperties 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 ObjectContainingObjectWithOnlyAdditionalProperties - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -3451,16 +4045,38 @@ impl ObjectWithOnlyAdditionalProperties { // Methods for converting between header::IntoHeaderValue<Order> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Order>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Order>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Order>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Order>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<Order> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Order as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Order> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Order 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 Order - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -3663,16 +4279,38 @@ impl OuterBoolean { // Methods for converting between header::IntoHeaderValue<OuterComposite> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<OuterComposite>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<OuterComposite>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<OuterComposite>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<OuterComposite>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<OuterComposite> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<OuterComposite as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<OuterComposite> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <OuterComposite 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 OuterComposite - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -3934,16 +4572,38 @@ impl OuterString { // Methods for converting between header::IntoHeaderValue<Pet> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Pet>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Pet>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Pet>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Pet>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<Pet> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Pet as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Pet> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Pet 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 Pet - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -4096,16 +4756,38 @@ impl Pet { // Methods for converting between header::IntoHeaderValue<ReadOnlyFirst> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ReadOnlyFirst>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ReadOnlyFirst>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ReadOnlyFirst>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ReadOnlyFirst>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ReadOnlyFirst> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ReadOnlyFirst as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ReadOnlyFirst> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ReadOnlyFirst 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 ReadOnlyFirst - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -4213,16 +4895,38 @@ impl ReadOnlyFirst { // Methods for converting between header::IntoHeaderValue<SpecialModelName> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<SpecialModelName>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<SpecialModelName>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<SpecialModelName>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<SpecialModelName>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<SpecialModelName> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<SpecialModelName as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<SpecialModelName> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <SpecialModelName 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 SpecialModelName - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -4317,16 +5021,38 @@ impl SpecialModelName { // Methods for converting between header::IntoHeaderValue<Tag> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<Tag>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<Tag>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<Tag>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<Tag>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Tag> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<Tag as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Tag> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <Tag 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 Tag - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -4435,16 +5161,38 @@ impl Tag { // Methods for converting between header::IntoHeaderValue<User> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<User>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<User>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<User>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<User>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<User> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<User as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<User> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <User 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 User - {}", + 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/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 55db75689e81..723ac0640032 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 @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] @@ -1026,14 +1028,40 @@ where // Header parameters let param_enum_header_string_array = headers.get(HeaderName::from_static("enum_header_string_array")); - let param_enum_header_string_array = param_enum_header_string_array.map(|p| { - header::IntoHeaderValue::<Vec<String>>::from((*p).clone()).0 - }); + let param_enum_header_string_array = match param_enum_header_string_array { + Some(v) => match header::IntoHeaderValue::<Vec<String>>::try_from((*v).clone()) { + Ok(result) => + Some(result.0), + Err(err) => { + return Box::new(future::ok(Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header enum_header_string_array - {}", err))) + .expect("Unable to create Bad Request response for invalid header enum_header_string_array"))); + + }, + }, + None => { + None + } + }; let param_enum_header_string = headers.get(HeaderName::from_static("enum_header_string")); - let param_enum_header_string = param_enum_header_string.map(|p| { - header::IntoHeaderValue::<String>::from((*p).clone()).0 - }); + let param_enum_header_string = match param_enum_header_string { + Some(v) => match header::IntoHeaderValue::<String>::try_from((*v).clone()) { + Ok(result) => + Some(result.0), + Err(err) => { + return Box::new(future::ok(Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header enum_header_string - {}", err))) + .expect("Unable to create Bad Request response for invalid header enum_header_string"))); + + }, + }, + None => { + None + } + }; // 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::<Vec<_>>(); @@ -1487,9 +1515,22 @@ where // Header parameters let param_api_key = headers.get(HeaderName::from_static("api_key")); - let param_api_key = param_api_key.map(|p| { - header::IntoHeaderValue::<String>::from((*p).clone()).0 - }); + let param_api_key = match param_api_key { + Some(v) => match header::IntoHeaderValue::<String>::try_from((*v).clone()) { + Ok(result) => + Some(result.0), + Err(err) => { + return Box::new(future::ok(Response::builder() + .status(StatusCode::BAD_REQUEST) + .body(Body::from(format!("Invalid header api_key - {}", err))) + .expect("Unable to create Bad Request response for invalid header api_key"))); + + }, + }, + None => { + None + } + }; Box::new({ {{ @@ -2890,14 +2931,34 @@ where x_expires_after } => { + let x_rate_limit = match header::IntoHeaderValue(x_rate_limit).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling x_rate_limit header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + + let x_expires_after = match header::IntoHeaderValue(x_expires_after).try_into() { + Ok(val) => val, + Err(e) => { + return future::ok(Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling x_expires_after header - {}", e))) + .expect("Unable to create Internal Server Error for invalid response header")) + } + }; + *response.status_mut() = StatusCode::from_u16(200).expect("Unable to turn 200 into a StatusCode"); response.headers_mut().insert( HeaderName::from_static("x-rate-limit"), - header::IntoHeaderValue(x_rate_limit).into() + x_rate_limit ); response.headers_mut().insert( HeaderName::from_static("x-expires-after"), - header::IntoHeaderValue(x_expires_after).into() + x_expires_after ); response.headers_mut().insert( CONTENT_TYPE, diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs index 6deeda61b036..7ce4e8ad0ac1 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs @@ -8,6 +8,7 @@ use hyper::{Body, Uri, Response}; use hyper_openssl::HttpsConnector; use serde_json; use std::borrow::Cow; +use std::convert::TryInto; use std::io::{Read, Error, ErrorKind}; use std::error; use std::fmt; diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/header.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/header.rs index 92eee5d0c255..5bc6ebe929b9 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/header.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/header.rs @@ -1,5 +1,6 @@ use chrono::{DateTime, Utc}; use hyper::header::HeaderValue; +use std::convert::TryFrom; use std::fmt; use std::ops::Deref; @@ -19,19 +20,31 @@ impl<T> Deref for IntoHeaderValue<T> { } } -// Derive for each From<T> in hyper::header::HeaderValue +// Derive for each TryFrom<T> in hyper::header::HeaderValue macro_rules! ihv_generate { ($t:ident) => { - impl From<HeaderValue> for IntoHeaderValue<$t> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().parse::<$t>().unwrap()) + impl TryFrom<HeaderValue> for IntoHeaderValue<$t> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse::<$t>() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse {} as a string: {}", + stringify!($t), e)), + }, + Err(e) => Err(format!("Unable to parse header {:?} as a string - {}", + hdr_value, e)), + } } } - impl From<IntoHeaderValue<$t>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<$t>) -> Self { - hdr_value.0.into() + impl TryFrom<IntoHeaderValue<$t>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<$t>) -> Result<Self, Self::Error> { + Ok(hdr_value.0.into()) } } }; @@ -48,52 +61,120 @@ ihv_generate!(i32); // Custom derivations -impl From<HeaderValue> for IntoHeaderValue<Vec<String>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - hdr_value - .to_str() - .unwrap() +// Vec<String> + +impl TryFrom<HeaderValue> for IntoHeaderValue<Vec<String>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue( + hdr_value .split(',') .filter_map(|x| match x.trim() { "" => None, y => Some(y.to_string()), }) - .collect(), - ) + .collect())), + Err(e) => Err(format!("Unable to parse header: {:?} as a string - {}", + hdr_value, e)), + } + } +} + +impl TryFrom<IntoHeaderValue<Vec<String>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<Vec<String>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.join(", ")) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} into a header - {}", + hdr_value, e)) + } + } +} + +// String + +impl TryFrom<HeaderValue> for IntoHeaderValue<String> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value.to_string())), + Err(e) => Err(format!("Unable to convert header {:?} to {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<Vec<String>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<Vec<String>>) -> Self { - HeaderValue::from_str(&hdr_value.0.join(", ")).unwrap() +impl TryFrom<IntoHeaderValue<String>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<String>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<String> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue(hdr_value.to_str().unwrap().to_string()) +// bool +impl TryFrom<HeaderValue> for IntoHeaderValue<bool> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match hdr_value.parse() { + Ok(hdr_value) => Ok(IntoHeaderValue(hdr_value)), + Err(e) => Err(format!("Unable to parse bool from {} - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert {:?} from a header {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<String>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<String>) -> Self { - HeaderValue::from_str(&hdr_value.0).unwrap() +impl TryFrom<IntoHeaderValue<bool>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<bool>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(&hdr_value.0.to_string()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert: {:?} into a header: {}", + hdr_value, e)) + } } } -impl From<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { - fn from(hdr_value: HeaderValue) -> Self { - IntoHeaderValue( - DateTime::parse_from_rfc3339(hdr_value.to_str().unwrap()) - .unwrap() - .with_timezone(&Utc), - ) +// DateTime + +impl TryFrom<HeaderValue> for IntoHeaderValue<DateTime<Utc>> { + type Error = String; + + fn try_from(hdr_value: HeaderValue) -> Result<Self, Self::Error> { + match hdr_value.to_str() { + Ok(hdr_value) => match DateTime::parse_from_rfc3339(hdr_value) { + Ok(date) => Ok(IntoHeaderValue(date.with_timezone(&Utc))), + Err(e) => Err(format!("Unable to parse: {} as date - {}", + hdr_value, e)), + }, + Err(e) => Err(format!("Unable to convert header {:?} to string {}", + hdr_value, e)), + } } } -impl From<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { - fn from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Self { - HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()).unwrap() +impl TryFrom<IntoHeaderValue<DateTime<Utc>>> for HeaderValue { + type Error = String; + + fn try_from(hdr_value: IntoHeaderValue<DateTime<Utc>>) -> Result<Self, Self::Error> { + match HeaderValue::from_str(hdr_value.0.to_rfc3339().as_str()) { + Ok(hdr_value) => Ok(hdr_value), + Err(e) => Err(format!("Unable to convert {:?} to a header: {}", + hdr_value, e)), + } } } 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 58f1a5053527..b8085bcd85a0 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 @@ -8,16 +8,38 @@ use crate::header; // Methods for converting between header::IntoHeaderValue<ANullableContainer> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ANullableContainer>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ANullableContainer>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ANullableContainer>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ANullableContainer>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<ANullableContainer> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ANullableContainer as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ANullableContainer> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ANullableContainer 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 ANullableContainer - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -169,16 +191,38 @@ impl ::std::str::FromStr for AdditionalPropertiesObject { // Methods for converting between header::IntoHeaderValue<AllOfObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<AllOfObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<AllOfObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<AllOfObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<AllOfObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<AllOfObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<AllOfObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<AllOfObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <AllOfObject 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 AllOfObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -278,16 +322,38 @@ impl std::str::FromStr for AllOfObject { // Methods for converting between header::IntoHeaderValue<BaseAllOf> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<BaseAllOf>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<BaseAllOf>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<BaseAllOf>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<BaseAllOf>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<BaseAllOf> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<BaseAllOf as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<BaseAllOf> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <BaseAllOf 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 BaseAllOf - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -374,16 +440,38 @@ impl std::str::FromStr for BaseAllOf { // Methods for converting between header::IntoHeaderValue<GetYamlResponse> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<GetYamlResponse>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<GetYamlResponse>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<GetYamlResponse>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<GetYamlResponse>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<GetYamlResponse> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<GetYamlResponse as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<GetYamlResponse> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <GetYamlResponse 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 GetYamlResponse - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -470,16 +558,38 @@ impl std::str::FromStr for GetYamlResponse { // Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<InlineObject>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<InlineObject>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<InlineObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <InlineObject 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 InlineObject - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -577,16 +687,38 @@ impl std::str::FromStr for InlineObject { // Methods for converting between header::IntoHeaderValue<ObjectOfObjects> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectOfObjects>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectOfObjects>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectOfObjects>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectOfObjects>) -> std::result::Result<Self, Self::Error> { + 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 {}", + hdr_value, e)) + } } } #[cfg(any(feature = "client", feature = "server"))] -impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectOfObjects> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectOfObjects as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectOfObjects> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectOfObjects 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 ObjectOfObjects - {}", + value, err)) + } + }, + std::result::Result::Err(e) => std::result::Result::Err( + format!("Unable to convert header: {:?} to string: {}", + hdr_value, e)) + } } } @@ -668,16 +800,38 @@ impl std::str::FromStr for ObjectOfObjects { // Methods for converting between header::IntoHeaderValue<ObjectOfObjectsInner> and hyper::header::HeaderValue #[cfg(any(feature = "client", feature = "server"))] -impl From<header::IntoHeaderValue<ObjectOfObjectsInner>> for hyper::header::HeaderValue { - fn from(hdr_value: header::IntoHeaderValue<ObjectOfObjectsInner>) -> Self { - hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap() +impl std::convert::TryFrom<header::IntoHeaderValue<ObjectOfObjectsInner>> for hyper::header::HeaderValue { + type Error = String; + + fn try_from(hdr_value: header::IntoHeaderValue<ObjectOfObjectsInner>) -> std::result::Result<Self, Self::Error> { + 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 From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectOfObjectsInner> { - fn from(hdr_value: hyper::header::HeaderValue) -> Self { - header::IntoHeaderValue(<ObjectOfObjectsInner as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap()) +impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectOfObjectsInner> { + type Error = String; + + fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> { + match hdr_value.to_str() { + std::result::Result::Ok(value) => { + match <ObjectOfObjectsInner 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 ObjectOfObjectsInner - {}", + 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/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs index 9dc256aaeca8..69fd7709b91c 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs @@ -5,6 +5,8 @@ use hyper::{Request, Response, Error, StatusCode, Body, HeaderMap}; use hyper::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use log::warn; use serde_json; +#[allow(unused_imports)] +use std::convert::{TryFrom, TryInto}; use std::io; use url::form_urlencoded; #[allow(unused_imports)] From 9e8cc284e0e649b79c8750c8400f86a5e97100e2 Mon Sep 17 00:00:00 2001 From: Vikrant Balyan <vvb@users.noreply.github.com> Date: Thu, 7 May 2020 09:25:55 +0530 Subject: [PATCH 72/78] adds the missing typeMapping for AnyType (#6199) --- .../codegen/languages/CSharpNetCoreClientCodegen.java | 1 + 1 file changed, 1 insertion(+) 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 0dd14c352d0d..3c8d8a3e33d0 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 @@ -138,6 +138,7 @@ public CSharpNetCoreClientCodegen() { typeMapping.put("object", "Object"); typeMapping.put("UUID", "Guid"); typeMapping.put("URI", "string"); + typeMapping.put("AnyType", "Object"); setSupportNullable(Boolean.TRUE); hideGenerationTimestamp = Boolean.TRUE; From adb6bf9d81896191a626c9bf64aeb58b152c5078 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 7 May 2020 13:43:18 +0800 Subject: [PATCH 73/78] comment out dart2 test due to failure --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 07808e990fa6..c82dd738b9d5 100644 --- a/pom.xml +++ b/pom.xml @@ -1392,7 +1392,7 @@ <module>samples/openapi3/client/petstore/ruby</module> <!-- test java-related projects --> <module>samples/openapi3/client/petstore/scala-akka</module> - <module>samples/client/petstore/dart2/petstore</module> + <!--<module>samples/client/petstore/dart2/petstore</module>--> <module>samples/client/petstore/dart-jaguar/openapi</module> <module>samples/client/petstore/dart-jaguar/flutter_petstore/openapi</module> <module>samples/client/petstore/scala-httpclient</module> From 3bfd6de32723e23e8200c14f6522ebfbc6fd5486 Mon Sep 17 00:00:00 2001 From: Alofredo <4416140+alfredotg@users.noreply.github.com> Date: Thu, 7 May 2020 09:05:29 +0300 Subject: [PATCH 74/78] [cpp][Qt5] Add the ability to pass QNetworkAccessManager as a parameter (#6053) * [C++][Qt5] Add the ability to pass QNetworkAccessManager as a parameter * connect to QNetworkReply::finished instead of QNetworkAccessManager::finished * [C++][Qt5] regen samples for cpp-qt5-client * [C++][Qt5] disconect from reply by timeout * [C++][Qt5] regen samples for cpp-qt5-client Co-authored-by: alfredotg <alfredotg@tu.ru> --- .../cpp-qt5-client/HttpRequest.cpp.mustache | 27 ++++++++++++------- .../cpp-qt5-client/HttpRequest.h.mustache | 8 +++--- .../cpp-qt5-client/api-body.mustache | 7 ++++- .../cpp-qt5-client/api-header.mustache | 3 +++ .../cpp-qt5/client/PFXHttpRequest.cpp | 27 ++++++++++++------- .../petstore/cpp-qt5/client/PFXHttpRequest.h | 8 +++--- .../petstore/cpp-qt5/client/PFXPetApi.cpp | 21 +++++++++------ .../petstore/cpp-qt5/client/PFXPetApi.h | 3 +++ .../petstore/cpp-qt5/client/PFXStoreApi.cpp | 13 ++++++--- .../petstore/cpp-qt5/client/PFXStoreApi.h | 3 +++ .../petstore/cpp-qt5/client/PFXUserApi.cpp | 21 +++++++++------ .../petstore/cpp-qt5/client/PFXUserApi.h | 3 +++ 12 files changed, 95 insertions(+), 49 deletions(-) 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 6ec3d67bcae3..57692b69d8a7 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 @@ -44,12 +44,13 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f files.append(file); } -{{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent) - : QObject(parent), manager(nullptr), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { +{{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) + : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { qsrand(QDateTime::currentDateTime().toTime_t()); - manager = new QNetworkAccessManager(this); + if (manager == nullptr) { + manager = new QNetworkAccessManager(this); + } workingDirectory = QDir::currentPath(); - connect(manager, &QNetworkAccessManager::finished, this, &{{prefix}}HttpRequestWorker::on_manager_finished); timeOutTimer.setSingleShot(true); } @@ -347,7 +348,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { reply = manager->deleteResource(request); } else { #if (QT_VERSION >= 0x050800) - manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); #else QBuffer *buffer = new QBuffer; buffer->setData(request_content); @@ -357,13 +358,21 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { buffer->setParent(reply); #endif } + if (reply != nullptr) { + reply->setParent(this); + connect(reply, &QNetworkReply::finished, [this, reply] { + on_reply_finished(reply); + }); + } if (timeOutTimer.interval() > 0) { - QObject::connect(&timeOutTimer, &QTimer::timeout, [=]() { on_manager_timeout(reply); }); + QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] { + on_reply_timeout(reply); + }); timeOutTimer.start(); } } -void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { +void {{prefix}}HttpRequestWorker::on_reply_finished(QNetworkReply *reply) { bool codeSts = false; if(timeOutTimer.isActive()) { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); @@ -387,11 +396,11 @@ void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } -void {{prefix}}HttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { +void {{prefix}}HttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { error_type = QNetworkReply::TimeoutError; response = ""; error_str = "Timed out waiting for response"; - disconnect(manager, nullptr, nullptr, nullptr); + disconnect(reply, nullptr, nullptr, nullptr); reply->abort(); reply->deleteLater(); emit on_execution_finished(this); 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 efd352568855..e04b1eeb187b 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 @@ -50,7 +50,7 @@ class {{prefix}}HttpRequestWorker : public QObject { Q_OBJECT public: - explicit {{prefix}}HttpRequestWorker(QObject *parent = nullptr); + explicit {{prefix}}HttpRequestWorker(QObject *parent = nullptr, QNetworkAccessManager *manager = nullptr); virtual ~{{prefix}}HttpRequestWorker(); QByteArray response; @@ -87,13 +87,11 @@ private: bool isRequestCompressionEnabled; int httpResponseCode; - void on_manager_timeout(QNetworkReply *reply); + void on_reply_timeout(QNetworkReply *reply); + void on_reply_finished(QNetworkReply *reply); void process_response(QNetworkReply *reply); QByteArray decompress(const QByteArray& data); QByteArray compress(const QByteArray& input, int level, {{prefix}}CompressionType compressType); - -private slots: - void on_manager_finished(QNetworkReply *reply); }; {{#cppNamespaceDeclarations}} 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 ac4dbb88c097..b08cd6a90657 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 @@ -15,6 +15,7 @@ namespace {{this}} { _port(port), _basePath(basePath), _timeOut(timeOut), + _manager(nullptr), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false) {} @@ -45,6 +46,10 @@ void {{classname}}::setWorkingDirectory(const QString &path) { _workingDirectory = path; } +void {{classname}}::setNetworkAccessManager(QNetworkAccessManager* manager) { + _manager = manager; +} + void {{classname}}::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } @@ -120,7 +125,7 @@ void {{classname}}::{{nickname}}({{#allParams}}const {{{dataType}}} &{{paramName } } {{/collectionFormat}}{{/queryParams}} - {{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(this); + {{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory);{{#contentCompression}} worker->setResponseCompressionEnabled(isResponseCompressionEnabled); diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache index 2768c2ee561f..475987181609 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache @@ -8,6 +8,7 @@ {{/imports}} #include <QObject> +#include <QNetworkAccessManager> {{#cppNamespaceDeclarations}} namespace {{this}} { @@ -26,6 +27,7 @@ public: void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); + void setNetworkAccessManager(QNetworkAccessManager* manager); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); @@ -39,6 +41,7 @@ private: QString _basePath; int _timeOut; QString _workingDirectory; + QNetworkAccessManager* _manager; QMap<QString, QString> defaultHeaders; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp index 746bd57086f6..e92c99f4f02a 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp @@ -51,12 +51,13 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename files.append(file); } -PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent) - : QObject(parent), manager(nullptr), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { +PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) + : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { qsrand(QDateTime::currentDateTime().toTime_t()); - manager = new QNetworkAccessManager(this); + if (manager == nullptr) { + manager = new QNetworkAccessManager(this); + } workingDirectory = QDir::currentPath(); - connect(manager, &QNetworkAccessManager::finished, this, &PFXHttpRequestWorker::on_manager_finished); timeOutTimer.setSingleShot(true); } @@ -354,7 +355,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { reply = manager->deleteResource(request); } else { #if (QT_VERSION >= 0x050800) - manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), request_content); #else QBuffer *buffer = new QBuffer; buffer->setData(request_content); @@ -364,13 +365,21 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { buffer->setParent(reply); #endif } + if (reply != nullptr) { + reply->setParent(this); + connect(reply, &QNetworkReply::finished, [this, reply] { + on_reply_finished(reply); + }); + } if (timeOutTimer.interval() > 0) { - QObject::connect(&timeOutTimer, &QTimer::timeout, [=]() { on_manager_timeout(reply); }); + QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] { + on_reply_timeout(reply); + }); timeOutTimer.start(); } } -void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { +void PFXHttpRequestWorker::on_reply_finished(QNetworkReply *reply) { bool codeSts = false; if(timeOutTimer.isActive()) { QObject::disconnect(&timeOutTimer, &QTimer::timeout, nullptr, nullptr); @@ -394,11 +403,11 @@ void PFXHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } -void PFXHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { +void PFXHttpRequestWorker::on_reply_timeout(QNetworkReply *reply) { error_type = QNetworkReply::TimeoutError; response = ""; error_str = "Timed out waiting for response"; - disconnect(manager, nullptr, nullptr, nullptr); + disconnect(reply, nullptr, nullptr, nullptr); reply->abort(); reply->deleteLater(); emit on_execution_finished(this); diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h index aa5743be304c..2b1f1afe07c3 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h @@ -58,7 +58,7 @@ class PFXHttpRequestWorker : public QObject { Q_OBJECT public: - explicit PFXHttpRequestWorker(QObject *parent = nullptr); + explicit PFXHttpRequestWorker(QObject *parent = nullptr, QNetworkAccessManager *manager = nullptr); virtual ~PFXHttpRequestWorker(); QByteArray response; @@ -95,13 +95,11 @@ class PFXHttpRequestWorker : public QObject { bool isRequestCompressionEnabled; int httpResponseCode; - void on_manager_timeout(QNetworkReply *reply); + void on_reply_timeout(QNetworkReply *reply); + void on_reply_finished(QNetworkReply *reply); void process_response(QNetworkReply *reply); QByteArray decompress(const QByteArray& data); QByteArray compress(const QByteArray& input, int level, PFXCompressionType compressType); - -private slots: - void on_manager_finished(QNetworkReply *reply); }; } // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp index 0d293c27d743..cb50dee94b22 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.cpp @@ -23,6 +23,7 @@ PFXPetApi::PFXPetApi(const QString &scheme, const QString &host, int port, const _port(port), _basePath(basePath), _timeOut(timeOut), + _manager(nullptr), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false) {} @@ -53,6 +54,10 @@ void PFXPetApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } +void PFXPetApi::setNetworkAccessManager(QNetworkAccessManager* manager) { + _manager = manager; +} + void PFXPetApi::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } @@ -77,7 +82,7 @@ void PFXPetApi::addPet(const PFXPet &body) { .arg(_basePath) .arg("/pet"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); @@ -125,7 +130,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const QString &api_key) { pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); @@ -209,7 +214,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) { } } - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -299,7 +304,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) { } } - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -354,7 +359,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) { pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -397,7 +402,7 @@ void PFXPetApi::updatePet(const PFXPet &body) { .arg(_basePath) .arg("/pet"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "PUT"); @@ -445,7 +450,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QString &name, con pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); @@ -492,7 +497,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const QString &additional_metad pet_idPathParam.append("petId").append("}"); fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(pet_id))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); diff --git a/samples/client/petstore/cpp-qt5/client/PFXPetApi.h b/samples/client/petstore/cpp-qt5/client/PFXPetApi.h index 6ea632eb49d3..aa85e82e34e9 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXPetApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXPetApi.h @@ -20,6 +20,7 @@ #include <QString> #include <QObject> +#include <QNetworkAccessManager> namespace test_namespace { @@ -36,6 +37,7 @@ class PFXPetApi : public QObject { void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); + void setNetworkAccessManager(QNetworkAccessManager* manager); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); @@ -56,6 +58,7 @@ class PFXPetApi : public QObject { QString _basePath; int _timeOut; QString _workingDirectory; + QNetworkAccessManager* _manager; QMap<QString, QString> defaultHeaders; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; diff --git a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp index 7b9b770c96d9..d56512f61127 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.cpp @@ -23,6 +23,7 @@ PFXStoreApi::PFXStoreApi(const QString &scheme, const QString &host, int port, c _port(port), _basePath(basePath), _timeOut(timeOut), + _manager(nullptr), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false) {} @@ -53,6 +54,10 @@ void PFXStoreApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } +void PFXStoreApi::setNetworkAccessManager(QNetworkAccessManager* manager) { + _manager = manager; +} + void PFXStoreApi::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } @@ -80,7 +85,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) { order_idPathParam.append("orderId").append("}"); fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); @@ -122,7 +127,7 @@ void PFXStoreApi::getInventory() { .arg(_basePath) .arg("/store/inventory"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -177,7 +182,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) { order_idPathParam.append("orderId").append("}"); fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(order_id))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -220,7 +225,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &body) { .arg(_basePath) .arg("/store/order"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); diff --git a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h index fc5e44d75bd5..238338cd9c20 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXStoreApi.h @@ -19,6 +19,7 @@ #include <QString> #include <QObject> +#include <QNetworkAccessManager> namespace test_namespace { @@ -35,6 +36,7 @@ class PFXStoreApi : public QObject { void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); + void setNetworkAccessManager(QNetworkAccessManager* manager); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); @@ -51,6 +53,7 @@ class PFXStoreApi : public QObject { QString _basePath; int _timeOut; QString _workingDirectory; + QNetworkAccessManager* _manager; QMap<QString, QString> defaultHeaders; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; diff --git a/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp index a372b73dbcbb..74060393b01f 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.cpp @@ -23,6 +23,7 @@ PFXUserApi::PFXUserApi(const QString &scheme, const QString &host, int port, con _port(port), _basePath(basePath), _timeOut(timeOut), + _manager(nullptr), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false) {} @@ -53,6 +54,10 @@ void PFXUserApi::setWorkingDirectory(const QString &path) { _workingDirectory = path; } +void PFXUserApi::setNetworkAccessManager(QNetworkAccessManager* manager) { + _manager = manager; +} + void PFXUserApi::addHeaders(const QString &key, const QString &value) { defaultHeaders.insert(key, value); } @@ -77,7 +82,7 @@ void PFXUserApi::createUser(const PFXUser &body) { .arg(_basePath) .arg("/user"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); @@ -122,7 +127,7 @@ void PFXUserApi::createUsersWithArrayInput(const QList<PFXUser> &body) { .arg(_basePath) .arg("/user/createWithArray"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); @@ -168,7 +173,7 @@ void PFXUserApi::createUsersWithListInput(const QList<PFXUser> &body) { .arg(_basePath) .arg("/user/createWithList"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "POST"); @@ -217,7 +222,7 @@ void PFXUserApi::deleteUser(const QString &username) { usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "DELETE"); @@ -262,7 +267,7 @@ void PFXUserApi::getUserByName(const QString &username) { usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -317,7 +322,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("password")).append("=").append(QUrl::toPercentEncoding(::test_namespace::toStringValue(password))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -361,7 +366,7 @@ void PFXUserApi::logoutUser() { .arg(_basePath) .arg("/user/logout"); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "GET"); @@ -406,7 +411,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { usernamePathParam.append("username").append("}"); fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::test_namespace::toStringValue(username))); - PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this); + PFXHttpRequestWorker *worker = new PFXHttpRequestWorker(this, _manager); worker->setTimeOut(_timeOut); worker->setWorkingDirectory(_workingDirectory); PFXHttpRequestInput input(fullPath, "PUT"); diff --git a/samples/client/petstore/cpp-qt5/client/PFXUserApi.h b/samples/client/petstore/cpp-qt5/client/PFXUserApi.h index da5cb3225744..e2698e5d1a2e 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXUserApi.h +++ b/samples/client/petstore/cpp-qt5/client/PFXUserApi.h @@ -19,6 +19,7 @@ #include <QString> #include <QObject> +#include <QNetworkAccessManager> namespace test_namespace { @@ -35,6 +36,7 @@ class PFXUserApi : public QObject { void setBasePath(const QString &basePath); void setTimeOut(const int timeOut); void setWorkingDirectory(const QString &path); + void setNetworkAccessManager(QNetworkAccessManager* manager); void addHeaders(const QString &key, const QString &value); void enableRequestCompression(); void enableResponseCompression(); @@ -55,6 +57,7 @@ class PFXUserApi : public QObject { QString _basePath; int _timeOut; QString _workingDirectory; + QNetworkAccessManager* _manager; QMap<QString, QString> defaultHeaders; bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; From fa8c9908bebe0357c0b1c057da76268b69a96ee2 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 7 May 2020 16:41:24 +0800 Subject: [PATCH 75/78] Minor fixes post-release (#6204) * minor fixes post release * update gradle version * comment out rust server test --- modules/openapi-generator-gradle-plugin/README.adoc | 2 +- modules/openapi-generator-gradle-plugin/build.gradle | 2 +- modules/openapi-generator-gradle-plugin/pom.xml | 2 +- .../samples/local-spec/gradle.properties | 2 +- .../samples/local-spec/gradle/wrapper/gradle-wrapper.properties | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index abbeacab2657..9a3702e5a412 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -84,7 +84,7 @@ buildscript { // url "https://plugins.gradle.org/m2/" } dependencies { - classpath "org.openapitools:openapi-generator-gradle-plugin:4.2.3" + classpath "org.openapitools:openapi-generator-gradle-plugin:4.3.1" } } diff --git a/modules/openapi-generator-gradle-plugin/build.gradle b/modules/openapi-generator-gradle-plugin/build.gradle index b35ecef36116..2db50f96d3e7 100644 --- a/modules/openapi-generator-gradle-plugin/build.gradle +++ b/modules/openapi-generator-gradle-plugin/build.gradle @@ -16,7 +16,7 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "gradle.plugin.org.gradle.kotlin:gradle-kotlin-dsl-plugins:1.1.3" - classpath "com.gradle.publish:plugin-publish-plugin:0.10.1" + classpath "com.gradle.publish:plugin-publish-plugin:0.11.0" classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.20.0" classpath "de.marcphilipp.gradle:nexus-publish-plugin:0.2.0" } diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index 50472a7859f8..004badbb4261 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -17,7 +17,7 @@ <properties> <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo> - <gradleVersion>5.2.1</gradleVersion> + <gradleVersion>5.6.4</gradleVersion> </properties> <pluginRepositories> 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 3f93f62a6aa6..f3b443b6b0c2 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=4.3.1-SNAPSHOT +openApiGeneratorVersion=5.0.0-SNAPSHOT # /RELEASE_VERSION diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties index 44e7c4d1d7bb..5028f28f8e47 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/pom.xml b/pom.xml index c82dd738b9d5..3b9566d819e5 100644 --- a/pom.xml +++ b/pom.xml @@ -1237,7 +1237,7 @@ <module>samples/server/petstore/python-flask-python2</module> <module>samples/server/petstore/php-slim</module> <module>samples/server/petstore/php-slim4</module> - <module>samples/server/petstore/rust-server</module> + <!--<module>samples/server/petstore/rust-server</module>--> <!-- clients --> <module>samples/client/petstore/bash</module> <module>samples/client/petstore/c</module> From 7800dbe35ac8227af64a969b14bc020e3d369f2c Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 7 May 2020 20:45:14 +0800 Subject: [PATCH 76/78] remove pubspec.lock (#6208) --- pom.xml | 2 +- .../petstore/dart2/petstore/pubspec.lock | 355 ------------------ 2 files changed, 1 insertion(+), 356 deletions(-) delete mode 100644 samples/client/petstore/dart2/petstore/pubspec.lock diff --git a/pom.xml b/pom.xml index 3b9566d819e5..802cea465a98 100644 --- a/pom.xml +++ b/pom.xml @@ -1392,7 +1392,7 @@ <module>samples/openapi3/client/petstore/ruby</module> <!-- test java-related projects --> <module>samples/openapi3/client/petstore/scala-akka</module> - <!--<module>samples/client/petstore/dart2/petstore</module>--> + <module>samples/client/petstore/dart2/petstore</module> <module>samples/client/petstore/dart-jaguar/openapi</module> <module>samples/client/petstore/dart-jaguar/flutter_petstore/openapi</module> <module>samples/client/petstore/scala-httpclient</module> diff --git a/samples/client/petstore/dart2/petstore/pubspec.lock b/samples/client/petstore/dart2/petstore/pubspec.lock deleted file mode 100644 index 78daa43da5d9..000000000000 --- a/samples/client/petstore/dart2/petstore/pubspec.lock +++ /dev/null @@ -1,355 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "0.38.4" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" - collection: - dependency: "direct dev" - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.14.12" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.16.1" - front_end: - dependency: transitive - description: - name: front_end - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.26" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.7" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.0+2" - http: - dependency: "direct dev" - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.0+2" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.3" - io: - dependency: transitive - description: - name: io - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.3" - js: - dependency: transitive - description: - name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.1+1" - kernel: - dependency: transitive - description: - name: kernel - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.26" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.5" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.7" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.6+3" - mockito: - dependency: "direct dev" - description: - name: mockito - url: "https://pub.dartlang.org" - source: hosted - version: "4.1.1" - multi_server_socket: - dependency: transitive - description: - name: multi_server_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - node_preamble: - dependency: transitive - description: - name: node_preamble - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.8" - openapi: - dependency: "direct main" - description: - path: "../petstore_client_lib" - relative: true - source: path - version: "1.0.0" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - package_resolver: - dependency: transitive - description: - name: package_resolver - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.10" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.0" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.2" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.5" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - shelf_static: - dependency: transitive - description: - name: shelf_static - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.8" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.3" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.5" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.8" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.5" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.3" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.5" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - test: - dependency: "direct dev" - description: - name: test - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.8" - test_core: - dependency: transitive - description: - name: test_core - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.10" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.6" - vm_service: - dependency: transitive - description: - name: vm_service - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.7+12" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.15" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0" -sdks: - dart: ">=2.5.0 <3.0.0" From 5f2270a0e8626ddd3e04bfa0ab646c53f44c58c6 Mon Sep 17 00:00:00 2001 From: adg-mh <40580891+adg-mh@users.noreply.github.com> Date: Thu, 7 May 2020 08:09:55 -0500 Subject: [PATCH 77/78] Add missing AnyType type mapping (#6196) Without the AnyType type mapping, the generated dart code uses `AnyType` instead of `Object`, which does not compile. --- .../org/openapitools/codegen/languages/DartDioClientCodegen.java | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 5e7b0b77f3aa..9c06fb029b7a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -89,6 +89,7 @@ public DartDioClientCodegen() { typeMapping.put("file", "Uint8List"); typeMapping.put("binary", "Uint8List"); + typeMapping.put("AnyType", "Object"); importMapping.put("BuiltList", "package:built_collection/built_collection.dart"); importMapping.put("BuiltMap", "package:built_collection/built_collection.dart"); From 13f329eafed016880a623801a55736e99dd60a63 Mon Sep 17 00:00:00 2001 From: Ghufz <18732053+Ghufz@users.noreply.github.com> Date: Thu, 7 May 2020 20:16:40 +0530 Subject: [PATCH 78/78] [powershell-experimental] : http signature authentication implementation (#6176) * ValidatePattern having double quote(") throws exception on running Build.ps1 * fix tab with space * [powershell-experimental] : http signature auth * fix the tab issue Co-authored-by: Ghufran Zahidi <gzahidi@cisco.com> --- .../PowerShellExperimentalClientCodegen.java | 6 +- .../api_client.mustache | 15 + .../http_signature_auth.mustache | 162 ++++++++ .../rsa_provider.mustache | 377 ++++++++++++++++++ 4 files changed, 559 insertions(+), 1 deletion(-) create mode 100644 modules/openapi-generator/src/main/resources/powershell-experimental/http_signature_auth.mustache create mode 100644 modules/openapi-generator/src/main/resources/powershell-experimental/rsa_provider.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java index 5896ee99efea..3151617e438b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellExperimentalClientCodegen.java @@ -615,6 +615,9 @@ public void processOpts() { supportingFiles.add(new SupportingFile("api_client.mustache", infrastructureFolder + "Private", apiNamePrefix + "ApiClient.ps1")); supportingFiles.add(new SupportingFile("Get-CommonParameters.mustache", infrastructureFolder + File.separator + "Private" + File.separator, "Get-CommonParameters.ps1")); supportingFiles.add(new SupportingFile("Out-DebugParameter.mustache", infrastructureFolder + File.separator + "Private" + File.separator, "Out-DebugParameter.ps1")); + supportingFiles.add(new SupportingFile("http_signature_auth.mustache", infrastructureFolder + "Private", apiNamePrefix + "HttpSignatureAuth.ps1")); + supportingFiles.add(new SupportingFile("rsa_provider.mustache", infrastructureFolder + "Private", apiNamePrefix + "RSAEncryptionProvider.cs")); + // en-US supportingFiles.add(new SupportingFile("about_Org.OpenAPITools.help.txt.mustache", infrastructureFolder + File.separator + "en-US" + File.separator + "about_" + packageName + ".help.txt")); @@ -626,7 +629,7 @@ public void processOpts() { @SuppressWarnings("static-method") @Override public String escapeText(String input) { - + if (input == null) { return input; } @@ -643,6 +646,7 @@ public String escapeText(String input) { .replaceAll("[\\t\\n\\r]", " ") .replace("\\", "\\\\") .replace("\"", "\"\"")); + } @Override diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/api_client.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/api_client.mustache index 2d785b840d1e..c6a456c481ec 100644 --- a/modules/openapi-generator/src/main/resources/powershell-experimental/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/api_client.mustache @@ -89,6 +89,21 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { $RequestBody = $Body } +# http signature authentication + if ($null -ne $Configuration['ApiKey'] -and $Configuration['ApiKey'].Count -gt 0) { + $httpSignHeaderArgument = @{ + Method = $Method + UriBuilder = $UriBuilder + Body = $Body + } + $signedHeader = Get-{{{apiNamePrefix}}}HttpSignedHeader @httpSignHeaderArgument + if($null -ne $signedHeader -and $signedHeader.Count -gt 0){ + foreach($item in $signedHeader.GetEnumerator()){ + $HeaderParameters[$item.Name] = $item.Value + } + } + } + if ($SkipCertificateCheck -eq $true) { $Response = Invoke-WebRequest -Uri $UriBuilder.Uri ` -Method $Method ` diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/http_signature_auth.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/http_signature_auth.mustache new file mode 100644 index 000000000000..aeb74be678dc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/http_signature_auth.mustache @@ -0,0 +1,162 @@ +{{>partial_header}} +<# +.SYNOPSIS +Get the API key Id and API key file path. + +.DESCRIPTION +Get the API key Id and API key file path. If no api prefix is provided then it use default api key prefix 'Signature' +.OUTPUTS +PSCustomObject : This contains APIKeyId, APIKeyFilePath, APIKeyPrefix +#> +function Get-{{{apiNamePrefix}}}APIKeyInfo { + $ApiKeysList = $Script:Configuration['ApiKey'] + $ApiKeyPrefixList = $Script:Configuration['ApiKeyPrefix'] + $apiPrefix = "Signature" + + if ($null -eq $ApiKeysList -or $ApiKeysList.Count -eq 0) { + throw "Unable to reterieve the api key details" + } + + if ($null -eq $ApiKeyPrefixList -or $ApiKeyPrefixList.Count -eq 0) { + Write-Verbose "Unable to reterieve the api key prefix details,setting it to default ""Signature""" + } + + foreach ($item in $ApiKeysList.GetEnumerator()) { + if (![string]::IsNullOrEmpty($item.Name)) { + if (Test-Path -Path $item.Value) { + $apiKey = $item.Value + $apikeyId = $item.Name + break; + } + else { + throw "API key file path does not exist." + } + } + } + + if ($ApiKeyPrefixList.ContainsKey($apikeyId)) { + $apiPrefix = ApiKeyPrefixList[$apikeyId] + } + + if ($apikeyId -and $apiKey -and $apiPrefix) { + $result = New-Object -Type PSCustomObject -Property @{ + ApiKeyId = $apikeyId; + ApiKeyFilePath = $apiKey + ApiKeyPrefix = $apiPrefix + } + } + else { + return $null + } + return $result +} + +<# +.SYNOPSIS + Gets the headers for http signed auth. + +.DESCRIPTION + Gets the headers for the http signed auth. It use (targetpath), date, host and body digest to create authorization header. +.PARAMETER Method + Http method +.PARAMETER UriBuilder + UriBuilder for url and query parameter +.PARAMETER Body + Request body +.OUTPUTS + Hashtable +#> +function Get-{{{apiNamePrefix}}}HttpSignedHeader { + param( + [string]$Method, + [System.UriBuilder]$UriBuilder, + [string]$Body + ) + + #Hash table to store singed headers + $HttpSignedHeader = @{} + $TargetHost = $UriBuilder.Host + + #Check for Authentication type + $apiKeyInfo = Get-{{{apiNamePrefix}}}APIKeyInfo + if ($null -eq $apiKeyInfo) { + throw "Unable to reterieve the api key info " + } + + #get the body digest + $bodyHash = Get-{{{apiNamePrefix}}}StringHash -String $Body + $Digest = [String]::Format("SHA-256={0}", [Convert]::ToBase64String($bodyHash)) + + #get the date in UTC + $dateTime = Get-Date + $currentDate = $dateTime.ToUniversalTime().ToString("r") + + $requestTargetPath = [string]::Format("{0} {1}{2}",$Method.ToLower(),$UriBuilder.Path.ToLower(),$UriBuilder.Query) + $h_requestTarget = [string]::Format("(request-target): {0}",$requestTargetPath) + $h_cdate = [string]::Format("date: {0}",$currentDate) + $h_digest = [string]::Format("digest: {0}",$Digest) + $h_targetHost = [string]::Format("host: {0}",$TargetHost) + + $stringToSign = [String]::Format("{0}`n{1}`n{2}`n{3}", + $h_requestTarget,$h_cdate, + $h_targetHost,$h_digest) + + $hashedString = Get-{{{apiNamePrefix}}}StringHash -String $stringToSign + $signedHeader = Get-{{{apiNamePrefix}}}RSASHA256SignedString -APIKeyFilePath $apiKeyInfo.ApiKeyFilePath -DataToSign $hashedString + $authorizationHeader = [string]::Format("{0} keyId=""{1}"",algorithm=""rsa-sha256"",headers=""(request-target) date host digest"",signature=""{2}""", + $apiKeyInfo.ApiKeyPrefix, $apiKeyInfo.ApiKeyId, $signedHeader) + + $HttpSignedHeader["Date"] = $currentDate + $HttpSignedHeader["Host"] = $TargetHost + $HttpSignedHeader["Content-Type"] = "application/json" + $HttpSignedHeader["Digest"] = $Digest + $HttpSignedHeader["Authorization"] = $authorizationHeader + return $HttpSignedHeader +} + +<# +.SYNOPSIS + Gets the headers for http signed auth. + +.DESCRIPTION + Gets the headers for the http signed auth. It use (targetpath), date, host and body digest to create authorization header. +.PARAMETER APIKeyFilePath + Specify the API key file path +.PARAMETER DataToSign + Specify the data to sign +.OUTPUTS + String +#> +function Get-{{{apiNamePrefix}}}RSASHA256SignedString { + Param( + [string]$APIKeyFilePath, + [byte[]]$DataToSign + ) + try { + + $rsa_provider_path = Join-Path -Path $PSScriptRoot -ChildPath "{{{apiNamePrefix}}}RSAEncryptionProvider.cs" + $rsa_provider_sourceCode = Get-Content -Path $rsa_provider_path -Raw + Add-Type -TypeDefinition $rsa_provider_sourceCode + $signed_string = [RSAEncryption.RSAEncryptionProvider]::GetRSASignb64encode($APIKeyFilePath, $DataToSign) + if ($null -eq $signed_string) { + throw "Unable to sign the header using the API key" + } + return $signed_string + } + catch { + throw $_ + } +} +<# +.Synopsis + Gets the hash of string. +.Description + Gets the hash of string +.Outputs +String +#> +Function Get-{{{apiNamePrefix}}}StringHash([String] $String, $HashName = "SHA256") { + + $hashAlogrithm = [System.Security.Cryptography.HashAlgorithm]::Create($HashName) + $hashAlogrithm.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String)) +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/powershell-experimental/rsa_provider.mustache b/modules/openapi-generator/src/main/resources/powershell-experimental/rsa_provider.mustache new file mode 100644 index 000000000000..a23490b366e4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/powershell-experimental/rsa_provider.mustache @@ -0,0 +1,377 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; + +namespace RSAEncryption +{ + public class RSAEncryptionProvider + { + + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + const String pempubheader = "-----BEGIN PUBLIC KEY-----"; + const String pempubfooter = "-----END PUBLIC KEY-----"; + const String pemp8header = "-----BEGIN PRIVATE KEY-----"; + const String pemp8footer = "-----END PRIVATE KEY-----"; + const String pemp8encheader = "-----BEGIN ENCRYPTED PRIVATE KEY-----"; + const String pemp8encfooter = "-----END ENCRYPTED PRIVATE KEY-----"; + public static RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) + { + byte[] MODULUS, E, D, P, Q, DP, DQ, IQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + return null; + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + return null; + bt = binr.ReadByte(); + if (bt != 0x00) + return null; + + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + MODULUS = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + E = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + D = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + P = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + Q = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + IQ = binr.ReadBytes(elems); + + /*Console.WriteLine("showing components .."); + if (true) + { + showBytes("\nModulus", MODULUS); + showBytes("\nExponent", E); + showBytes("\nD", D); + showBytes("\nP", P); + showBytes("\nQ", Q); + showBytes("\nDP", DP); + showBytes("\nDQ", DQ); + showBytes("\nIQ", IQ); + }*/ + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = MODULUS; + RSAparams.Exponent = E; + RSAparams.D = D; + RSAparams.P = P; + RSAparams.Q = Q; + RSAparams.DP = DP; + RSAparams.DQ = DQ; + RSAparams.InverseQ = IQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally { binr.Close(); } + } + + private static int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + return 0; + bt = binr.ReadByte(); + + if (bt == 0x81) + count = binr.ReadByte(); // data size in next byte + else + if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + { + count = bt; // we already have the data size + } + while (binr.ReadByte() == 0x00) + { //remove high order zeros in data + count -= 1; + } + binr.BaseStream.Seek(-1, SeekOrigin.Current); + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + static byte[] DecodeOpenSSLPrivateKey(String instr) + { + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + String pemstr = instr.Trim(); + byte[] binkey; + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + return null; + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); //remove headers/footers, if present + sb.Replace(pemprivfooter, ""); + + String pvkstr = sb.ToString().Trim(); //get string after removing leading/trailing whitespace + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (System.FormatException) + { //if can't b64 decode, it must be an encrypted private key + //Console.WriteLine("Not an unencrypted OpenSSL PEM private key"); + } + + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) + return null; + String saltline = str.ReadLine(); + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + return null; + String saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + if (!(str.ReadLine() == "")) + return null; + + //------ remaining b64 data is encrypted RSA key ---- + String encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (System.FormatException) + { // bad b64 data. + return null; + } + + //------ Get the 3DES 24 byte key using PDK used by OpenSSL ---- + + SecureString despswd = GetSecPswd("Enter password to derive 3DES key==>"); + //Console.Write("\nEnter password to derive 3DES key: "); + //String pswd = Console.ReadLine(); + byte[] deskey = GetOpenSSL3deskey(salt, despswd, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + return null; + //showBytes("3DES key", deskey) ; + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + if (rsakey != null) + return rsakey; //we have a decrypted RSA private key + else + { + Console.WriteLine("Failed to decrypt RSA private key; probably wrong password."); + return null; + } + } + + static byte[] GetOpenSSL3deskey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store contatenated Mi hashed results + + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + //UTF8Encoding utf8 = new UTF8Encoding(); + //byte[] psbytes = utf8.GetBytes(pswd); + + // --- contatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and contatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = new MD5CryptoServiceProvider(); + byte[] result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + result = data00; //initialize + else + { + Array.Copy(result, hashtarget, result.Length); + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + //Console.WriteLine("Updated new initial hash target:") ; + //showBytes(result) ; + } + + for (int i = 0; i < count; i++) + result = md5.ComputeHash(result); + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //contatenate to keymaterial + } + //showBytes("Final key material", keymaterial); + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result, 0, result.Length); + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + + return deskey; + } + + public static string GetRSASignb64encode(string private_key_path, byte[] digest) + { + RSACryptoServiceProvider cipher = new RSACryptoServiceProvider(); + cipher = GetRSAProviderFromPemFile(private_key_path); + RSAPKCS1SignatureFormatter RSAFormatter = new RSAPKCS1SignatureFormatter(cipher); + RSAFormatter.SetHashAlgorithm("SHA256"); + byte[] signedHash = RSAFormatter.CreateSignature(digest); + return Convert.ToBase64String(signedHash); + } + + public static RSACryptoServiceProvider GetRSAProviderFromPemFile(String pemfile) + { + bool isPrivateKeyFile = true; + if (!File.Exists(pemfile)) + { + throw new Exception("pemfile does not exist."); + } + string pemstr = File.ReadAllText(pemfile).Trim(); + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + isPrivateKeyFile = false; + + byte[] pemkey = null; + if (isPrivateKeyFile) + pemkey = DecodeOpenSSLPrivateKey(pemstr); + + + if (pemkey == null) + return null; + + if (isPrivateKeyFile) + { + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + static byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception exc) + { + Console.WriteLine(exc.Message); + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + static SecureString GetSecPswd(String prompt) + { + SecureString password = new SecureString(); + + Console.ForegroundColor = ConsoleColor.Gray; + Console.ForegroundColor = ConsoleColor.Magenta; + + while (true) + { + ConsoleKeyInfo cki = Console.ReadKey(true); + if (cki.Key == ConsoleKey.Enter) + { + Console.ForegroundColor = ConsoleColor.Gray; + return password; + } + else if (cki.Key == ConsoleKey.Backspace) + { + // remove the last asterisk from the screen... + if (password.Length > 0) + { + Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop); + Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop); + password.RemoveAt(password.Length - 1); + } + } + else if (cki.Key == ConsoleKey.Escape) + { + Console.ForegroundColor = ConsoleColor.Gray; + return password; + } + else if (Char.IsLetterOrDigit(cki.KeyChar) || Char.IsSymbol(cki.KeyChar)) + { + if (password.Length < 20) + { + password.AppendChar(cki.KeyChar); + } + else + { + Console.Beep(); + } + } + else + { + Console.Beep(); + } + } + } + } +}