diff --git a/README.md b/README.md index e3658844c93f..32e3c99e535c 100644 --- a/README.md +++ b/README.md @@ -77,9 +77,9 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se | | Languages/Frameworks | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0), **C++** (cpp-restsdk, Qt5, Tizen), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (rust, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 8.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, Rxjs) | +| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0), **C++** (cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) | | **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) | -| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc** | +| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** | | **Configuration files** | [**Apache2**](https://httpd.apache.org/) | | **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer** | @@ -450,10 +450,10 @@ To get a list of PHP specified options (which can be passed to the generator wit You can build a client against the [Petstore API](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml) as follows: ```sh -./bin/java-petstore-okhttp-gson.sh +./bin/generate-samples.sh ./bin/configs/java-okhttp-gson.yaml ``` -(On Windows, run `.\bin\windows\java-petstore-okhttp-gson.bat` instead) +(On Windows, please install [GIT Bash for Windows](https://gitforwindows.org/) to run the command above) This script uses the default library, which is `okhttp-gson`. It will run the generator with this command: @@ -461,6 +461,8 @@ This script uses the default library, which is `okhttp-gson`. It will run the ge 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/3_0/petstore.yaml \ -g java \ + -t modules/openapi-generator/src/main/resources/Java \ + --additional-properties artifactId=petstore-okhttp-gson,hideGenerationTimestamp:true \ -o samples/client/petstore/java/okhttp-gson ``` @@ -526,13 +528,7 @@ cd samples/client/petstore/java/okhttp-gson mvn package ``` -Other languages have petstore samples, too: - -- [Swift5](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/swift5) -- [Ruby](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/ruby) -- [Kotlin](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/kotlin) - -... and more. +Other generators have [samples](https://github.com/OpenAPITools/openapi-generator/tree/master/samples) too. ### [3.1 - Customization](#table-of-contents) @@ -808,6 +804,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2020-10-31 - [[B2] OpenAPI Specification으로 타입-세이프하게 API 개발하기: 희망편 VS 절망편](https://www.youtube.com/watch?v=J4JHLESAiFk) by 최태건 at [FEConf 2020](https://2020.feconf.kr/) - 2020-11-05 - [Automated REST-Api Code Generation: Wie IT-Systeme miteinander sprechen](https://www.massiveart.com/blog/automated-rest-api-code-generation-wie-it-systeme-miteinander-sprechen) by Stefan Rottensteiner at [MASSIVE ART Blog](https://www.massiveart.com/blog) - 2020-12-01 - [OpenAPI GeneratorでGoのAPIサーバー/クライアントコードを自動生成する](https://qiita.com/saki-engineering/items/b20d8b6074c4da9664a5) by [@saki-engineering](https://qiita.com/saki-engineering) +- 2020-12-04 - [Scaling the Test Coverage of OpenAPI Generator for 30+ Programming Languages](https://www.youtube.com/watch?v=7Lke9dHRqT0) by [William Cheng](https://github.com/wing328) at [Open Source Summit Japan + Automotive Linux Summit 2020](https://events.linuxfoundation.org/archive/2020/open-source-summit-japan/) ([Slides](https://speakerdeck.com/wing328/scaling-the-test-coverage-of-openapi-generator-for-30-plus-programming-languages)) - 2020-12-09 - [プロジェクトにOpenAPI Generatorで自動生成された型付きAPI Clientを導入した話](https://qiita.com/yoshifujiT/items/905c18700ede23f40840) by [@yoshifujiT](https://github.com/yoshifujiT) - 2020-12-15 - [Next.js + NestJS + GraphQLで変化に追従するフロントエンドへ 〜 ショッピングクーポンの事例紹介](https://techblog.yahoo.co.jp/entry/2020121530052952/) by [小倉 陸](https://github.com/ogugu9) at [Yahoo! JAPAN Tech Blog](https://techblog.yahoo.co.jp/) - 2021-01-08 - [Hello, New API – Part 1](https://www.nginx.com/blog/hello-new-api-part-1/) by [Jeremy Schulman](https://www.nginx.com/people/jeremy-schulman/) at [Major League Baseball](https://www.mlb.com) diff --git a/bin/configs/other/java-vertx-web.yaml b/bin/configs/java-vertx-web-server.yaml similarity index 100% rename from bin/configs/other/java-vertx-web.yaml rename to bin/configs/java-vertx-web-server.yaml diff --git a/bin/configs/typescript-nestjs-v6-provided-in-root.yaml b/bin/configs/typescript-nestjs-v6-provided-in-root.yaml index 4fb999ef170c..d5ca0d524312 100644 --- a/bin/configs/typescript-nestjs-v6-provided-in-root.yaml +++ b/bin/configs/typescript-nestjs-v6-provided-in-root.yaml @@ -1,6 +1,7 @@ generatorName: typescript-nestjs outputDir: samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml +templateDir: modules/openapi-generator/src/main/resources/typescript-nestjs additionalProperties: nestVersion: 6.0.0 "npmName": "@openapitools/typescript-nestjs-petstore" diff --git a/bin/utils/test_file_list.yaml b/bin/utils/test_file_list.yaml index 3d7cf02ace57..d2d65e328f99 100644 --- a/bin/utils/test_file_list.yaml +++ b/bin/utils/test_file_list.yaml @@ -1,6 +1,6 @@ --- # csharp-netcore test files and image for upload - filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs" - sha256: b74ef9eefa4b41fd3233e083fe2355babf25a77f9073d28e1aa81ae2e0a5f1d0 + sha256: aceebba316148a2a803a15ef4e13bbd0b0a1b8d15006cd88adb9b39a620ee451 - filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png" sha256: 0a67c32728197e942b13bdda064b73793f12f5c795f1e5cf35a3adf69c973230 diff --git a/docs/configuration.md b/docs/configuration.md index 1fa33922ce8d..aa7d1b5c9b23 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -21,7 +21,7 @@ Our tooling supports the following types of configuration: ## Tool-specific Declarations -The READMEs for the [CLI](https://openapi-generator.tech/docs/usage#generate), [Gradle Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin), [Maven Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin), and [SBT Plugin](https://github.com/OpenAPITools/sbt-openapi-generator/blob/master/README.md) may have top-level or tooling specific options which appear to duplicate 'config options' or 'global properties'. Each may also expose user-facing properties slightly differently from the other tools. This may occur due to: +The READMEs for the [CLI](https://openapi-generator.tech/docs/usage#generate), [Gradle Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin), [Maven Plugin](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin), and [SBT Plugin](https://github.com/OpenAPITools/sbt-openapi-generator/blob/master/README.md) may have top-level or tooling specific options which appear to duplicate 'config options' or 'global properties'. Each may also expose user-facing properties slightly differently from the other tools. This may occur due to: * Conventions used by the underlying tooling * Limitations in underlying frameworks which define how properties must be declared diff --git a/docs/generators.md b/docs/generators.md index 1b2aa656bfb3..6b4406e43ac3 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -94,7 +94,7 @@ The following generators are available: * [java-pkmst](generators/java-pkmst.md) * [java-play-framework](generators/java-play-framework.md) * [java-undertow-server](generators/java-undertow-server.md) -* [java-vertx](generators/java-vertx.md) +* [java-vertx (deprecated)](generators/java-vertx.md) * [java-vertx-web (beta)](generators/java-vertx-web.md) * [jaxrs-cxf](generators/jaxrs-cxf.md) * [jaxrs-cxf-cdi](generators/jaxrs-cxf-cdi.md) diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index 755e95f1932b..ffff1394c42e 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -41,8 +41,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | -|array|List| -|map|Map| ## LANGUAGE PRIMITIVES diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md index b2afa28babe6..3ecb03d5221a 100644 --- a/docs/generators/dart-jaguar.md +++ b/docs/generators/dart-jaguar.md @@ -36,8 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | -|array|List| -|map|Map| ## LANGUAGE PRIMITIVES diff --git a/docs/generators/dart.md b/docs/generators/dart.md index 395295b07e6a..e7dae224efc3 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -34,8 +34,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Instantiated By | | ---------- | --------------- | -|array|List| -|map|Map| ## LANGUAGE PRIMITIVES diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md index 58852a97ccf4..ecaf99a294f2 100644 --- a/docs/generators/kotlin-server.md +++ b/docs/generators/kotlin-server.md @@ -32,8 +32,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Imports | | ---------- | ------- | |BigDecimal|java.math.BigDecimal| -|Date|java.util.Date| -|DateTime|java.time.LocalDateTime| +|Date|java.time.LocalDate| +|DateTime|java.time.OffsetDateTime| |File|java.io.File| |LocalDate|java.time.LocalDate| |LocalDateTime|java.time.LocalDateTime| diff --git a/docs/generators/kotlin-vertx.md b/docs/generators/kotlin-vertx.md index 56539f00d46e..f92dadaf520a 100644 --- a/docs/generators/kotlin-vertx.md +++ b/docs/generators/kotlin-vertx.md @@ -26,8 +26,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Imports | | ---------- | ------- | |BigDecimal|java.math.BigDecimal| -|Date|java.util.Date| -|DateTime|java.time.LocalDateTime| +|Date|java.time.LocalDate| +|DateTime|java.time.OffsetDateTime| |File|java.io.File| |LocalDate|java.time.LocalDate| |LocalDateTime|java.time.LocalDateTime| diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md index cdf4968400b2..ef76c9af691b 100644 --- a/docs/generators/kotlin.md +++ b/docs/generators/kotlin.md @@ -34,8 +34,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Imports | | ---------- | ------- | |BigDecimal|java.math.BigDecimal| -|Date|java.util.Date| -|DateTime|java.time.LocalDateTime| +|Date|java.time.LocalDate| +|DateTime|java.time.OffsetDateTime| |File|java.io.File| |LocalDate|java.time.LocalDate| |LocalDateTime|java.time.LocalDateTime| diff --git a/docs/generators/ktorm-schema.md b/docs/generators/ktorm-schema.md index 4f65a1ecc81f..7a45b88b69a3 100644 --- a/docs/generators/ktorm-schema.md +++ b/docs/generators/ktorm-schema.md @@ -27,8 +27,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Type/Alias | Imports | | ---------- | ------- | |BigDecimal|java.math.BigDecimal| -|Date|java.util.Date| -|DateTime|java.time.LocalDateTime| +|Date|java.time.LocalDate| +|DateTime|java.time.OffsetDateTime| |File|java.io.File| |LocalDate|java.time.LocalDate| |LocalDateTime|java.time.LocalDateTime| diff --git a/modules/openapi-generator-gradle-plugin/gradle.properties b/modules/openapi-generator-gradle-plugin/gradle.properties index 841286618809..c8b120972626 100644 --- a/modules/openapi-generator-gradle-plugin/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/gradle.properties @@ -1,6 +1,5 @@ # RELEASE_VERSION openApiGeneratorVersion=5.1.0-SNAPSHOT ->>>>>>> origin/master # /RELEASE_VERSION # BEGIN placeholders diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index 32c7c3cff45a..79152024e3e3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -153,7 +153,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co typeMapping.put("ByteArray", "kotlin.ByteArray"); typeMapping.put("number", "java.math.BigDecimal"); typeMapping.put("decimal", "java.math.BigDecimal"); - typeMapping.put("date-time", "java.time.LocalDateTime"); + typeMapping.put("date-time", "java.time.OffsetDateTime"); typeMapping.put("date", "java.time.LocalDate"); typeMapping.put("file", "java.io.File"); typeMapping.put("array", "kotlin.Array"); @@ -163,7 +163,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co typeMapping.put("object", "kotlin.Any"); typeMapping.put("binary", "kotlin.ByteArray"); typeMapping.put("Date", "java.time.LocalDate"); - typeMapping.put("DateTime", "java.time.LocalDateTime"); + typeMapping.put("DateTime", "java.time.OffsetDateTime"); instantiationTypes.put("array", "kotlin.collections.ArrayList"); instantiationTypes.put("list", "kotlin.collections.ArrayList"); @@ -174,9 +174,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co importMapping.put("UUID", "java.util.UUID"); importMapping.put("URI", "java.net.URI"); importMapping.put("File", "java.io.File"); - importMapping.put("Date", "java.util.Date"); + importMapping.put("Date", "java.time.LocalDate"); importMapping.put("Timestamp", "java.sql.Timestamp"); - importMapping.put("DateTime", "java.time.LocalDateTime"); + importMapping.put("DateTime", "java.time.OffsetDateTime"); importMapping.put("LocalDateTime", "java.time.LocalDateTime"); importMapping.put("LocalDate", "java.time.LocalDate"); importMapping.put("LocalTime", "java.time.LocalTime"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 987110760d41..91b1f05dddb1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -141,14 +141,13 @@ public class DartClientCodegen extends DefaultCodegen { "double", "dynamic" ); - instantiationTypes.put("array", "List"); - instantiationTypes.put("map", "Map"); typeMapping = new HashMap<>(); typeMapping.put("Array", "List"); typeMapping.put("array", "List"); typeMapping.put("map", "Map"); typeMapping.put("List", "List"); + typeMapping.put("set", "Set"); typeMapping.put("boolean", "bool"); typeMapping.put("string", "String"); typeMapping.put("char", "String"); @@ -468,9 +467,10 @@ public class DartClientCodegen extends DefaultCodegen { @Override public String toDefaultValue(Schema schema) { - if (ModelUtils.isMapSchema(schema)) { + if (ModelUtils.isMapSchema(schema) || ModelUtils.isSet(schema)) { return "const {}"; - } else if (ModelUtils.isArraySchema(schema)) { + } + if (ModelUtils.isArraySchema(schema)) { return "const []"; } @@ -494,7 +494,8 @@ public class DartClientCodegen extends DefaultCodegen { if (ModelUtils.isArraySchema(target)) { Schema items = getSchemaItems((ArraySchema) schema); return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">"; - } else if (ModelUtils.isMapSchema(target)) { + } + if (ModelUtils.isMapSchema(target)) { // Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines // additionalproperties: true Schema inner = getAdditionalProperties(target); 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 582402c22518..66be8bc41847 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 @@ -127,6 +127,9 @@ public class DartDioClientCodegen extends DartClientCodegen { public String toDefaultValue(Schema schema) { if (schema.getDefault() != null) { if (ModelUtils.isArraySchema(schema)) { + if (ModelUtils.isSet(schema)) { + return "SetBuilder()"; + } return "ListBuilder()"; } if (ModelUtils.isMapSchema(schema)) { @@ -318,6 +321,7 @@ public class DartDioClientCodegen extends DartClientCodegen { if (param.isContainer) { final Map serializer = new HashMap<>(); serializer.put("isArray", param.isArray); + serializer.put("uniqueItems", param.uniqueItems); serializer.put("isMap", param.isMap); serializer.put("baseType", param.baseType); serializers.add(serializer); @@ -347,7 +351,8 @@ public class DartDioClientCodegen extends DartClientCodegen { if (op.returnContainer != null) { final Map serializer = new HashMap<>(); - serializer.put("isArray", Objects.equals("array", op.returnContainer)); + serializer.put("isArray", Objects.equals("array", op.returnContainer) || Objects.equals("set", op.returnContainer)); + serializer.put("uniqueItems", op.uniqueItems); serializer.put("isMap", Objects.equals("map", op.returnContainer)); serializer.put("baseType", op.returnBaseType); serializers.add(serializer); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java index fe44c4e9babb..d38f05ecfc67 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaVertXServerCodegen.java @@ -24,9 +24,14 @@ import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.servers.Server; import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.utils.URLPathUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.File; import java.net.URL; import java.util.List; @@ -37,6 +42,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class JavaVertXServerCodegen extends AbstractJavaCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(JavaVertXServerCodegen.class); protected String resourceFolder = "src/main/resources"; protected String rootPackage = "org.openapitools.server.api"; @@ -61,6 +67,10 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen { modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.DEPRECATED) + .build(); + // set the output folder here outputFolder = "generated-code" + File.separator + "javaVertXServer"; @@ -134,6 +144,8 @@ public class JavaVertXServerCodegen extends AbstractJavaCodegen { public void processOpts() { super.processOpts(); + LOGGER.warn("IMPORTANT: This generator has been deprecated. Please use `java-vertx-web` instead"); + apiTestTemplateFiles.clear(); importMapping.remove("JsonCreator"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index 909c1f59cf20..29f2bc72c8a3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -125,17 +125,9 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen typeMapping.put("array", "kotlin.collections.List"); typeMapping.put("list", "kotlin.collections.List"); - typeMapping.put("date", "java.time.LocalDate"); - typeMapping.put("date-time", "java.time.OffsetDateTime"); - typeMapping.put("Date", "java.time.LocalDate"); - typeMapping.put("DateTime", "java.time.OffsetDateTime"); - // use resource for file handling typeMapping.put("file", "org.springframework.core.io.Resource"); - importMapping.put("Date", "java.time.LocalDate"); - importMapping.put("DateTime", "java.time.OffsetDateTime"); - addOption(TITLE, "server title name or client service name", title); addOption(BASE_PACKAGE, "base package (invokerPackage) for generated code", basePackage); addOption(SERVER_PORT, "configuration the port in which the sever is to run on", serverPort); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index d99f278244e4..74a1b796dcde 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -330,16 +330,16 @@ {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} ${java.version} ${java.version} - 1.8.4 - 1.5.24 - 3.14.7 + 1.8.5 + 1.6.2 + 4.9.1 2.8.6 - 3.10 + 3.11 {{#joda}} - 2.9.9 + 2.10.9 {{/joda}} {{#threetenbp}} - 1.4.3 + 1.5.0 {{/threetenbp}} 1.3.2 4.13.1 diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache index c1d025d7f03c..1b5571eff727 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache @@ -472,6 +472,19 @@ namespace {{packageName}}.Client response = client.Execute(req); } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof({{{packageName}}}.{{modelPackage}}.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + T instance = (T)Activator.CreateInstance(typeof(T)); + MethodInfo method = typeof(T).GetMethod("FromJson"); + method.Invoke(instance, new object[] { response.Content }); + response.Data = instance; + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + InterceptResponse(req, response); var result = ToApiResponse(response); @@ -583,6 +596,10 @@ namespace {{packageName}}.Client method.Invoke(instance, new object[] { response.Content }); response.Data = instance; } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } InterceptResponse(req, response); 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 dcfedc065ed1..95dc66a46e1f 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api.mustache @@ -11,10 +11,12 @@ import 'package:built_value/serializer.dart'; {{/fullImports}} class {{classname}} { - final Dio _dio; - Serializers _serializers; - {{classname}}(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const {{classname}}(this._dio, this._serializers); {{#operation}} /// {{{summary}}} @@ -69,7 +71,7 @@ class {{classname}} { {{#isContainer}} {{#isArray}} - const type = FullType(BuiltList, [FullType({{baseType}})]); + const type = FullType(Built{{#uniqueItems}}Built{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}, [FullType({{baseType}})]); final serializedBody = _serializers.serialize({{paramName}}, specifiedType: type); {{/isArray}} {{#isMap}} @@ -135,8 +137,7 @@ class {{classname}} { {{/returnTypeIsPrimitive}} {{/returnSimpleType}} {{^returnSimpleType}} - const collectionType = {{#isMap}}BuiltMap{{/isMap}}{{^isMap}}BuiltList{{/isMap}}; - const type = FullType(collectionType, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{returnBaseType}}})]); + const type = FullType(Built{{#isMap}}Map{{/isMap}}{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{returnBaseType}}})]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -149,6 +150,7 @@ class {{classname}} { return Response<{{{returnType}}}>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, 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 645a5fe7877f..62f2bfc06bcc 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/apilib.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/apilib.mustache @@ -10,31 +10,37 @@ import 'package:{{pubName}}/auth/oauth.dart'; {{#apiInfo}}{{#apis}}import 'package:{{pubName}}/api/{{classFilename}}.dart'; {{/apis}}{{/apiInfo}} -final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; +final _defaultInterceptors = [ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor(), +]; class {{clientName}} { - Dio dio; - Serializers serializers; - String basePath = '{{{basePath}}}'; + static const String basePath = r'{{{basePath}}}'; - {{clientName}}({this.dio, Serializers serializers, String basePathOverride, List interceptors}) { - if (dio == null) { - BaseOptions options = new BaseOptions( + final Dio dio; + + final Serializers serializers; + + {{clientName}}({ + Dio dio, + Serializers serializers, + String basePathOverride, + List interceptors, + }) : this.serializers = serializers ?? standardSerializers, + this.dio = dio ?? + Dio(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; + )) { + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } } void setOAuthToken(String name, String token) { diff --git a/modules/openapi-generator/src/main/resources/dart-dio/local_date_serializer.mustache b/modules/openapi-generator/src/main/resources/dart-dio/local_date_serializer.mustache index 31440035f4a4..68cfd5e31c68 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/local_date_serializer.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/local_date_serializer.mustache @@ -4,6 +4,9 @@ import 'package:built_value/serializer.dart'; import 'package:time_machine/time_machine.dart'; class OffsetDateSerializer implements PrimitiveSerializer { + + const OffsetDateSerializer(); + @override Iterable get types => BuiltList([OffsetDate]); @@ -25,6 +28,9 @@ class OffsetDateSerializer implements PrimitiveSerializer { } class OffsetDateTimeSerializer implements PrimitiveSerializer { + + const OffsetDateTimeSerializer(); + @override Iterable get types => BuiltList([OffsetDateTime]); 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 eb73bd7453a3..4697d00c3231 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/serializers.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/serializers.mustache @@ -18,16 +18,16 @@ part 'serializers.g.dart'; Serializers serializers = (_$serializers.toBuilder(){{#apiInfo}}{{#apis}}{{#serializers}} ..addBuilderFactory( {{#isArray}} - const FullType(BuiltList, [FullType({{baseType}})]), - () => ListBuilder<{{baseType}}>(), + const FullType(Built{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}, [FullType({{baseType}})]), + () => {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}Builder<{{baseType}}>(), {{/isArray}} {{#isMap}} const FullType(BuiltMap, [FullType(String), FullType({{baseType}})]), () => MapBuilder(), {{/isMap}} ){{/serializers}}{{/apis}}{{/apiInfo}}{{#timeMachine}} - ..add(OffsetDateSerializer()) - ..add(OffsetDateTimeSerializer()){{/timeMachine}} + ..add(const OffsetDateSerializer()) + ..add(const OffsetDateTimeSerializer()){{/timeMachine}} ..add(Iso8601DateTimeSerializer())) .build(); diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache index 716118fa428f..cc0bba98b468 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -187,8 +187,8 @@ class {{{classname}}} { if (response.body != null && response.statusCode != HttpStatus.noContent) { {{#isArray}} return (apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}') as List) - .map((item) => item as {{{returnBaseType}}}) - .toList(growable: false); + .cast<{{{returnBaseType}}}>() + .{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}}; {{/isArray}} {{^isArray}} {{#isMap}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index 44af2418ca9d..e289a31b63a4 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -194,6 +194,12 @@ class ApiClient { .map((v) => _deserialize(v, newTargetType, growable: growable)) .toList(growable: true == growable); } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toSet(); + } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { final newTargetType = match[1]; return Map.fromIterables( diff --git a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache index 7502f877acdd..5329912c5a2a 100644 --- a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache @@ -26,6 +26,7 @@ const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); final _regMap = RegExp(r'^Map$'); ApiClient defaultApiClient = ApiClient(); diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache index 5376a17691b9..834200b592c0 100644 --- a/modules/openapi-generator/src/main/resources/dart2/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -156,7 +156,7 @@ class {{{classname}}} { {{^isEnum}} {{{name}}}: json[r'{{{baseName}}}'] == null ? null - : (json[r'{{{baseName}}}'] as List).cast<{{{items.datatype}}}>(), + : (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>(), {{/isEnum}} {{/isArray}} {{^isArray}} diff --git a/modules/openapi-generator/src/main/resources/go/signing.mustache b/modules/openapi-generator/src/main/resources/go/signing.mustache index db486a16b207..22477a06f382 100644 --- a/modules/openapi-generator/src/main/resources/go/signing.mustache +++ b/modules/openapi-generator/src/main/resources/go/signing.mustache @@ -116,6 +116,11 @@ type HttpSignatureAuth struct { privateKey crypto.PrivateKey // The private key used to sign HTTP requests. } +// SetPrivateKey accepts a private key string and sets it. +func (h *HttpSignatureAuth) SetPrivateKey(privateKey string) error { + return h.parsePrivateKey([]byte(privateKey)) +} + // ContextWithValue validates the HttpSignatureAuth configuration parameters and returns a context // suitable for HTTP signature. An error is returned if the HttpSignatureAuth configuration parameters // are invalid. @@ -123,7 +128,7 @@ func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Conte if h.KeyId == "" { return nil, fmt.Errorf("Key ID must be specified") } - if h.PrivateKeyPath == "" { + if h.PrivateKeyPath == "" && h.privateKey == nil { return nil, fmt.Errorf("Private key path must be specified") } if _, ok := supportedSigningSchemes[h.SigningScheme]; !ok { @@ -168,7 +173,11 @@ func (h *HttpSignatureAuth) GetPublicKey() (crypto.PublicKey, error) { } // loadPrivateKey reads the private key from the file specified in the HttpSignatureAuth. +// The key is loaded only when privateKey is not already set. func (h *HttpSignatureAuth) loadPrivateKey() (err error) { + if h.privateKey != nil { + return nil + } var file *os.File file, err = os.Open(h.PrivateKeyPath) if err != nil { @@ -182,12 +191,18 @@ func (h *HttpSignatureAuth) loadPrivateKey() (err error) { if err != nil { return err } + return h.parsePrivateKey(priv) +} + +// parsePrivateKey decodes privateKey byte array to crypto.PrivateKey type. +func (h *HttpSignatureAuth) parsePrivateKey(priv []byte) error { pemBlock, _ := pem.Decode(priv) if pemBlock == nil { // No PEM data has been found. return fmt.Errorf("File '%s' does not contain PEM data", h.PrivateKeyPath) } var privKey []byte + var err error if x509.IsEncryptedPEMBlock(pemBlock) { // The PEM data is encrypted. privKey, err = x509.DecryptPEMBlock(pemBlock, []byte(h.Passphrase)) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache index 7ccd50796773..3074614db75b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache @@ -2,7 +2,6 @@ package {{packageName}}.infrastructure {{#moshi}} import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter {{^moshiCodeGen}} import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory {{/moshiCodeGen}} @@ -36,7 +35,6 @@ import java.util.Date {{#moshi}} @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) @@ -54,7 +52,6 @@ import java.util.Date {{#gson}} @JvmStatic val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) diff --git a/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache b/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache index 14f96341ead4..c892573091e6 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api_doc.mustache @@ -23,8 +23,6 @@ Method | HTTP request | Description ### Example ```powershell -Import-Module -Name {{{packageName}}} - {{#hasAuthMethods}} # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache index 2f698db3feca..9ab0a8408997 100644 --- a/modules/openapi-generator/src/main/resources/python/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache @@ -163,6 +163,7 @@ conf = {{{packageName}}}.Configuration( def __init__(self, host=None, api_key=None, api_key_prefix=None, + access_token=None, username=None, password=None, discard_unknown_keys=False, disabled_client_side_validations="", @@ -190,6 +191,7 @@ conf = {{{packageName}}}.Configuration( """Temp file folder for downloading files """ # Authentication Settings + self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key @@ -218,18 +220,6 @@ conf = {{{packageName}}}.Configuration( """The HTTP signing configuration """ {{/hasHttpSignatureMethods}} -{{#hasOAuthMethods}} - self.access_token = None - """access token for OAuth/Bearer - """ -{{/hasOAuthMethods}} -{{^hasOAuthMethods}} -{{#hasBearerMethods}} - self.access_token = None - """access token for OAuth/Bearer - """ -{{/hasBearerMethods}} -{{/hasOAuthMethods}} self.logger = {} """Logging Settings """ diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache index 54a1518f85bd..977f0b6edbcf 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -283,7 +283,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { {{^supportMultipleResponses}} {{^returnType}} Ok(()) diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache index 5bf951361d97..e4daf80c8f6f 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache @@ -1,5 +1,3 @@ -use reqwest; -use serde_json; use std::error; use std::fmt; diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache index 3bc043bddb10..7e1fc2514b60 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache @@ -107,7 +107,7 @@ export class {{classname}} { {{/isListContainer}} {{^isListContainer}} if ({{paramName}} !== undefined && {{paramName}} !== null) { - headers['{{baseName}}'] String({{paramName}}); + headers['{{baseName}}'] = String({{paramName}}); } {{/isListContainer}} {{/headerParams}} @@ -147,7 +147,7 @@ export class {{classname}} { // to determine the Accept header let httpHeaderAccepts: string[] = [ {{#produces}} - '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} + '{{{mediaType}}}'{{^-last}},{{/-last}} {{/produces}} ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -158,7 +158,7 @@ export class {{classname}} { // to determine the Content-Type header const consumes: string[] = [ {{#consumes}} - '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} + '{{{mediaType}}}'{{^-last}},{{/-last}} {{/consumes}} ]; {{#bodyParam}} @@ -167,8 +167,8 @@ export class {{classname}} { headers['Content-Type'] = httpContentTypeSelected; } {{/bodyParam}} - {{#hasFormParams}} + const canConsumeForm = this.canConsumeForm(consumes); let formParams: { append(param: string, value: any): void; }; @@ -176,6 +176,7 @@ export class {{classname}} { let convertFormParamsToString = false; {{#formParams}} {{#isFile}} + // use FormData to transmit files using content-type "multipart/form-data" // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data useForm = canConsumeForm; @@ -186,8 +187,8 @@ export class {{classname}} { } else { // formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); } - {{#formParams}} + {{#isListContainer}} if ({{paramName}}) { {{#isCollectionFormatMulti}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java index c8438e80a0fa..36daa8b1335b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java @@ -142,6 +142,45 @@ public class DartModelTest { Assert.assertTrue(property2.isContainer); } + @Test(description = "convert a model with set property") + public void setPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true)) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "Set"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "Set"); + Assert.assertEquals(property2.containerType, "set"); + Assert.assertFalse(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isContainer); + } + @Test(description = "convert a model with a map property") public void mapPropertyTest() { final Schema model = new Schema() diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java index 3faa4d477a0a..7aac98353d60 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java @@ -204,6 +204,44 @@ public class DartDioModelTest { Assert.assertTrue(property2.isContainer); } + @Test(description = "convert a model with set property") + public void setPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true)) + .addRequiredItem("id"); + final DefaultCodegen codegen = new DartDioClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "BuiltSet"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "BuiltSet"); + Assert.assertEquals(property2.containerType, "set"); + Assert.assertFalse(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isContainer); + } + @Test(description = "convert a model with a map property") public void mapPropertyTest() { final Schema model = new Schema() 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 a729d26077b3..9ab686484d10 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 @@ -134,6 +134,7 @@ paths: type: array items: type: string + uniqueItems: true responses: '200': description: successful operation @@ -143,11 +144,13 @@ paths: type: array items: $ref: '#/components/schemas/Pet' + uniqueItems: true application/json: schema: type: array items: $ref: '#/components/schemas/Pet' + uniqueItems: true '400': description: Invalid tag value security: @@ -1313,6 +1316,7 @@ components: wrapped: true items: type: string + uniqueItems: true tags: type: array xml: diff --git a/pom.xml b/pom.xml index e770e51b4ad0..98bb2a42ea78 100644 --- a/pom.xml +++ b/pom.xml @@ -1181,6 +1181,8 @@ + samples/client/petstore/typescript-axios/builds/with-npm-version + samples/client/petstore/typescript-axios/tests/default samples/client/petstore/crystal samples/server/petstore/python-aiohttp @@ -1222,7 +1224,6 @@ samples/client/petstore/typescript-fetch/builds/es6-target samples/client/petstore/typescript-fetch/builds/with-npm-version samples/client/petstore/typescript-fetch/tests/default - samples/client/petstore/typescript-axios/tests/default samples/client/petstore/typescript-node/npm samples/client/petstore/typescript-rxjs/builds/with-npm-version diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs index 53e4ce7fd454..d70c53adbdbd 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ApiClient.cs @@ -477,6 +477,19 @@ namespace Org.OpenAPITools.Client response = client.Execute(req); } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + T instance = (T)Activator.CreateInstance(typeof(T)); + MethodInfo method = typeof(T).GetMethod("FromJson"); + method.Invoke(instance, new object[] { response.Content }); + response.Data = instance; + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + InterceptResponse(req, response); var result = ToApiResponse(response); @@ -587,6 +600,10 @@ namespace Org.OpenAPITools.Client method.Invoke(instance, new object[] { response.Content }); response.Data = instance; } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } InterceptResponse(req, response); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs index 5c4b6465dbc2..a78ae625eee4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ApiClient.cs @@ -477,6 +477,19 @@ namespace Org.OpenAPITools.Client response = client.Execute(req); } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + T instance = (T)Activator.CreateInstance(typeof(T)); + MethodInfo method = typeof(T).GetMethod("FromJson"); + method.Invoke(instance, new object[] { response.Content }); + response.Data = instance; + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + InterceptResponse(req, response); var result = ToApiResponse(response); @@ -587,6 +600,10 @@ namespace Org.OpenAPITools.Client method.Invoke(instance, new object[] { response.Content }); response.Data = instance; } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } InterceptResponse(req, response); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index b3376d6045ec..1ca767977f21 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -199,6 +199,19 @@ namespace Org.OpenAPITools.Test Assert.Equal("sample category name2", response.Category.Name); } + /* a simple test for binary response. no longer in use. + [Fact] + public void TestGetByIdBinaryResponse() + { + PetApi petApi = new PetApi(c1); + Stream response = petApi.GetPetByIdBinaryResponse(petId); + Assert.IsType(response); + StreamReader reader = new StreamReader(response); + // the following will fail for sure + //Assert.Equal("someting", reader.ReadToEnd()); + } + */ + /// /// Test GetPetByIdWithHttpInfoAsync /// diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs index 520896de7ea5..020a2df2dc33 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs @@ -476,6 +476,19 @@ namespace Org.OpenAPITools.Client response = client.Execute(req); } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + T instance = (T)Activator.CreateInstance(typeof(T)); + MethodInfo method = typeof(T).GetMethod("FromJson"); + method.Invoke(instance, new object[] { response.Content }); + response.Data = instance; + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + InterceptResponse(req, response); var result = ToApiResponse(response); @@ -586,6 +599,10 @@ namespace Org.OpenAPITools.Client method.Invoke(instance, new object[] { response.Content }); response.Data = instance; } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } InterceptResponse(req, response); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs index 53e4ce7fd454..d70c53adbdbd 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -477,6 +477,19 @@ namespace Org.OpenAPITools.Client response = client.Execute(req); } + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Org.OpenAPITools.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + T instance = (T)Activator.CreateInstance(typeof(T)); + MethodInfo method = typeof(T).GetMethod("FromJson"); + method.Invoke(instance, new object[] { response.Content }); + response.Data = instance; + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + InterceptResponse(req, response); var result = ToApiResponse(response); @@ -587,6 +600,10 @@ namespace Org.OpenAPITools.Client method.Invoke(instance, new object[] { response.Content }); response.Data = instance; } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } InterceptResponse(req, response); 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 b37ec697acd6..90236aaab2f3 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 @@ -250,6 +250,8 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + + yield break; } } diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart index 2422d33a0f3e..2bdb6d8f8334 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api.dart @@ -18,31 +18,37 @@ import 'package:openapi/api/store_api.dart'; import 'package:openapi/api/user_api.dart'; -final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; +final _defaultInterceptors = [ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor(), +]; class Openapi { - Dio dio; - Serializers serializers; - String basePath = 'http://petstore.swagger.io/v2'; + static const String basePath = r'http://petstore.swagger.io/v2'; - Openapi({this.dio, Serializers serializers, String basePathOverride, List interceptors}) { - if (dio == null) { - BaseOptions options = new BaseOptions( + final Dio dio; + + final Serializers serializers; + + Openapi({ + Dio dio, + Serializers serializers, + String basePathOverride, + List interceptors, + }) : this.serializers = serializers ?? standardSerializers, + this.dio = dio ?? + Dio(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; + )) { + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } } void setOAuthToken(String name, String token) { diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index fe5c92998410..9b4f286f41e6 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -17,10 +17,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class PetApi { - final Dio _dio; - Serializers _serializers; - PetApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const PetApi(this._dio, this._serializers); /// Add a new pet to the store /// @@ -181,8 +183,7 @@ class PetApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltList; - const type = FullType(collectionType, [FullType(Pet)]); + const type = FullType(BuiltList, [FullType(Pet)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -193,6 +194,7 @@ class PetApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -251,8 +253,7 @@ class PetApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltList; - const type = FullType(collectionType, [FullType(Pet)]); + const type = FullType(BuiltList, [FullType(Pet)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -263,6 +264,7 @@ class PetApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -331,6 +333,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -525,6 +528,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index f9a8754907a4..0dce4aeeb873 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -14,10 +14,12 @@ import 'package:openapi/model/order.dart'; import 'package:built_collection/built_collection.dart'; class StoreApi { - final Dio _dio; - Serializers _serializers; - StoreApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const StoreApi(this._dio, this._serializers); /// Delete purchase order by ID /// @@ -113,8 +115,7 @@ class StoreApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltMap; - const type = FullType(collectionType, [FullType(String), FullType(int)]); + const type = FullType(BuiltMap, [FullType(String), FullType(int)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -125,6 +126,7 @@ class StoreApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -186,6 +188,7 @@ class StoreApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -252,6 +255,7 @@ class StoreApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index 17b551bc9110..7357aace8d71 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -14,10 +14,12 @@ import 'package:openapi/model/user.dart'; import 'package:built_collection/built_collection.dart'; class UserApi { - final Dio _dio; - Serializers _serializers; - UserApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const UserApi(this._dio, this._serializers); /// Create user /// @@ -266,6 +268,7 @@ class UserApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -326,6 +329,7 @@ class UserApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart index 5fa4f759553d..bfa6db0fd38a 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart @@ -41,6 +41,7 @@ const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); final _regMap = RegExp(r'^Map$'); ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart index 5611cb3d2c69..0bf9bd5595dd 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -222,7 +222,7 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .map((item) => item as Pet) + .cast() .toList(growable: false); } return null; @@ -300,7 +300,7 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .map((item) => item as Pet) + .cast() .toList(growable: false); } return null; diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 6a45211ea6e1..9f875dba12d6 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -188,6 +188,12 @@ class ApiClient { .map((v) => _deserialize(v, newTargetType, growable: growable)) .toList(growable: true == growable); } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toSet(); + } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { final newTargetType = match[1]; return Map.fromIterables( diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml b/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml index 2be37fd6ee91..942da2a74f05 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml @@ -279,12 +279,12 @@ 1.7 ${java.version} ${java.version} - 1.8.4 - 1.5.24 - 3.14.7 + 1.8.5 + 1.6.2 + 4.9.1 2.8.6 - 3.10 - 1.4.3 + 3.11 + 1.5.0 1.3.2 4.13.1 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index a3798d00f11c..a2bb80af7fae 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -281,12 +281,12 @@ 1.7 ${java.version} ${java.version} - 1.8.4 - 1.5.24 - 3.14.7 + 1.8.5 + 1.6.2 + 4.9.1 2.8.6 - 3.10 - 1.4.3 + 3.11 + 1.5.0 1.3.2 4.13.1 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 8a927846d799..bdd59dd9f378 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -274,12 +274,12 @@ 1.7 ${java.version} ${java.version} - 1.8.4 - 1.5.24 - 3.14.7 + 1.8.5 + 1.6.2 + 4.9.1 2.8.6 - 3.10 - 1.4.3 + 3.11 + 1.5.0 1.3.2 4.13.1 UTF-8 diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 6465f1485531..b80e0390de2d 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -11,7 +11,6 @@ import java.util.Date object Serializer { @JvmStatic val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 6465f1485531..b80e0390de2d 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -11,7 +11,6 @@ import java.util.Date object Serializer { @JvmStatic val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 06d9fe0bdc8a..25447c818e66 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,13 +1,11 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 371e2a7013e5..7265f7591428 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date internal object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION +++ b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/build.gradle b/samples/client/petstore/kotlin-uppercase-enum/build.gradle index adff312f725c..56be0bd0dd87 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/build.gradle +++ b/samples/client/petstore/kotlin-uppercase-enum/build.gradle @@ -33,6 +33,5 @@ dependencies { compile "com.squareup.moshi:moshi-kotlin:1.9.2" compile "com.squareup.moshi:moshi-adapters:1.9.2" compile "com.squareup.okhttp3:okhttp:4.2.2" - compile "com.squareup.okhttp3:logging-interceptor:4.4.0" testCompile "io.kotlintest:kotlintest-runner-junit5:3.1.0" } diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 69b562becb07..9bd2790dc144 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -10,6 +10,7 @@ val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") val Response.isRedirect : Boolean get() = this.code in 300..399 /** diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index dab26f43a7b5..5ae28d3273cd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -1055,6 +1055,7 @@ class PetApi ); } + $resourcePath = '/pet/findByTags'; $formParams = []; $queryParams = []; diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php index 94c27b3ca3e4..3760a347e019 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Pet.php @@ -362,6 +362,8 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable */ public function setPhotoUrls($photo_urls) { + + $this->container['photo_urls'] = $photo_urls; return $this; diff --git a/samples/client/petstore/powershell/docs/PSPetApi.md b/samples/client/petstore/powershell/docs/PSPetApi.md index 862d4898be74..3cebe2ba2687 100644 --- a/samples/client/petstore/powershell/docs/PSPetApi.md +++ b/samples/client/petstore/powershell/docs/PSPetApi.md @@ -23,8 +23,6 @@ Add a new pet to the store ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth @@ -72,8 +70,6 @@ Deletes a pet ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth @@ -124,8 +120,6 @@ Multiple status values can be provided with comma separated strings ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth @@ -174,8 +168,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth @@ -224,8 +216,6 @@ Returns a single pet ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: api_key @@ -274,8 +264,6 @@ Update an existing pet ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth @@ -324,8 +312,6 @@ Updates a pet in the store with form data ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth @@ -378,8 +364,6 @@ uploads an image ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure OAuth2 access token for authorization: petstore_auth diff --git a/samples/client/petstore/powershell/docs/PSStoreApi.md b/samples/client/petstore/powershell/docs/PSStoreApi.md index f12946fb546b..65d14db7eb41 100644 --- a/samples/client/petstore/powershell/docs/PSStoreApi.md +++ b/samples/client/petstore/powershell/docs/PSStoreApi.md @@ -21,8 +21,6 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```powershell -Import-Module -Name PSPetstore - $OrderId = "OrderId_example" # String | ID of the order that needs to be deleted # Delete purchase order by ID @@ -65,8 +63,6 @@ Returns a map of status codes to quantities ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: api_key @@ -113,8 +109,6 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```powershell -Import-Module -Name PSPetstore - $OrderId = 987 # Int64 | ID of pet that needs to be fetched # Find purchase order by ID @@ -156,8 +150,6 @@ Place an order for a pet ### Example ```powershell -Import-Module -Name PSPetstore - $Order = (Initialize-Order -Id 123 -PetId 123 -Quantity 123 -ShipDate Get-Date -Status "placed" -Complete $false) # Order | order placed for purchasing the pet # Place an order for a pet diff --git a/samples/client/petstore/powershell/docs/PSUserApi.md b/samples/client/petstore/powershell/docs/PSUserApi.md index 1548935037c4..be51a6c6f43e 100644 --- a/samples/client/petstore/powershell/docs/PSUserApi.md +++ b/samples/client/petstore/powershell/docs/PSUserApi.md @@ -25,8 +25,6 @@ This can only be done by the logged in user. ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: auth_cookie @@ -75,8 +73,6 @@ Creates list of users with given input array ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: auth_cookie @@ -125,8 +121,6 @@ Creates list of users with given input array ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: auth_cookie @@ -177,8 +171,6 @@ This can only be done by the logged in user. ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: auth_cookie @@ -227,8 +219,6 @@ Get user by user name ### Example ```powershell -Import-Module -Name PSPetstore - $Username = "Username_example" # String | The name that needs to be fetched. Use user1 for testing. # Get user by user name @@ -271,8 +261,6 @@ Logs user into the system ### Example ```powershell -Import-Module -Name PSPetstore - $Username = "Username_example" # String | The user name for login $Password = "Password_example" # String | The password for login in clear text @@ -315,8 +303,6 @@ Logs out current logged in user session ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: auth_cookie @@ -364,8 +350,6 @@ This can only be done by the logged in user. ### Example ```powershell -Import-Module -Name PSPetstore - # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration # Configure API key authorization: auth_cookie diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 96969fe23250..ccd984b7f5f8 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -118,6 +118,7 @@ conf = petstore_api.Configuration( def __init__(self, host=None, api_key=None, api_key_prefix=None, + access_token=None, username=None, password=None, discard_unknown_keys=False, disabled_client_side_validations="", @@ -142,6 +143,7 @@ conf = petstore_api.Configuration( """Temp file folder for downloading files """ # Authentication Settings + self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key @@ -163,9 +165,6 @@ conf = petstore_api.Configuration( """ self.discard_unknown_keys = discard_unknown_keys self.disabled_client_side_validations = disabled_client_side_validations - self.access_token = None - """access token for OAuth/Bearer - """ self.logger = {} """Logging Settings """ diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb index b7ca1ae125e6..f66aedd1454e 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/pet.rb @@ -154,6 +154,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] photo_urls Value to be assigned + def photo_urls=(photo_urls) + if photo_urls.nil? + fail ArgumentError, 'photo_urls cannot be nil' + end + + @photo_urls = photo_urls + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index b7ca1ae125e6..f66aedd1454e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -154,6 +154,16 @@ module Petstore true end + # Custom attribute writer method with validation + # @param [Object] photo_urls Value to be assigned + def photo_urls=(photo_urls) + if photo_urls.nil? + fail ArgumentError, 'photo_urls cannot be nil' + end + + @photo_urls = photo_urls + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/mod.rs index 181305dc4fec..c24f345edf3d 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/mod.rs @@ -1,5 +1,3 @@ -use reqwest; -use serde_json; use std::error; use std::fmt; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs index 20644907820c..e4162a33129b 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs @@ -231,7 +231,7 @@ pub async fn add_pet(configuration: &configuration::Configuration, params: AddPe let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -269,7 +269,7 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -305,7 +305,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -341,7 +341,7 @@ pub async fn find_pets_by_tags(configuration: &configuration::Configuration, par let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -381,7 +381,7 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -416,7 +416,7 @@ pub async fn update_pet(configuration: &configuration::Configuration, params: Up let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -460,7 +460,7 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration, let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -502,7 +502,7 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs index df70cd424958..21647faa062f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs @@ -122,7 +122,7 @@ pub async fn delete_order(configuration: &configuration::Configuration, params: let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -161,7 +161,7 @@ pub async fn get_inventory(configuration: &configuration::Configuration) -> Resu let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -193,7 +193,7 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -225,7 +225,7 @@ pub async fn place_order(configuration: &configuration::Configuration, params: P let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs index 7a0375ba9b14..a791bfbc9bb4 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs @@ -216,7 +216,7 @@ pub async fn create_user(configuration: &configuration::Configuration, params: C let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -248,7 +248,7 @@ pub async fn create_users_with_array_input(configuration: &configuration::Config let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -280,7 +280,7 @@ pub async fn create_users_with_list_input(configuration: &configuration::Configu let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -312,7 +312,7 @@ pub async fn delete_user(configuration: &configuration::Configuration, params: D let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -343,7 +343,7 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, para let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -377,7 +377,7 @@ pub async fn login_user(configuration: &configuration::Configuration, params: Lo let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -407,7 +407,7 @@ pub async fn logout_user(configuration: &configuration::Configuration) -> Result let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) @@ -441,7 +441,7 @@ pub async fn update_user(configuration: &configuration::Configuration, params: U let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text().await?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/mod.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/mod.rs index 181305dc4fec..c24f345edf3d 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/mod.rs @@ -1,5 +1,3 @@ -use reqwest; -use serde_json; use std::error; use std::fmt; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs index 301943aa6351..47cf47f1d59b 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs @@ -103,7 +103,7 @@ pub fn add_pet(configuration: &configuration::Configuration, body: crate::models let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -135,7 +135,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -166,7 +166,7 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -197,7 +197,7 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -232,7 +232,7 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -262,7 +262,7 @@ pub fn update_pet(configuration: &configuration::Configuration, body: crate::mod let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -299,7 +299,7 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -336,7 +336,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs index f7f9fa87b1e0..898599f9b2fc 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs @@ -67,7 +67,7 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -102,7 +102,7 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result<: let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -129,7 +129,7 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -156,7 +156,7 @@ pub fn place_order(configuration: &configuration::Configuration, body: crate::mo let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs index 4aaf235f8ee9..97f0f3c4e146 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs @@ -102,7 +102,7 @@ pub fn create_user(configuration: &configuration::Configuration, body: crate::mo let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -129,7 +129,7 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -156,7 +156,7 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -183,7 +183,7 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -209,7 +209,7 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username: let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -237,7 +237,7 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str, let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -263,7 +263,7 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); @@ -291,7 +291,7 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str, let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; - if local_var_status.is_success() { + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/pom.xml b/samples/client/petstore/typescript-axios/builds/with-npm-version/pom.xml new file mode 100644 index 000000000000..453d0ba34dff --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + org.openapitools + TSAxiosPestoreTests + pom + 1.0-SNAPSHOT + TS Axios Petstore Test Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + npm-install + pre-integration-test + + exec + + + npm + + install + + + + + + + + diff --git a/samples/client/petstore/typescript-axios/tests/default/package-lock.json b/samples/client/petstore/typescript-axios/tests/default/package-lock.json index 4f8e5657cc09..15a283ae3354 100644 --- a/samples/client/petstore/typescript-axios/tests/default/package-lock.json +++ b/samples/client/petstore/typescript-axios/tests/default/package-lock.json @@ -7,34 +7,7 @@ "@openapitools/typescript-axios-petstore": { "version": "file:../../builds/with-npm-version", "requires": { - "axios": "^0.19.2" - }, - "dependencies": { - "axios": { - "version": "0.19.2", - "bundled": true, - "requires": { - "follow-redirects": "1.5.10" - } - }, - "debug": { - "version": "3.1.0", - "bundled": true, - "requires": { - "ms": "2.0.0" - } - }, - "follow-redirects": { - "version": "1.5.10", - "bundled": true, - "requires": { - "debug": "=3.1.0" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - } + "axios": "^0.21.1" } }, "@types/chai": { @@ -311,7 +284,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -543,7 +516,7 @@ }, "convert-source-map": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", "dev": true }, @@ -573,7 +546,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -586,7 +559,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -706,7 +679,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -1892,7 +1865,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -2100,7 +2073,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, diff --git a/samples/client/petstore/typescript-axios/tests/default/tsconfig.json b/samples/client/petstore/typescript-axios/tests/default/tsconfig.json index 6524f781742b..19ec18e2a45b 100644 --- a/samples/client/petstore/typescript-axios/tests/default/tsconfig.json +++ b/samples/client/petstore/typescript-axios/tests/default/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "moduleResolution": "node", "module": "commonjs", "target": "es5", "noImplicitAny": true, diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts index 8b0237a728ba..4b5e5912374d 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/PetApi.ts @@ -37,7 +37,7 @@ export interface FindPetsByStatusRequest { } export interface FindPetsByTagsRequest { - tags: Array; + tags: Set; } export interface GetPetByIdRequest { @@ -203,7 +203,7 @@ export class PetApi extends runtime.BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest): Promise>> { + async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest): Promise>> { if (requestParameters.tags === null || requestParameters.tags === undefined) { throw new runtime.RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); } @@ -239,7 +239,7 @@ export class PetApi extends runtime.BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - async findPetsByTags(requestParameters: FindPetsByTagsRequest): Promise> { + async findPetsByTags(requestParameters: FindPetsByTagsRequest): Promise> { const response = await this.findPetsByTagsRaw(requestParameters); return await response.value(); } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts index f188f88dcee4..7318e62574c5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/Pet.ts @@ -50,10 +50,10 @@ export interface Pet { name: string; /** * - * @type {Array} + * @type {Set} * @memberof Pet */ - photoUrls: Array; + photoUrls: Set; /** * * @type {Array} diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/pom.xml b/samples/client/petstore/typescript-fetch/builds/es6-target/pom.xml index db6dfdfeb6aa..94a52e3749f2 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/pom.xml +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/pom.xml @@ -39,19 +39,6 @@ - - npm-test - integration-test - - exec - - - npm - - test - - - diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml b/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml index 339fe7665186..461175a4d677 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml @@ -53,19 +53,6 @@ - - npm-test - integration-test - - exec - - - npm - - test - - - diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts index 554608d8f0dc..7662f505df77 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/pet.service.ts @@ -67,7 +67,7 @@ export class PetService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -77,14 +77,13 @@ export class PetService { // to determine the Content-Type header const consumes: string[] = [ - 'application/json' + 'application/json', 'application/xml' ]; const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.post(`${this.basePath}/pet`, pet, { @@ -111,7 +110,7 @@ export class PetService { let headers = this.defaultHeaders; if (apiKey !== undefined && apiKey !== null) { - headers['api_key'] String(apiKey); + headers['api_key'] = String(apiKey); } // authentication (petstore_auth) required @@ -133,7 +132,6 @@ export class PetService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, { withCredentials: this.configuration.withCredentials, @@ -172,7 +170,7 @@ export class PetService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -183,7 +181,6 @@ export class PetService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get>(`${this.basePath}/pet/findByStatus`, { params: queryParameters, @@ -223,7 +220,7 @@ export class PetService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -234,7 +231,6 @@ export class PetService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get>(`${this.basePath}/pet/findByTags`, { params: queryParameters, @@ -266,7 +262,7 @@ export class PetService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -277,7 +273,6 @@ export class PetService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, { withCredentials: this.configuration.withCredentials, @@ -311,7 +306,7 @@ export class PetService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -321,14 +316,13 @@ export class PetService { // to determine the Content-Type header const consumes: string[] = [ - 'application/json' + 'application/json', 'application/xml' ]; const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.put(`${this.basePath}/pet`, pet, { @@ -392,6 +386,7 @@ export class PetService { if (name !== undefined) { formParams.append('name', name); } + if (status !== undefined) { formParams.append('status', status); } @@ -451,6 +446,7 @@ export class PetService { let formParams: { append(param: string, value: any): void; }; let useForm = false; let convertFormParamsToString = false; + // use FormData to transmit files using content-type "multipart/form-data" // see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data useForm = canConsumeForm; @@ -463,6 +459,7 @@ export class PetService { if (additionalMetadata !== undefined) { formParams.append('additionalMetadata', additionalMetadata); } + if (file !== undefined) { formParams.append('file', file); } diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts index 2d5a23a5662a..fd616d690181 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/store.service.ts @@ -67,7 +67,6 @@ export class StoreService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { withCredentials: this.configuration.withCredentials, @@ -103,7 +102,6 @@ export class StoreService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`, { withCredentials: this.configuration.withCredentials, @@ -129,7 +127,7 @@ export class StoreService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -140,7 +138,6 @@ export class StoreService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, { withCredentials: this.configuration.withCredentials, @@ -166,7 +163,7 @@ export class StoreService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -182,7 +179,6 @@ export class StoreService { if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.post(`${this.basePath}/store/order`, order, { diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts index e2d7034ec8d2..c4fc9fcf79a0 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/api/user.service.ts @@ -77,7 +77,6 @@ export class UserService { if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.post(`${this.basePath}/user`, user, { @@ -123,7 +122,6 @@ export class UserService { if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.post(`${this.basePath}/user/createWithArray`, user, { @@ -169,7 +167,6 @@ export class UserService { if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.post(`${this.basePath}/user/createWithList`, user, { @@ -210,7 +207,6 @@ export class UserService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, { withCredentials: this.configuration.withCredentials, @@ -236,7 +232,7 @@ export class UserService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -247,7 +243,6 @@ export class UserService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, { withCredentials: this.configuration.withCredentials, @@ -286,7 +281,7 @@ export class UserService { // to determine the Accept header let httpHeaderAccepts: string[] = [ - 'application/xml' + 'application/xml', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); @@ -297,7 +292,6 @@ export class UserService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/user/login`, { params: queryParameters, @@ -333,7 +327,6 @@ export class UserService { // to determine the Content-Type header const consumes: string[] = [ ]; - return this.httpClient.get(`${this.basePath}/user/logout`, { withCredentials: this.configuration.withCredentials, @@ -383,7 +376,6 @@ export class UserService { if (httpContentTypeSelected != undefined) { headers['Content-Type'] = httpContentTypeSelected; } - return this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, user, { diff --git a/samples/meta-codegen/lib/pom.xml b/samples/meta-codegen/lib/pom.xml index 8b0799d94888..0a42138424fb 100644 --- a/samples/meta-codegen/lib/pom.xml +++ b/samples/meta-codegen/lib/pom.xml @@ -121,7 +121,13 @@ UTF-8 +<<<<<<< HEAD 5.1.0-SNAPSHOT +======= + + 5.0.1 + +>>>>>>> origin/master 1.0.0 4.8.1 diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py index 656eb7811859..c71b06a8aa24 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py @@ -102,6 +102,7 @@ conf = x_auth_id_alias.Configuration( def __init__(self, host=None, api_key=None, api_key_prefix=None, + access_token=None, username=None, password=None, discard_unknown_keys=False, disabled_client_side_validations="", @@ -126,6 +127,7 @@ conf = x_auth_id_alias.Configuration( """Temp file folder for downloading files """ # Authentication Settings + self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py index bd674fc5907d..d826515c081b 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py @@ -82,6 +82,7 @@ class Configuration(object): def __init__(self, host=None, api_key=None, api_key_prefix=None, + access_token=None, username=None, password=None, discard_unknown_keys=False, disabled_client_side_validations="", @@ -106,6 +107,7 @@ class Configuration(object): """Temp file folder for downloading files """ # Authentication Settings + self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart index 2422d33a0f3e..2bdb6d8f8334 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api.dart @@ -18,31 +18,37 @@ import 'package:openapi/api/store_api.dart'; import 'package:openapi/api/user_api.dart'; -final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; +final _defaultInterceptors = [ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor(), +]; class Openapi { - Dio dio; - Serializers serializers; - String basePath = 'http://petstore.swagger.io/v2'; + static const String basePath = r'http://petstore.swagger.io/v2'; - Openapi({this.dio, Serializers serializers, String basePathOverride, List interceptors}) { - if (dio == null) { - BaseOptions options = new BaseOptions( + final Dio dio; + + final Serializers serializers; + + Openapi({ + Dio dio, + Serializers serializers, + String basePathOverride, + List interceptors, + }) : this.serializers = serializers ?? standardSerializers, + this.dio = dio ?? + Dio(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; + )) { + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } } void setOAuthToken(String name, String token) { diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart index 95db7626674c..dacefa336bf6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/pet_api.dart @@ -17,10 +17,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class PetApi { - final Dio _dio; - Serializers _serializers; - PetApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const PetApi(this._dio, this._serializers); /// Add a new pet to the store /// @@ -87,6 +89,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -197,8 +200,7 @@ class PetApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltList; - const type = FullType(collectionType, [FullType(Pet)]); + const type = FullType(BuiltList, [FullType(Pet)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -209,6 +211,7 @@ class PetApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -267,8 +270,7 @@ class PetApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltList; - const type = FullType(collectionType, [FullType(Pet)]); + const type = FullType(BuiltList, [FullType(Pet)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -279,6 +281,7 @@ class PetApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -347,6 +350,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -421,6 +425,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -557,6 +562,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart index 5f58e788091f..0c9f666e1b76 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/store_api.dart @@ -14,10 +14,12 @@ import 'package:openapi/model/order.dart'; import 'package:built_collection/built_collection.dart'; class StoreApi { - final Dio _dio; - Serializers _serializers; - StoreApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const StoreApi(this._dio, this._serializers); /// Delete purchase order by ID /// @@ -113,8 +115,7 @@ class StoreApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltMap; - const type = FullType(collectionType, [FullType(String), FullType(int)]); + const type = FullType(BuiltMap, [FullType(String), FullType(int)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -125,6 +126,7 @@ class StoreApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -186,6 +188,7 @@ class StoreApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -254,6 +257,7 @@ class StoreApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart index a4d59b2978c5..ce8c20111f07 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/lib/api/user_api.dart @@ -14,10 +14,12 @@ import 'package:openapi/model/user.dart'; import 'package:built_collection/built_collection.dart'; class UserApi { - final Dio _dio; - Serializers _serializers; - UserApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const UserApi(this._dio, this._serializers); /// Create user /// @@ -300,6 +302,7 @@ class UserApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -360,6 +363,7 @@ class UserApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md index 3a8dd5b8996b..3640640df190 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/Pet.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **id** | **int** | | [optional] **category** | [**Category**](Category.md) | | [optional] **name** | **String** | | -**photoUrls** | **BuiltList** | | +**photoUrls** | **BuiltSet** | | **tags** | [**BuiltList**](Tag.md) | | [optional] **status** | **String** | pet status in the store | [optional] diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md index 24e5719295dd..f844ee8eaf33 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md @@ -152,7 +152,7 @@ Name | Type | Description | Notes [[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** -> BuiltList findPetsByTags(tags) +> BuiltSet findPetsByTags(tags) Finds Pets by tags @@ -165,7 +165,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; var api_instance = new PetApi(); -var tags = []; // BuiltList | Tags to filter by +var tags = []; // BuiltSet | Tags to filter by try { var result = api_instance.findPetsByTags(tags); @@ -179,11 +179,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**BuiltList**](String.md)| Tags to filter by | + **tags** | [**BuiltSet**](String.md)| Tags to filter by | ### Return type -[**BuiltList**](Pet.md) +[**BuiltSet**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart index 3e1dec02f819..378be30a74af 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api.dart @@ -22,31 +22,37 @@ import 'package:openapi/api/store_api.dart'; import 'package:openapi/api/user_api.dart'; -final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; +final _defaultInterceptors = [ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor(), +]; class Openapi { - Dio dio; - Serializers serializers; - String basePath = 'http://petstore.swagger.io:80/v2'; + static const String basePath = r'http://petstore.swagger.io:80/v2'; - Openapi({this.dio, Serializers serializers, String basePathOverride, List interceptors}) { - if (dio == null) { - BaseOptions options = new BaseOptions( + final Dio dio; + + final Serializers serializers; + + Openapi({ + Dio dio, + Serializers serializers, + String basePathOverride, + List interceptors, + }) : this.serializers = serializers ?? standardSerializers, + this.dio = dio ?? + Dio(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; + )) { + if (interceptors == null) { + this.dio.interceptors.addAll(_defaultInterceptors); + } else { + this.dio.interceptors.addAll(interceptors); + } } void setOAuthToken(String name, String token) { diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart index 72310ff35339..21bcd8d04756 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/another_fake_api.dart @@ -13,10 +13,12 @@ import 'package:built_value/serializer.dart'; import 'package:openapi/model/model_client.dart'; class AnotherFakeApi { - final Dio _dio; - Serializers _serializers; - AnotherFakeApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const AnotherFakeApi(this._dio, this._serializers); /// To test special tags /// @@ -77,6 +79,7 @@ class AnotherFakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart index a47b383960bc..7dabdff912d9 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/default_api.dart @@ -13,10 +13,12 @@ import 'package:built_value/serializer.dart'; import 'package:openapi/model/inline_response_default.dart'; class DefaultApi { - final Dio _dio; - Serializers _serializers; - DefaultApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const DefaultApi(this._dio, this._serializers); /// /// @@ -69,6 +71,7 @@ class DefaultApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart index 96d776d36f9c..022866c37221 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart @@ -21,10 +21,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class FakeApi { - final Dio _dio; - Serializers _serializers; - FakeApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const FakeApi(this._dio, this._serializers); /// Health check endpoint /// @@ -77,6 +79,7 @@ class FakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -202,6 +205,7 @@ class FakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -270,6 +274,7 @@ class FakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -333,6 +338,7 @@ class FakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -396,6 +402,7 @@ class FakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -570,6 +577,7 @@ class FakeApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart index 81d1c554818d..10092d010b4e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -13,10 +13,12 @@ import 'package:built_value/serializer.dart'; import 'package:openapi/model/model_client.dart'; class FakeClassnameTags123Api { - final Dio _dio; - Serializers _serializers; - FakeClassnameTags123Api(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const FakeClassnameTags123Api(this._dio, this._serializers); /// To test class name in snake case /// @@ -84,6 +86,7 @@ class FakeClassnameTags123Api { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart index 6bb8363f2ae2..d01f1b2a8ba0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/pet_api.dart @@ -17,10 +17,12 @@ import 'package:built_collection/built_collection.dart'; import 'package:openapi/api_util.dart'; class PetApi { - final Dio _dio; - Serializers _serializers; - PetApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const PetApi(this._dio, this._serializers); /// Add a new pet to the store /// @@ -181,8 +183,7 @@ class PetApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltList; - const type = FullType(collectionType, [FullType(Pet)]); + const type = FullType(BuiltList, [FullType(Pet)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -193,6 +194,7 @@ class PetApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -205,8 +207,8 @@ class PetApi { /// Finds Pets by tags /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future>> findPetsByTags( - BuiltList tags, { + Future>> findPetsByTags( + BuiltSet tags, { CancelToken cancelToken, Map headers, Map extra, @@ -251,18 +253,18 @@ class PetApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltList; - const type = FullType(collectionType, [FullType(Pet)]); + const type = FullType(BuiltSet, [FullType(Pet)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) : response.data, specifiedType: type, - ) as BuiltList; + ) as BuiltSet; - return Response>( + return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -331,6 +333,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -525,6 +528,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -601,6 +605,7 @@ class PetApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart index b9be3d2f72d4..fa30f5d3d7b4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/store_api.dart @@ -14,10 +14,12 @@ import 'package:openapi/model/order.dart'; import 'package:built_collection/built_collection.dart'; class StoreApi { - final Dio _dio; - Serializers _serializers; - StoreApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const StoreApi(this._dio, this._serializers); /// Delete purchase order by ID /// @@ -113,8 +115,7 @@ class StoreApi { onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ).then((response) { - const collectionType = BuiltMap; - const type = FullType(collectionType, [FullType(String), FullType(int)]); + const type = FullType(BuiltMap, [FullType(String), FullType(int)]); final data = _serializers.deserialize( response.data is String ? jsonDecode(response.data as String) @@ -125,6 +126,7 @@ class StoreApi { return Response>( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -186,6 +188,7 @@ class StoreApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -254,6 +257,7 @@ class StoreApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart index e73986ac4931..6e4eb642e184 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/user_api.dart @@ -14,10 +14,12 @@ import 'package:openapi/model/user.dart'; import 'package:built_collection/built_collection.dart'; class UserApi { - final Dio _dio; - Serializers _serializers; - UserApi(this._dio, this._serializers); + final Dio _dio; + + final Serializers _serializers; + + const UserApi(this._dio, this._serializers); /// Create user /// @@ -272,6 +274,7 @@ class UserApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, @@ -332,6 +335,7 @@ class UserApi { return Response( data: data, headers: response.headers, + isRedirect: response.isRedirect, request: response.request, redirects: response.redirects, statusCode: response.statusCode, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart index 98757f5e7cec..fc3e493ad1c2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/pet.dart @@ -29,7 +29,7 @@ abstract class Pet implements Built { @nullable @BuiltValueField(wireName: r'photoUrls') - BuiltList get photoUrls; + BuiltSet get photoUrls; @nullable @BuiltValueField(wireName: r'tags') diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart index 93a24c5a7d21..b3f9ae7c26d0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart @@ -109,6 +109,10 @@ Serializers serializers = (_$serializers.toBuilder() const FullType(BuiltMap, [FullType(String), FullType(String)]), () => MapBuilder(), ) + ..addBuilderFactory( + const FullType(BuiltSet, [FullType(Pet)]), + () => SetBuilder(), + ) ..addBuilderFactory( const FullType(BuiltList, [FullType(Pet)]), () => ListBuilder(), diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart index 7724f48b5df1..6248518fa68c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_api_test.dart @@ -35,7 +35,7 @@ void main() { // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // - //Future> findPetsByTags(BuiltList tags) async + //Future> findPetsByTags(BuiltSet tags) async test('test findPetsByTags', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart index 9d5b6e4dd4ac..20f82b235a8d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/pet_test.dart @@ -21,7 +21,7 @@ void main() { // TODO }); - // BuiltList photoUrls + // BuiltSet photoUrls test('to test the property `photoUrls`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart index 5fa4f759553d..bfa6db0fd38a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart @@ -41,6 +41,7 @@ const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); final _regMap = RegExp(r'^Map$'); ApiClient defaultApiClient = ApiClient(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart index 50e2e25bf748..630b93df8466 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart @@ -229,7 +229,7 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .map((item) => item as Pet) + .cast() .toList(growable: false); } return null; @@ -307,7 +307,7 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .map((item) => item as Pet) + .cast() .toList(growable: false); } return null; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 6a45211ea6e1..9f875dba12d6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -188,6 +188,12 @@ class ApiClient { .map((v) => _deserialize(v, newTargetType, growable: growable)) .toList(growable: true == growable); } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toSet(); + } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { final newTargetType = match[1]; return Map.fromIterables( diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md index 88512ee37035..b6fdea5299ba 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/Pet.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **id** | **int** | | [optional] **category** | [**Category**](Category.md) | | [optional] **name** | **String** | | -**photoUrls** | **List** | | [default to const []] +**photoUrls** | **Set** | | [default to const {}] **tags** | [**List**](Tag.md) | | [optional] [default to const []] **status** | **String** | pet status in the store | [optional] diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md index 5320ca9ae5a0..aeb082c96863 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md @@ -152,7 +152,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **findPetsByTags** -> List findPetsByTags(tags) +> Set findPetsByTags(tags) Finds Pets by tags @@ -165,7 +165,7 @@ import 'package:openapi/api.dart'; //defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; final api_instance = PetApi(); -final tags = []; // List | Tags to filter by +final tags = []; // Set | Tags to filter by try { final result = api_instance.findPetsByTags(tags); @@ -179,11 +179,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List**](String.md)| Tags to filter by | [default to const []] + **tags** | [**Set**](String.md)| Tags to filter by | [default to const {}] ### Return type -[**List**](Pet.md) +[**Set**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart index 3563dcbfc009..8d4068639945 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart @@ -82,6 +82,7 @@ const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); final _regMap = RegExp(r'^Map$'); ApiClient defaultApiClient = ApiClient(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart index 64323b3beec1..256bfd22f1da 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/pet_api.dart @@ -222,7 +222,7 @@ class PetApi { // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .map((item) => item as Pet) + .cast() .toList(growable: false); } return null; @@ -236,9 +236,9 @@ class PetApi { /// /// Parameters: /// - /// * [List] tags (required): + /// * [Set] tags (required): /// Tags to filter by - Future findPetsByTagsWithHttpInfo(List tags) async { + Future findPetsByTagsWithHttpInfo(Set tags) async { // Verify required params are set. if (tags == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); @@ -288,9 +288,9 @@ class PetApi { /// /// Parameters: /// - /// * [List] tags (required): + /// * [Set] tags (required): /// Tags to filter by - Future> findPetsByTags(List tags) async { + Future> findPetsByTags(Set tags) async { final response = await findPetsByTagsWithHttpInfo(tags); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); @@ -299,9 +299,9 @@ class PetApi { // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" // FormatException when trying to decode an empty string. if (response.body != null && response.statusCode != HttpStatus.noContent) { - return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .map((item) => item as Pet) - .toList(growable: false); + return (apiClient.deserialize(_decodeBodyBytes(response), 'Set') as List) + .cast() + .toSet(); } return null; } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 4332d26fca4f..585c9038deae 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -265,6 +265,12 @@ class ApiClient { .map((v) => _deserialize(v, newTargetType, growable: growable)) .toList(growable: true == growable); } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toSet(); + } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { final newTargetType = match[1]; return Map.fromIterables( diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index edb8930c11de..6a8cdb9612a7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -15,7 +15,7 @@ class Pet { this.id, this.category, @required this.name, - this.photoUrls = const [], + this.photoUrls = const {}, this.tags = const [], this.status, }); @@ -26,7 +26,7 @@ class Pet { String name; - List photoUrls; + Set photoUrls; List tags; @@ -87,7 +87,7 @@ class Pet { name: json[r'name'], photoUrls: json[r'photoUrls'] == null ? null - : (json[r'photoUrls'] as List).cast(), + : (json[r'photoUrls'] as Set).cast(), tags: Tag.listFromJson(json[r'tags']), status: PetStatusEnum.fromJson(json[r'status']), ); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart index 697fcdfd0c0c..5f4c994acefa 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_api_test.dart @@ -43,7 +43,7 @@ void main() { // // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. // - //Future> findPetsByTags(List tags) async + //Future> findPetsByTags(Set tags) async test('test findPetsByTags', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart index b91619505efd..4c0f8f635e2c 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/pet_test.dart @@ -21,7 +21,7 @@ void main() { // TODO }); - // List photoUrls (default value: const []) + // Set photoUrls (default value: const {}) test('to test the property `photoUrls`', () async { // TODO }); diff --git a/samples/openapi3/client/petstore/go/go-petstore/signing.go b/samples/openapi3/client/petstore/go/go-petstore/signing.go index f4be5ad92655..9dc2cf7570a5 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/signing.go +++ b/samples/openapi3/client/petstore/go/go-petstore/signing.go @@ -125,6 +125,11 @@ type HttpSignatureAuth struct { privateKey crypto.PrivateKey // The private key used to sign HTTP requests. } +// SetPrivateKey accepts a private key string and sets it. +func (h *HttpSignatureAuth) SetPrivateKey(privateKey string) error { + return h.parsePrivateKey([]byte(privateKey)) +} + // ContextWithValue validates the HttpSignatureAuth configuration parameters and returns a context // suitable for HTTP signature. An error is returned if the HttpSignatureAuth configuration parameters // are invalid. @@ -132,7 +137,7 @@ func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Conte if h.KeyId == "" { return nil, fmt.Errorf("Key ID must be specified") } - if h.PrivateKeyPath == "" { + if h.PrivateKeyPath == "" && h.privateKey == nil { return nil, fmt.Errorf("Private key path must be specified") } if _, ok := supportedSigningSchemes[h.SigningScheme]; !ok { @@ -177,7 +182,11 @@ func (h *HttpSignatureAuth) GetPublicKey() (crypto.PublicKey, error) { } // loadPrivateKey reads the private key from the file specified in the HttpSignatureAuth. +// The key is loaded only when privateKey is not already set. func (h *HttpSignatureAuth) loadPrivateKey() (err error) { + if h.privateKey != nil { + return nil + } var file *os.File file, err = os.Open(h.PrivateKeyPath) if err != nil { @@ -191,12 +200,18 @@ func (h *HttpSignatureAuth) loadPrivateKey() (err error) { if err != nil { return err } + return h.parsePrivateKey(priv) +} + +// parsePrivateKey decodes privateKey byte array to crypto.PrivateKey type. +func (h *HttpSignatureAuth) parsePrivateKey(priv []byte) error { pemBlock, _ := pem.Decode(priv) if pemBlock == nil { // No PEM data has been found. return fmt.Errorf("File '%s' does not contain PEM data", h.PrivateKeyPath) } var privKey []byte + var err error if x509.IsEncryptedPEMBlock(pemBlock) { // The PEM data is encrypted. privKey, err = x509.DecryptPEMBlock(pemBlock, []byte(h.Passphrase)) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/FILES b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/FILES index 106ea4db2ae5..2fcf69d6457e 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/FILES @@ -27,12 +27,6 @@ docs/Foo.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineObject.md -docs/InlineObject1.md -docs/InlineObject2.md -docs/InlineObject3.md -docs/InlineObject4.md -docs/InlineObject5.md docs/InlineResponseDefault.md docs/List.md docs/MapTest.md @@ -100,12 +94,6 @@ src/main/kotlin/org/openapitools/client/models/Foo.kt src/main/kotlin/org/openapitools/client/models/FormatTest.kt src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt -src/main/kotlin/org/openapitools/client/models/InlineObject.kt -src/main/kotlin/org/openapitools/client/models/InlineObject1.kt -src/main/kotlin/org/openapitools/client/models/InlineObject2.kt -src/main/kotlin/org/openapitools/client/models/InlineObject3.kt -src/main/kotlin/org/openapitools/client/models/InlineObject4.kt -src/main/kotlin/org/openapitools/client/models/InlineObject5.kt src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt src/main/kotlin/org/openapitools/client/models/List.kt src/main/kotlin/org/openapitools/client/models/MapTest.kt diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/README.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/README.md index 7d37a6283317..fca869bcf493 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/README.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/README.md @@ -101,12 +101,6 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - - [org.openapitools.client.models.InlineObject](docs/InlineObject.md) - - [org.openapitools.client.models.InlineObject1](docs/InlineObject1.md) - - [org.openapitools.client.models.InlineObject2](docs/InlineObject2.md) - - [org.openapitools.client.models.InlineObject3](docs/InlineObject3.md) - - [org.openapitools.client.models.InlineObject4](docs/InlineObject4.md) - - [org.openapitools.client.models.InlineObject5](docs/InlineObject5.md) - [org.openapitools.client.models.InlineResponseDefault](docs/InlineResponseDefault.md) - [org.openapitools.client.models.List](docs/List.md) - [org.openapitools.client.models.MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/build.gradle b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/build.gradle index 9c970542197e..7bce53584b2c 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/build.gradle +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/build.gradle @@ -30,8 +30,9 @@ test { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" compile "com.google.code.gson:gson:2.8.6" + compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" + compile "com.squareup.okhttp3:logging-interceptor:4.4.0" compile "com.squareup.retrofit2:retrofit:$retrofitVersion" compile "com.squareup.retrofit2:converter-gson:$retrofitVersion" compile "com.squareup.retrofit2:converter-scalars:$retrofitVersion" diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FakeApi.md index 6220efdaa290..1ea11abbf1fc 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FakeApi.md @@ -460,13 +460,13 @@ To test enum parameters val apiClient = ApiClient() val webService = apiClient.createWebservice(FakeApi::class.java) -val enumHeaderStringArray : kotlin.Array = // kotlin.Array | Header parameter enum test (string array) +val enumHeaderStringArray : kotlin.collections.List = // kotlin.collections.List | Header parameter enum test (string array) val enumHeaderString : kotlin.String = enumHeaderString_example // kotlin.String | Header parameter enum test (string) -val enumQueryStringArray : kotlin.Array = // kotlin.Array | Query parameter enum test (string array) +val enumQueryStringArray : kotlin.collections.List = // kotlin.collections.List | Query parameter enum test (string array) val enumQueryString : kotlin.String = enumQueryString_example // kotlin.String | Query parameter enum test (string) val enumQueryInteger : kotlin.Int = 56 // kotlin.Int | Query parameter enum test (double) val enumQueryDouble : kotlin.Double = 1.2 // kotlin.Double | Query parameter enum test (double) -val enumFormStringArray : kotlin.Array = enumFormStringArray_example // kotlin.Array | Form parameter enum test (string array) +val enumFormStringArray : kotlin.collections.List = enumFormStringArray_example // kotlin.collections.List | Form parameter enum test (string array) val enumFormString : kotlin.String = enumFormString_example // kotlin.String | Form parameter enum test (string) launch(Dispatchers.IO) { @@ -478,14 +478,14 @@ launch(Dispatchers.IO) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] - **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] - **enumQueryStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] - **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to "$"] [enum: >, $] - **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -645,11 +645,11 @@ To test the collection format in query parameters val apiClient = ApiClient() val webService = apiClient.createWebservice(FakeApi::class.java) -val pipe : kotlin.Array = // kotlin.Array | -val ioutil : kotlin.Array = // kotlin.Array | -val http : kotlin.Array = // kotlin.Array | -val url : kotlin.Array = // kotlin.Array | -val context : kotlin.Array = // kotlin.Array | +val pipe : kotlin.collections.List = // kotlin.collections.List | +val ioutil : kotlin.collections.List = // kotlin.collections.List | +val http : kotlin.collections.List = // kotlin.collections.List | +val url : kotlin.collections.List = // kotlin.collections.List | +val context : kotlin.collections.List = // kotlin.collections.List | launch(Dispatchers.IO) { webService.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) @@ -660,11 +660,11 @@ launch(Dispatchers.IO) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **ioutil** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **http** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **url** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **context** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | + **pipe** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **ioutil** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **http** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **url** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **context** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FormatTest.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FormatTest.md index 0357923c97a5..01b408499e73 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **int64** | **kotlin.Long** | | [optional] **float** | **kotlin.Float** | | [optional] **double** | **kotlin.Double** | | [optional] +**decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] **string** | **kotlin.String** | | [optional] **binary** | [**java.io.File**](java.io.File.md) | | [optional] **dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/List.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/List.md index 13a09a4c4141..f426d541a409 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/List.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/List.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**`123minusList`** | **kotlin.String** | | [optional] +**`123list`** | **kotlin.String** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/PetApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/PetApi.md index 44d832909311..9b0310b42aad 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/PetApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/PetApi.md @@ -107,10 +107,10 @@ Multiple status values can be provided with comma separated strings val apiClient = ApiClient() val webService = apiClient.createWebservice(PetApi::class.java) -val status : kotlin.Array = // kotlin.Array | Status values that need to be considered for filter +val status : kotlin.collections.List = // kotlin.collections.List | Status values that need to be considered for filter launch(Dispatchers.IO) { - val result : kotlin.Array = webService.findPetsByStatus(status) + val result : kotlin.collections.List = webService.findPetsByStatus(status) } ``` @@ -118,11 +118,11 @@ launch(Dispatchers.IO) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] ### Return type -[**kotlin.Array<Pet>**](Pet.md) +[**kotlin.collections.List<Pet>**](Pet.md) ### Authorization @@ -147,10 +147,10 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 val apiClient = ApiClient() val webService = apiClient.createWebservice(PetApi::class.java) -val tags : kotlin.Array = // kotlin.Array | Tags to filter by +val tags : kotlin.collections.List = // kotlin.collections.List | Tags to filter by launch(Dispatchers.IO) { - val result : kotlin.Array = webService.findPetsByTags(tags) + val result : kotlin.collections.List = webService.findPetsByTags(tags) } ``` @@ -158,11 +158,11 @@ launch(Dispatchers.IO) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + **tags** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Tags to filter by | ### Return type -[**kotlin.Array<Pet>**](Pet.md) +[**kotlin.collections.List<Pet>**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/SpecialModelName.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/SpecialModelName.md index 282649449d96..b179e705ab05 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/SpecialModelName.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **kotlin.Long** | | [optional] +**dollarSpecialPropertyName** | **kotlin.Long** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/UserApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/UserApi.md index 5cf484387734..c7b08232ddf5 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/UserApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/UserApi.md @@ -66,7 +66,7 @@ Creates list of users with given input array val apiClient = ApiClient() val webService = apiClient.createWebservice(UserApi::class.java) -val user : kotlin.Array = // kotlin.Array | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object launch(Dispatchers.IO) { webService.createUsersWithArrayInput(user) @@ -77,7 +77,7 @@ launch(Dispatchers.IO) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.Array<User>**](User.md)| List of user object | + **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | ### Return type @@ -104,7 +104,7 @@ Creates list of users with given input array val apiClient = ApiClient() val webService = apiClient.createWebservice(UserApi::class.java) -val user : kotlin.Array = // kotlin.Array | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object launch(Dispatchers.IO) { webService.createUsersWithListInput(user) @@ -115,7 +115,7 @@ launch(Dispatchers.IO) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.Array<User>**](User.md)| List of user object | + **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt index 8dc4e6d334e9..18be349e9d6d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt @@ -15,7 +15,7 @@ interface AnotherFakeApi { * - 200: successful operation * * @param client client model - * @return [Client] + * @return [Client] */ @PATCH("another-fake/dummy") suspend fun call123testSpecialTags(@Body client: Client): Response diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 27bde56495c0..0d4492f9cced 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -14,7 +14,7 @@ interface DefaultApi { * Responses: * - 0: response * - * @return [InlineResponseDefault] + * @return [InlineResponseDefault] */ @GET("foo") suspend fun fooGet(): Response diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 8e8d0a6bf63e..05c879abb352 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -12,6 +12,8 @@ import org.openapitools.client.models.OuterComposite import org.openapitools.client.models.Pet import org.openapitools.client.models.User +import okhttp3.MultipartBody + interface FakeApi { /** * Health check endpoint @@ -19,7 +21,7 @@ interface FakeApi { * Responses: * - 200: The instance started successfully * - * @return [HealthCheckResult] + * @return [HealthCheckResult] */ @GET("fake/health") suspend fun fakeHealthGet(): Response @@ -33,10 +35,10 @@ interface FakeApi { * @param pet Pet object that needs to be added to the store * @param query1 query parameter (optional) * @param header1 header parameter (optional) - * @return [Unit] + * @return [Unit] */ @GET("fake/http-signature-test") - suspend fun fakeHttpSignatureTest(@Body pet: Pet, @Query("query_1") query1: kotlin.String, @Header("header_1") header1: kotlin.String): Response + suspend fun fakeHttpSignatureTest(@Body pet: Pet, @Query("query_1") query1: kotlin.String? = null, @Header("header_1") header1: kotlin.String): Response /** * @@ -45,7 +47,7 @@ interface FakeApi { * - 200: Output boolean * * @param body Input boolean as post body (optional) - * @return [kotlin.Boolean] + * @return [kotlin.Boolean] */ @POST("fake/outer/boolean") suspend fun fakeOuterBooleanSerialize(@Body body: kotlin.Boolean? = null): Response @@ -57,7 +59,7 @@ interface FakeApi { * - 200: Output composite * * @param outerComposite Input composite as post body (optional) - * @return [OuterComposite] + * @return [OuterComposite] */ @POST("fake/outer/composite") suspend fun fakeOuterCompositeSerialize(@Body outerComposite: OuterComposite? = null): Response @@ -69,7 +71,7 @@ interface FakeApi { * - 200: Output number * * @param body Input number as post body (optional) - * @return [java.math.BigDecimal] + * @return [java.math.BigDecimal] */ @POST("fake/outer/number") suspend fun fakeOuterNumberSerialize(@Body body: java.math.BigDecimal? = null): Response @@ -81,7 +83,7 @@ interface FakeApi { * - 200: Output string * * @param body Input string as post body (optional) - * @return [kotlin.String] + * @return [kotlin.String] */ @POST("fake/outer/string") suspend fun fakeOuterStringSerialize(@Body body: kotlin.String? = null): Response @@ -93,7 +95,7 @@ interface FakeApi { * - 200: Success * * @param fileSchemaTestClass - * @return [Unit] + * @return [Unit] */ @PUT("fake/body-with-file-schema") suspend fun testBodyWithFileSchema(@Body fileSchemaTestClass: FileSchemaTestClass): Response @@ -106,7 +108,7 @@ interface FakeApi { * * @param query * @param user - * @return [Unit] + * @return [Unit] */ @PUT("fake/body-with-query-params") suspend fun testBodyWithQueryParams(@Query("query") query: kotlin.String, @Body user: User): Response @@ -118,7 +120,7 @@ interface FakeApi { * - 200: successful operation * * @param client client model - * @return [Client] + * @return [Client] */ @PATCH("fake") suspend fun testClientModel(@Body client: Client): Response @@ -144,7 +146,7 @@ interface FakeApi { * @param dateTime None (optional) * @param password None (optional) * @param paramCallback None (optional) - * @return [Unit] + * @return [Unit] */ @FormUrlEncoded @POST("fake") @@ -158,18 +160,18 @@ interface FakeApi { * - 404: Not found * * @param enumHeaderStringArray Header parameter enum test (string array) (optional) - * @param enumHeaderString Header parameter enum test (string) (optional, default to "-efg") + * @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 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 [Unit] + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return [Unit] */ @FormUrlEncoded @GET("fake") - suspend fun testEnumParameters(@Header("enum_header_string_array") enumHeaderStringArray: kotlin.Array, @Header("enum_header_string") enumHeaderString: kotlin.String, @Query("enum_query_string_array") enumQueryStringArray: kotlin.Array, @Query("enum_query_string") enumQueryString: kotlin.String, @Query("enum_query_integer") enumQueryInteger: kotlin.Int, @Query("enum_query_double") enumQueryDouble: kotlin.Double, @Field("enum_form_string_array") enumFormStringArray: kotlin.Array, @Field("enum_form_string") enumFormString: kotlin.String): Response + suspend fun testEnumParameters(@Header("enum_header_string_array") enumHeaderStringArray: kotlin.collections.List, @Header("enum_header_string") enumHeaderString: kotlin.String, @Query("enum_query_string_array") enumQueryStringArray: kotlin.collections.List? = null, @Query("enum_query_string") enumQueryString: kotlin.String? = null, @Query("enum_query_integer") enumQueryInteger: kotlin.Int? = null, @Query("enum_query_double") enumQueryDouble: kotlin.Double? = null, @Field("enum_form_string_array") enumFormStringArray: kotlin.collections.List, @Field("enum_form_string") enumFormString: kotlin.String): Response /** * Fake endpoint to test group parameters (optional) @@ -183,10 +185,10 @@ interface FakeApi { * @param stringGroup String in group parameters (optional) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) - * @return [Unit] + * @return [Unit] */ @DELETE("fake") - suspend fun testGroupParameters(@Query("required_string_group") requiredStringGroup: kotlin.Int, @Header("required_boolean_group") requiredBooleanGroup: kotlin.Boolean, @Query("required_int64_group") requiredInt64Group: kotlin.Long, @Query("string_group") stringGroup: kotlin.Int, @Header("boolean_group") booleanGroup: kotlin.Boolean, @Query("int64_group") int64Group: kotlin.Long): Response + suspend fun testGroupParameters(@Query("required_string_group") requiredStringGroup: kotlin.Int, @Header("required_boolean_group") requiredBooleanGroup: kotlin.Boolean, @Query("required_int64_group") requiredInt64Group: kotlin.Long, @Query("string_group") stringGroup: kotlin.Int? = null, @Header("boolean_group") booleanGroup: kotlin.Boolean, @Query("int64_group") int64Group: kotlin.Long? = null): Response /** * test inline additionalProperties @@ -195,7 +197,7 @@ interface FakeApi { * - 200: successful operation * * @param requestBody request body - * @return [Unit] + * @return [Unit] */ @POST("fake/inline-additionalProperties") suspend fun testInlineAdditionalProperties(@Body requestBody: kotlin.collections.Map): Response @@ -208,7 +210,7 @@ interface FakeApi { * * @param param field1 * @param param2 field2 - * @return [Unit] + * @return [Unit] */ @FormUrlEncoded @GET("fake/jsonFormData") @@ -225,9 +227,9 @@ interface FakeApi { * @param http * @param url * @param context - * @return [Unit] + * @return [Unit] */ @PUT("fake/test-query-paramters") - suspend fun testQueryParameterCollectionFormat(@Query("pipe") pipe: kotlin.Array, @Query("ioutil") ioutil: CSVParams, @Query("http") http: SSVParams, @Query("url") url: CSVParams, @Query("context") context: kotlin.Array): Response + suspend fun testQueryParameterCollectionFormat(@Query("pipe") pipe: kotlin.collections.List, @Query("ioutil") ioutil: CSVParams, @Query("http") http: SSVParams, @Query("url") url: CSVParams, @Query("context") context: kotlin.collections.List): Response } diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt index 773483df2a67..c4733d0835ba 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt @@ -15,7 +15,7 @@ interface FakeClassnameTags123Api { * - 200: successful operation * * @param client client model - * @return [Client] + * @return [Client] */ @PATCH("fake_classname_test") suspend fun testClassname(@Body client: Client): Response diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c4a95abd2f3f..c149a3ffce34 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -8,15 +8,18 @@ import okhttp3.RequestBody import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet +import okhttp3.MultipartBody + interface PetApi { /** * Add a new pet to the store * * Responses: + * - 200: Successful operation * - 405: Invalid input * * @param pet Pet object that needs to be added to the store - * @return [Unit] + * @return [Unit] */ @POST("pet") suspend fun addPet(@Body pet: Pet): Response @@ -25,11 +28,12 @@ interface PetApi { * Deletes a pet * * Responses: + * - 200: Successful operation * - 400: Invalid pet value * * @param petId Pet id to delete * @param apiKey (optional) - * @return [Unit] + * @return [Unit] */ @DELETE("pet/{petId}") suspend fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Response @@ -42,10 +46,10 @@ interface PetApi { * - 400: Invalid status value * * @param status Status values that need to be considered for filter - * @return [kotlin.Array] + * @return [kotlin.collections.List] */ @GET("pet/findByStatus") - suspend fun findPetsByStatus(@Query("status") status: CSVParams): Response> + suspend fun findPetsByStatus(@Query("status") status: CSVParams): Response> /** * Finds Pets by tags @@ -55,11 +59,11 @@ interface PetApi { * - 400: Invalid tag value * * @param tags Tags to filter by - * @return [kotlin.Array] + * @return [kotlin.collections.List] */ @Deprecated("This api was deprecated") @GET("pet/findByTags") - suspend fun findPetsByTags(@Query("tags") tags: CSVParams): Response> + suspend fun findPetsByTags(@Query("tags") tags: CSVParams): Response> /** * Find pet by ID @@ -70,7 +74,7 @@ interface PetApi { * - 404: Pet not found * * @param petId ID of pet to return - * @return [Pet] + * @return [Pet] */ @GET("pet/{petId}") suspend fun getPetById(@Path("petId") petId: kotlin.Long): Response @@ -79,12 +83,13 @@ interface PetApi { * Update an existing pet * * Responses: + * - 200: Successful operation * - 400: Invalid ID supplied * - 404: Pet not found * - 405: Validation exception * * @param pet Pet object that needs to be added to the store - * @return [Unit] + * @return [Unit] */ @PUT("pet") suspend fun updatePet(@Body pet: Pet): Response @@ -93,12 +98,13 @@ interface PetApi { * Updates a pet in the store with form data * * Responses: + * - 200: Successful operation * - 405: Invalid input * * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return [Unit] + * @return [Unit] */ @FormUrlEncoded @POST("pet/{petId}") @@ -113,7 +119,7 @@ interface PetApi { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return [ApiResponse] + * @return [ApiResponse] */ @Multipart @POST("pet/{petId}/uploadImage") @@ -128,7 +134,7 @@ interface PetApi { * @param petId ID of pet to update * @param requiredFile file to upload * @param additionalMetadata Additional data to pass to server (optional) - * @return [ApiResponse] + * @return [ApiResponse] */ @Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 7171b3d45c58..13b1b964164c 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -16,7 +16,7 @@ interface StoreApi { * - 404: Order not found * * @param orderId ID of the order that needs to be deleted - * @return [Unit] + * @return [Unit] */ @DELETE("store/order/{order_id}") suspend fun deleteOrder(@Path("order_id") orderId: kotlin.String): Response @@ -27,7 +27,7 @@ interface StoreApi { * Responses: * - 200: successful operation * - * @return [kotlin.collections.Map] + * @return [kotlin.collections.Map] */ @GET("store/inventory") suspend fun getInventory(): Response> @@ -41,7 +41,7 @@ interface StoreApi { * - 404: Order not found * * @param orderId ID of pet that needs to be fetched - * @return [Order] + * @return [Order] */ @GET("store/order/{order_id}") suspend fun getOrderById(@Path("order_id") orderId: kotlin.Long): Response @@ -54,7 +54,7 @@ interface StoreApi { * - 400: Invalid Order * * @param order order placed for purchasing the pet - * @return [Order] + * @return [Order] */ @POST("store/order") suspend fun placeOrder(@Body order: Order): Response diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 2d0bd056b8ef..5faf314cdde8 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -15,7 +15,7 @@ interface UserApi { * - 0: successful operation * * @param user Created user object - * @return [Unit] + * @return [Unit] */ @POST("user") suspend fun createUser(@Body user: User): Response @@ -27,10 +27,10 @@ interface UserApi { * - 0: successful operation * * @param user List of user object - * @return [Unit] + * @return [Unit] */ @POST("user/createWithArray") - suspend fun createUsersWithArrayInput(@Body user: kotlin.Array): Response + suspend fun createUsersWithArrayInput(@Body user: kotlin.collections.List): Response /** * Creates list of users with given input array @@ -39,10 +39,10 @@ interface UserApi { * - 0: successful operation * * @param user List of user object - * @return [Unit] + * @return [Unit] */ @POST("user/createWithList") - suspend fun createUsersWithListInput(@Body user: kotlin.Array): Response + suspend fun createUsersWithListInput(@Body user: kotlin.collections.List): Response /** * Delete user @@ -52,7 +52,7 @@ interface UserApi { * - 404: User not found * * @param username The name that needs to be deleted - * @return [Unit] + * @return [Unit] */ @DELETE("user/{username}") suspend fun deleteUser(@Path("username") username: kotlin.String): Response @@ -66,7 +66,7 @@ interface UserApi { * - 404: User not found * * @param username The name that needs to be fetched. Use user1 for testing. - * @return [User] + * @return [User] */ @GET("user/{username}") suspend fun getUserByName(@Path("username") username: kotlin.String): Response @@ -80,7 +80,7 @@ interface UserApi { * * @param username The user name for login * @param password The password for login in clear text - * @return [kotlin.String] + * @return [kotlin.String] */ @GET("user/login") suspend fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Response @@ -91,7 +91,7 @@ interface UserApi { * Responses: * - 0: successful operation * - * @return [Unit] + * @return [Unit] */ @GET("user/logout") suspend fun logoutUser(): Response @@ -105,7 +105,7 @@ interface UserApi { * * @param username name that need to be deleted * @param user Updated user object - * @return [Unit] + * @return [Unit] */ @PUT("user/{username}") suspend fun updateUser(@Path("username") username: kotlin.String, @Body user: User): Response diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d40b63497826..faf5bd523fe0 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -21,7 +21,8 @@ import retrofit2.converter.gson.GsonConverterFactory class ApiClient( private var baseUrl: String = defaultBasePath, private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: GsonBuilder = Serializer.gsonBuilder + private val serializerBuilder: GsonBuilder = Serializer.gsonBuilder, + private val okHttpClient : OkHttpClient? = null ) { private val apiAuthorizations = mutableMapOf() var logger: ((String) -> Unit)? = null @@ -72,7 +73,7 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, + authName: String, bearerToken: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { setBearerToken(bearerToken) @@ -82,8 +83,8 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, - username: String, + authName: String, + username: String, password: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { setCredentials(username, password) @@ -93,10 +94,10 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, - clientId: String, - secret: String, - username: String, + authName: String, + clientId: String, + secret: String, + username: String, password: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { getTokenEndPoint() @@ -224,7 +225,8 @@ class ApiClient( } fun createService(serviceClass: Class): S { - return retrofitBuilder.client(clientBuilder.build()).build().create(serviceClass) + val usedClient = this.okHttpClient ?: clientBuilder.build() + return retrofitBuilder.client(usedClient).build().create(serviceClass) } private fun normalizeBaseUrl() { @@ -242,10 +244,10 @@ class ApiClient( } } - companion object { + companion object { @JvmStatic val defaultBasePath: String by lazy { System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") } } -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 6465f1485531..b80e0390de2d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -11,7 +11,6 @@ import java.util.Date object Serializer { @JvmStatic val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index d69683337761..54c88ca8e900 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -26,6 +26,7 @@ import java.io.Serializable * @param int64 * @param float * @param double + * @param decimal * @param string * @param binary * @param dateTime @@ -53,6 +54,8 @@ data class FormatTest ( val float: kotlin.Float? = null, @SerializedName("double") val double: kotlin.Double? = null, + @SerializedName("decimal") + val decimal: java.math.BigDecimal? = null, @SerializedName("string") val string: kotlin.String? = null, @SerializedName("binary") diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/List.kt index 8de0d080cedc..d614d69d93bd 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/List.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param `123minusList` + * @param `123list` */ data class List ( @SerializedName("123-list") - val `123minusList`: kotlin.String? = null + val `123list`: kotlin.String? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index 23cd075e530d..2dfb12b8b69b 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + * @param dollarSpecialPropertyName */ data class SpecialModelname ( @SerializedName("\$special[property.name]") - val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null + val dollarSpecialPropertyName: kotlin.Long? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/FILES b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/FILES index 106ea4db2ae5..2fcf69d6457e 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/FILES @@ -27,12 +27,6 @@ docs/Foo.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineObject.md -docs/InlineObject1.md -docs/InlineObject2.md -docs/InlineObject3.md -docs/InlineObject4.md -docs/InlineObject5.md docs/InlineResponseDefault.md docs/List.md docs/MapTest.md @@ -100,12 +94,6 @@ src/main/kotlin/org/openapitools/client/models/Foo.kt src/main/kotlin/org/openapitools/client/models/FormatTest.kt src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt -src/main/kotlin/org/openapitools/client/models/InlineObject.kt -src/main/kotlin/org/openapitools/client/models/InlineObject1.kt -src/main/kotlin/org/openapitools/client/models/InlineObject2.kt -src/main/kotlin/org/openapitools/client/models/InlineObject3.kt -src/main/kotlin/org/openapitools/client/models/InlineObject4.kt -src/main/kotlin/org/openapitools/client/models/InlineObject5.kt src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt src/main/kotlin/org/openapitools/client/models/List.kt src/main/kotlin/org/openapitools/client/models/MapTest.kt diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/README.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/README.md index 7d37a6283317..fca869bcf493 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/README.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/README.md @@ -101,12 +101,6 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - - [org.openapitools.client.models.InlineObject](docs/InlineObject.md) - - [org.openapitools.client.models.InlineObject1](docs/InlineObject1.md) - - [org.openapitools.client.models.InlineObject2](docs/InlineObject2.md) - - [org.openapitools.client.models.InlineObject3](docs/InlineObject3.md) - - [org.openapitools.client.models.InlineObject4](docs/InlineObject4.md) - - [org.openapitools.client.models.InlineObject5](docs/InlineObject5.md) - [org.openapitools.client.models.InlineResponseDefault](docs/InlineResponseDefault.md) - [org.openapitools.client.models.List](docs/List.md) - [org.openapitools.client.models.MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/build.gradle b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/build.gradle index a6f5c0fe4927..d459b42d020b 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/build.gradle +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/build.gradle @@ -31,8 +31,9 @@ test { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" compile "com.google.code.gson:gson:2.8.6" + compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" + compile "com.squareup.okhttp3:logging-interceptor:4.4.0" compile "io.reactivex:rxjava:$rxJavaVersion" compile "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion" compile "com.squareup.retrofit2:retrofit:$retrofitVersion" diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FakeApi.md index 6f5c1cbb479b..f94e91773ad5 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FakeApi.md @@ -440,13 +440,13 @@ To test enum parameters val apiClient = ApiClient() val webService = apiClient.createWebservice(FakeApi::class.java) -val enumHeaderStringArray : kotlin.Array = // kotlin.Array | Header parameter enum test (string array) +val enumHeaderStringArray : kotlin.collections.List = // kotlin.collections.List | Header parameter enum test (string array) val enumHeaderString : kotlin.String = enumHeaderString_example // kotlin.String | Header parameter enum test (string) -val enumQueryStringArray : kotlin.Array = // kotlin.Array | Query parameter enum test (string array) +val enumQueryStringArray : kotlin.collections.List = // kotlin.collections.List | Query parameter enum test (string array) val enumQueryString : kotlin.String = enumQueryString_example // kotlin.String | Query parameter enum test (string) val enumQueryInteger : kotlin.Int = 56 // kotlin.Int | Query parameter enum test (double) val enumQueryDouble : kotlin.Double = 1.2 // kotlin.Double | Query parameter enum test (double) -val enumFormStringArray : kotlin.Array = enumFormStringArray_example // kotlin.Array | Form parameter enum test (string array) +val enumFormStringArray : kotlin.collections.List = enumFormStringArray_example // kotlin.collections.List | Form parameter enum test (string array) val enumFormString : kotlin.String = enumFormString_example // kotlin.String | Form parameter enum test (string) webService.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) @@ -456,14 +456,14 @@ webService.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQuery Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] - **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] - **enumQueryStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] - **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to "$"] [enum: >, $] - **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -617,11 +617,11 @@ To test the collection format in query parameters val apiClient = ApiClient() val webService = apiClient.createWebservice(FakeApi::class.java) -val pipe : kotlin.Array = // kotlin.Array | -val ioutil : kotlin.Array = // kotlin.Array | -val http : kotlin.Array = // kotlin.Array | -val url : kotlin.Array = // kotlin.Array | -val context : kotlin.Array = // kotlin.Array | +val pipe : kotlin.collections.List = // kotlin.collections.List | +val ioutil : kotlin.collections.List = // kotlin.collections.List | +val http : kotlin.collections.List = // kotlin.collections.List | +val url : kotlin.collections.List = // kotlin.collections.List | +val context : kotlin.collections.List = // kotlin.collections.List | webService.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) ``` @@ -630,11 +630,11 @@ webService.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **ioutil** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **http** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **url** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **context** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | + **pipe** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **ioutil** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **http** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **url** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **context** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FormatTest.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FormatTest.md index 0357923c97a5..01b408499e73 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **int64** | **kotlin.Long** | | [optional] **float** | **kotlin.Float** | | [optional] **double** | **kotlin.Double** | | [optional] +**decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] **string** | **kotlin.String** | | [optional] **binary** | [**java.io.File**](java.io.File.md) | | [optional] **dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/List.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/List.md index 13a09a4c4141..f426d541a409 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/List.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/List.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**`123minusList`** | **kotlin.String** | | [optional] +**`123list`** | **kotlin.String** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/PetApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/PetApi.md index 7445920ab036..32d031b57a96 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/PetApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/PetApi.md @@ -103,20 +103,20 @@ Multiple status values can be provided with comma separated strings val apiClient = ApiClient() val webService = apiClient.createWebservice(PetApi::class.java) -val status : kotlin.Array = // kotlin.Array | Status values that need to be considered for filter +val status : kotlin.collections.List = // kotlin.collections.List | Status values that need to be considered for filter -val result : kotlin.Array = webService.findPetsByStatus(status) +val result : kotlin.collections.List = webService.findPetsByStatus(status) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] ### Return type -[**kotlin.Array<Pet>**](Pet.md) +[**kotlin.collections.List<Pet>**](Pet.md) ### Authorization @@ -141,20 +141,20 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 val apiClient = ApiClient() val webService = apiClient.createWebservice(PetApi::class.java) -val tags : kotlin.Array = // kotlin.Array | Tags to filter by +val tags : kotlin.collections.List = // kotlin.collections.List | Tags to filter by -val result : kotlin.Array = webService.findPetsByTags(tags) +val result : kotlin.collections.List = webService.findPetsByTags(tags) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + **tags** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Tags to filter by | ### Return type -[**kotlin.Array<Pet>**](Pet.md) +[**kotlin.collections.List<Pet>**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/SpecialModelName.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/SpecialModelName.md index 282649449d96..b179e705ab05 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/SpecialModelName.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **kotlin.Long** | | [optional] +**dollarSpecialPropertyName** | **kotlin.Long** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/UserApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/UserApi.md index b667d3b0a600..bb904d243cf7 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/UserApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/UserApi.md @@ -64,7 +64,7 @@ Creates list of users with given input array val apiClient = ApiClient() val webService = apiClient.createWebservice(UserApi::class.java) -val user : kotlin.Array = // kotlin.Array | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object webService.createUsersWithArrayInput(user) ``` @@ -73,7 +73,7 @@ webService.createUsersWithArrayInput(user) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.Array<User>**](User.md)| List of user object | + **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | ### Return type @@ -100,7 +100,7 @@ Creates list of users with given input array val apiClient = ApiClient() val webService = apiClient.createWebservice(UserApi::class.java) -val user : kotlin.Array = // kotlin.Array | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object webService.createUsersWithListInput(user) ``` @@ -109,7 +109,7 @@ webService.createUsersWithListInput(user) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.Array<User>**](User.md)| List of user object | + **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt index e2a7aad9b72e..2a83ecce73ef 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt @@ -15,7 +15,7 @@ interface AnotherFakeApi { * - 200: successful operation * * @param client client model - * @return [Call]<[Client]> + * @return [Call]<[Client]> */ @PATCH("another-fake/dummy") fun call123testSpecialTags(@Body client: Client): Observable diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 6d4eae90743f..c4aa25b4eeaa 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -14,7 +14,7 @@ interface DefaultApi { * Responses: * - 0: response * - * @return [Call]<[InlineResponseDefault]> + * @return [Call]<[InlineResponseDefault]> */ @GET("foo") fun fooGet(): Observable diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index cf681d2069ce..b2971b603dd7 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -12,6 +12,8 @@ import org.openapitools.client.models.OuterComposite import org.openapitools.client.models.Pet import org.openapitools.client.models.User +import okhttp3.MultipartBody + interface FakeApi { /** * Health check endpoint @@ -19,7 +21,7 @@ interface FakeApi { * Responses: * - 200: The instance started successfully * - * @return [Call]<[HealthCheckResult]> + * @return [Call]<[HealthCheckResult]> */ @GET("fake/health") fun fakeHealthGet(): Observable @@ -33,10 +35,10 @@ interface FakeApi { * @param pet Pet object that needs to be added to the store * @param query1 query parameter (optional) * @param header1 header parameter (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @GET("fake/http-signature-test") - fun fakeHttpSignatureTest(@Body pet: Pet, @Query("query_1") query1: kotlin.String, @Header("header_1") header1: kotlin.String): Observable + fun fakeHttpSignatureTest(@Body pet: Pet, @Query("query_1") query1: kotlin.String? = null, @Header("header_1") header1: kotlin.String): Observable /** * @@ -45,7 +47,7 @@ interface FakeApi { * - 200: Output boolean * * @param body Input boolean as post body (optional) - * @return [Call]<[kotlin.Boolean]> + * @return [Call]<[kotlin.Boolean]> */ @POST("fake/outer/boolean") fun fakeOuterBooleanSerialize(@Body body: kotlin.Boolean? = null): Observable @@ -57,7 +59,7 @@ interface FakeApi { * - 200: Output composite * * @param outerComposite Input composite as post body (optional) - * @return [Call]<[OuterComposite]> + * @return [Call]<[OuterComposite]> */ @POST("fake/outer/composite") fun fakeOuterCompositeSerialize(@Body outerComposite: OuterComposite? = null): Observable @@ -69,7 +71,7 @@ interface FakeApi { * - 200: Output number * * @param body Input number as post body (optional) - * @return [Call]<[java.math.BigDecimal]> + * @return [Call]<[java.math.BigDecimal]> */ @POST("fake/outer/number") fun fakeOuterNumberSerialize(@Body body: java.math.BigDecimal? = null): Observable @@ -81,7 +83,7 @@ interface FakeApi { * - 200: Output string * * @param body Input string as post body (optional) - * @return [Call]<[kotlin.String]> + * @return [Call]<[kotlin.String]> */ @POST("fake/outer/string") fun fakeOuterStringSerialize(@Body body: kotlin.String? = null): Observable @@ -93,7 +95,7 @@ interface FakeApi { * - 200: Success * * @param fileSchemaTestClass - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("fake/body-with-file-schema") fun testBodyWithFileSchema(@Body fileSchemaTestClass: FileSchemaTestClass): Observable @@ -106,7 +108,7 @@ interface FakeApi { * * @param query * @param user - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("fake/body-with-query-params") fun testBodyWithQueryParams(@Query("query") query: kotlin.String, @Body user: User): Observable @@ -118,7 +120,7 @@ interface FakeApi { * - 200: successful operation * * @param client client model - * @return [Call]<[Client]> + * @return [Call]<[Client]> */ @PATCH("fake") fun testClientModel(@Body client: Client): Observable @@ -144,7 +146,7 @@ interface FakeApi { * @param dateTime None (optional) * @param password None (optional) * @param paramCallback None (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @FormUrlEncoded @POST("fake") @@ -158,18 +160,18 @@ interface FakeApi { * - 404: Not found * * @param enumHeaderStringArray Header parameter enum test (string array) (optional) - * @param enumHeaderString Header parameter enum test (string) (optional, default to "-efg") + * @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 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 [Call]<[Unit]> + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return [Call]<[Unit]> */ @FormUrlEncoded @GET("fake") - fun testEnumParameters(@Header("enum_header_string_array") enumHeaderStringArray: kotlin.Array, @Header("enum_header_string") enumHeaderString: kotlin.String, @Query("enum_query_string_array") enumQueryStringArray: kotlin.Array, @Query("enum_query_string") enumQueryString: kotlin.String, @Query("enum_query_integer") enumQueryInteger: kotlin.Int, @Query("enum_query_double") enumQueryDouble: kotlin.Double, @Field("enum_form_string_array") enumFormStringArray: kotlin.Array, @Field("enum_form_string") enumFormString: kotlin.String): Observable + fun testEnumParameters(@Header("enum_header_string_array") enumHeaderStringArray: kotlin.collections.List, @Header("enum_header_string") enumHeaderString: kotlin.String, @Query("enum_query_string_array") enumQueryStringArray: kotlin.collections.List? = null, @Query("enum_query_string") enumQueryString: kotlin.String? = null, @Query("enum_query_integer") enumQueryInteger: kotlin.Int? = null, @Query("enum_query_double") enumQueryDouble: kotlin.Double? = null, @Field("enum_form_string_array") enumFormStringArray: kotlin.collections.List, @Field("enum_form_string") enumFormString: kotlin.String): Observable /** * Fake endpoint to test group parameters (optional) @@ -183,10 +185,10 @@ interface FakeApi { * @param stringGroup String in group parameters (optional) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("fake") - fun testGroupParameters(@Query("required_string_group") requiredStringGroup: kotlin.Int, @Header("required_boolean_group") requiredBooleanGroup: kotlin.Boolean, @Query("required_int64_group") requiredInt64Group: kotlin.Long, @Query("string_group") stringGroup: kotlin.Int, @Header("boolean_group") booleanGroup: kotlin.Boolean, @Query("int64_group") int64Group: kotlin.Long): Observable + fun testGroupParameters(@Query("required_string_group") requiredStringGroup: kotlin.Int, @Header("required_boolean_group") requiredBooleanGroup: kotlin.Boolean, @Query("required_int64_group") requiredInt64Group: kotlin.Long, @Query("string_group") stringGroup: kotlin.Int? = null, @Header("boolean_group") booleanGroup: kotlin.Boolean, @Query("int64_group") int64Group: kotlin.Long? = null): Observable /** * test inline additionalProperties @@ -195,7 +197,7 @@ interface FakeApi { * - 200: successful operation * * @param requestBody request body - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("fake/inline-additionalProperties") fun testInlineAdditionalProperties(@Body requestBody: kotlin.collections.Map): Observable @@ -208,7 +210,7 @@ interface FakeApi { * * @param param field1 * @param param2 field2 - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @FormUrlEncoded @GET("fake/jsonFormData") @@ -225,9 +227,9 @@ interface FakeApi { * @param http * @param url * @param context - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("fake/test-query-paramters") - fun testQueryParameterCollectionFormat(@Query("pipe") pipe: kotlin.Array, @Query("ioutil") ioutil: CSVParams, @Query("http") http: SSVParams, @Query("url") url: CSVParams, @Query("context") context: kotlin.Array): Observable + fun testQueryParameterCollectionFormat(@Query("pipe") pipe: kotlin.collections.List, @Query("ioutil") ioutil: CSVParams, @Query("http") http: SSVParams, @Query("url") url: CSVParams, @Query("context") context: kotlin.collections.List): Observable } diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt index 5c6c95d2db49..4a5856cdd0f4 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt @@ -15,7 +15,7 @@ interface FakeClassnameTags123Api { * - 200: successful operation * * @param client client model - * @return [Call]<[Client]> + * @return [Call]<[Client]> */ @PATCH("fake_classname_test") fun testClassname(@Body client: Client): Observable diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 8532622d6390..7564e9260dba 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -8,15 +8,18 @@ import rx.Observable import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet +import okhttp3.MultipartBody + interface PetApi { /** * Add a new pet to the store * * Responses: + * - 200: Successful operation * - 405: Invalid input * * @param pet Pet object that needs to be added to the store - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("pet") fun addPet(@Body pet: Pet): Observable @@ -25,11 +28,12 @@ interface PetApi { * Deletes a pet * * Responses: + * - 200: Successful operation * - 400: Invalid pet value * * @param petId Pet id to delete * @param apiKey (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("pet/{petId}") fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Observable @@ -42,10 +46,10 @@ interface PetApi { * - 400: Invalid status value * * @param status Status values that need to be considered for filter - * @return [Call]<[kotlin.Array]> + * @return [Call]<[kotlin.collections.List]> */ @GET("pet/findByStatus") - fun findPetsByStatus(@Query("status") status: CSVParams): Observable> + fun findPetsByStatus(@Query("status") status: CSVParams): Observable> /** * Finds Pets by tags @@ -55,11 +59,11 @@ interface PetApi { * - 400: Invalid tag value * * @param tags Tags to filter by - * @return [Call]<[kotlin.Array]> + * @return [Call]<[kotlin.collections.List]> */ @Deprecated("This api was deprecated") @GET("pet/findByTags") - fun findPetsByTags(@Query("tags") tags: CSVParams): Observable> + fun findPetsByTags(@Query("tags") tags: CSVParams): Observable> /** * Find pet by ID @@ -70,7 +74,7 @@ interface PetApi { * - 404: Pet not found * * @param petId ID of pet to return - * @return [Call]<[Pet]> + * @return [Call]<[Pet]> */ @GET("pet/{petId}") fun getPetById(@Path("petId") petId: kotlin.Long): Observable @@ -79,12 +83,13 @@ interface PetApi { * Update an existing pet * * Responses: + * - 200: Successful operation * - 400: Invalid ID supplied * - 404: Pet not found * - 405: Validation exception * * @param pet Pet object that needs to be added to the store - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("pet") fun updatePet(@Body pet: Pet): Observable @@ -93,12 +98,13 @@ interface PetApi { * Updates a pet in the store with form data * * Responses: + * - 200: Successful operation * - 405: Invalid input * * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @FormUrlEncoded @POST("pet/{petId}") @@ -113,7 +119,7 @@ interface PetApi { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ApiResponse]> */ @Multipart @POST("pet/{petId}/uploadImage") @@ -128,7 +134,7 @@ interface PetApi { * @param petId ID of pet to update * @param requiredFile file to upload * @param additionalMetadata Additional data to pass to server (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ApiResponse]> */ @Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index fef564f9465f..5b2aabc8fd65 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -16,7 +16,7 @@ interface StoreApi { * - 404: Order not found * * @param orderId ID of the order that needs to be deleted - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("store/order/{order_id}") fun deleteOrder(@Path("order_id") orderId: kotlin.String): Observable @@ -27,7 +27,7 @@ interface StoreApi { * Responses: * - 200: successful operation * - * @return [Call]<[kotlin.collections.Map]> + * @return [Call]<[kotlin.collections.Map]> */ @GET("store/inventory") fun getInventory(): Observable> @@ -41,7 +41,7 @@ interface StoreApi { * - 404: Order not found * * @param orderId ID of pet that needs to be fetched - * @return [Call]<[Order]> + * @return [Call]<[Order]> */ @GET("store/order/{order_id}") fun getOrderById(@Path("order_id") orderId: kotlin.Long): Observable @@ -54,7 +54,7 @@ interface StoreApi { * - 400: Invalid Order * * @param order order placed for purchasing the pet - * @return [Call]<[Order]> + * @return [Call]<[Order]> */ @POST("store/order") fun placeOrder(@Body order: Order): Observable diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 465705c8ef72..6884a8b85c1e 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -15,7 +15,7 @@ interface UserApi { * - 0: successful operation * * @param user Created user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("user") fun createUser(@Body user: User): Observable @@ -27,10 +27,10 @@ interface UserApi { * - 0: successful operation * * @param user List of user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("user/createWithArray") - fun createUsersWithArrayInput(@Body user: kotlin.Array): Observable + fun createUsersWithArrayInput(@Body user: kotlin.collections.List): Observable /** * Creates list of users with given input array @@ -39,10 +39,10 @@ interface UserApi { * - 0: successful operation * * @param user List of user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("user/createWithList") - fun createUsersWithListInput(@Body user: kotlin.Array): Observable + fun createUsersWithListInput(@Body user: kotlin.collections.List): Observable /** * Delete user @@ -52,7 +52,7 @@ interface UserApi { * - 404: User not found * * @param username The name that needs to be deleted - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("user/{username}") fun deleteUser(@Path("username") username: kotlin.String): Observable @@ -66,7 +66,7 @@ interface UserApi { * - 404: User not found * * @param username The name that needs to be fetched. Use user1 for testing. - * @return [Call]<[User]> + * @return [Call]<[User]> */ @GET("user/{username}") fun getUserByName(@Path("username") username: kotlin.String): Observable @@ -80,7 +80,7 @@ interface UserApi { * * @param username The user name for login * @param password The password for login in clear text - * @return [Call]<[kotlin.String]> + * @return [Call]<[kotlin.String]> */ @GET("user/login") fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Observable @@ -91,7 +91,7 @@ interface UserApi { * Responses: * - 0: successful operation * - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @GET("user/logout") fun logoutUser(): Observable @@ -105,7 +105,7 @@ interface UserApi { * * @param username name that need to be deleted * @param user Updated user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("user/{username}") fun updateUser(@Path("username") username: kotlin.String, @Body user: User): Observable diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index eaf1cd79b17f..656b5e261e8f 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -22,7 +22,8 @@ import retrofit2.converter.gson.GsonConverterFactory class ApiClient( private var baseUrl: String = defaultBasePath, private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: GsonBuilder = Serializer.gsonBuilder + private val serializerBuilder: GsonBuilder = Serializer.gsonBuilder, + private val okHttpClient : OkHttpClient? = null ) { private val apiAuthorizations = mutableMapOf() var logger: ((String) -> Unit)? = null @@ -74,7 +75,7 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, + authName: String, bearerToken: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { setBearerToken(bearerToken) @@ -84,8 +85,8 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, - username: String, + authName: String, + username: String, password: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { setCredentials(username, password) @@ -95,10 +96,10 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, - clientId: String, - secret: String, - username: String, + authName: String, + clientId: String, + secret: String, + username: String, password: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { getTokenEndPoint() @@ -226,7 +227,8 @@ class ApiClient( } fun createService(serviceClass: Class): S { - return retrofitBuilder.client(clientBuilder.build()).build().create(serviceClass) + val usedClient = this.okHttpClient ?: clientBuilder.build() + return retrofitBuilder.client(usedClient).build().create(serviceClass) } private fun normalizeBaseUrl() { @@ -244,10 +246,10 @@ class ApiClient( } } - companion object { + companion object { @JvmStatic val defaultBasePath: String by lazy { System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") } } -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 6465f1485531..b80e0390de2d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -11,7 +11,6 @@ import java.util.Date object Serializer { @JvmStatic val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index d69683337761..54c88ca8e900 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -26,6 +26,7 @@ import java.io.Serializable * @param int64 * @param float * @param double + * @param decimal * @param string * @param binary * @param dateTime @@ -53,6 +54,8 @@ data class FormatTest ( val float: kotlin.Float? = null, @SerializedName("double") val double: kotlin.Double? = null, + @SerializedName("decimal") + val decimal: java.math.BigDecimal? = null, @SerializedName("string") val string: kotlin.String? = null, @SerializedName("binary") diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/List.kt index 8de0d080cedc..d614d69d93bd 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/List.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param `123minusList` + * @param `123list` */ data class List ( @SerializedName("123-list") - val `123minusList`: kotlin.String? = null + val `123list`: kotlin.String? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index 23cd075e530d..2dfb12b8b69b 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + * @param dollarSpecialPropertyName */ data class SpecialModelname ( @SerializedName("\$special[property.name]") - val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null + val dollarSpecialPropertyName: kotlin.Long? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/FILES b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/FILES index 106ea4db2ae5..2fcf69d6457e 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/FILES @@ -27,12 +27,6 @@ docs/Foo.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineObject.md -docs/InlineObject1.md -docs/InlineObject2.md -docs/InlineObject3.md -docs/InlineObject4.md -docs/InlineObject5.md docs/InlineResponseDefault.md docs/List.md docs/MapTest.md @@ -100,12 +94,6 @@ src/main/kotlin/org/openapitools/client/models/Foo.kt src/main/kotlin/org/openapitools/client/models/FormatTest.kt src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt -src/main/kotlin/org/openapitools/client/models/InlineObject.kt -src/main/kotlin/org/openapitools/client/models/InlineObject1.kt -src/main/kotlin/org/openapitools/client/models/InlineObject2.kt -src/main/kotlin/org/openapitools/client/models/InlineObject3.kt -src/main/kotlin/org/openapitools/client/models/InlineObject4.kt -src/main/kotlin/org/openapitools/client/models/InlineObject5.kt src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt src/main/kotlin/org/openapitools/client/models/List.kt src/main/kotlin/org/openapitools/client/models/MapTest.kt diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/README.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/README.md index 7d37a6283317..fca869bcf493 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/README.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/README.md @@ -101,12 +101,6 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - - [org.openapitools.client.models.InlineObject](docs/InlineObject.md) - - [org.openapitools.client.models.InlineObject1](docs/InlineObject1.md) - - [org.openapitools.client.models.InlineObject2](docs/InlineObject2.md) - - [org.openapitools.client.models.InlineObject3](docs/InlineObject3.md) - - [org.openapitools.client.models.InlineObject4](docs/InlineObject4.md) - - [org.openapitools.client.models.InlineObject5](docs/InlineObject5.md) - [org.openapitools.client.models.InlineResponseDefault](docs/InlineResponseDefault.md) - [org.openapitools.client.models.List](docs/List.md) - [org.openapitools.client.models.MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/build.gradle b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/build.gradle index 0f07a7da1243..745b5ece43de 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/build.gradle +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/build.gradle @@ -31,8 +31,9 @@ test { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" compile "com.google.code.gson:gson:2.8.6" + compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" + compile "com.squareup.okhttp3:logging-interceptor:4.4.0" compile "io.reactivex.rxjava2:rxjava:$rxJava2Version" compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion" compile "com.squareup.retrofit2:retrofit:$retrofitVersion" diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FakeApi.md index 6f5c1cbb479b..f94e91773ad5 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FakeApi.md @@ -440,13 +440,13 @@ To test enum parameters val apiClient = ApiClient() val webService = apiClient.createWebservice(FakeApi::class.java) -val enumHeaderStringArray : kotlin.Array = // kotlin.Array | Header parameter enum test (string array) +val enumHeaderStringArray : kotlin.collections.List = // kotlin.collections.List | Header parameter enum test (string array) val enumHeaderString : kotlin.String = enumHeaderString_example // kotlin.String | Header parameter enum test (string) -val enumQueryStringArray : kotlin.Array = // kotlin.Array | Query parameter enum test (string array) +val enumQueryStringArray : kotlin.collections.List = // kotlin.collections.List | Query parameter enum test (string array) val enumQueryString : kotlin.String = enumQueryString_example // kotlin.String | Query parameter enum test (string) val enumQueryInteger : kotlin.Int = 56 // kotlin.Int | Query parameter enum test (double) val enumQueryDouble : kotlin.Double = 1.2 // kotlin.Double | Query parameter enum test (double) -val enumFormStringArray : kotlin.Array = enumFormStringArray_example // kotlin.Array | Form parameter enum test (string array) +val enumFormStringArray : kotlin.collections.List = enumFormStringArray_example // kotlin.collections.List | Form parameter enum test (string array) val enumFormString : kotlin.String = enumFormString_example // kotlin.String | Form parameter enum test (string) webService.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) @@ -456,14 +456,14 @@ webService.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQuery Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] - **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] - **enumQueryStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] - **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to "$"] [enum: >, $] - **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -617,11 +617,11 @@ To test the collection format in query parameters val apiClient = ApiClient() val webService = apiClient.createWebservice(FakeApi::class.java) -val pipe : kotlin.Array = // kotlin.Array | -val ioutil : kotlin.Array = // kotlin.Array | -val http : kotlin.Array = // kotlin.Array | -val url : kotlin.Array = // kotlin.Array | -val context : kotlin.Array = // kotlin.Array | +val pipe : kotlin.collections.List = // kotlin.collections.List | +val ioutil : kotlin.collections.List = // kotlin.collections.List | +val http : kotlin.collections.List = // kotlin.collections.List | +val url : kotlin.collections.List = // kotlin.collections.List | +val context : kotlin.collections.List = // kotlin.collections.List | webService.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) ``` @@ -630,11 +630,11 @@ webService.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pipe** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **ioutil** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **http** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **url** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | - **context** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| | + **pipe** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **ioutil** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **http** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **url** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | + **context** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FormatTest.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FormatTest.md index 0357923c97a5..01b408499e73 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **int64** | **kotlin.Long** | | [optional] **float** | **kotlin.Float** | | [optional] **double** | **kotlin.Double** | | [optional] +**decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] **string** | **kotlin.String** | | [optional] **binary** | [**java.io.File**](java.io.File.md) | | [optional] **dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/List.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/List.md index 13a09a4c4141..f426d541a409 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/List.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/List.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**`123minusList`** | **kotlin.String** | | [optional] +**`123list`** | **kotlin.String** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/PetApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/PetApi.md index 7445920ab036..32d031b57a96 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/PetApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/PetApi.md @@ -103,20 +103,20 @@ Multiple status values can be provided with comma separated strings val apiClient = ApiClient() val webService = apiClient.createWebservice(PetApi::class.java) -val status : kotlin.Array = // kotlin.Array | Status values that need to be considered for filter +val status : kotlin.collections.List = // kotlin.collections.List | Status values that need to be considered for filter -val result : kotlin.Array = webService.findPetsByStatus(status) +val result : kotlin.collections.List = webService.findPetsByStatus(status) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] ### Return type -[**kotlin.Array<Pet>**](Pet.md) +[**kotlin.collections.List<Pet>**](Pet.md) ### Authorization @@ -141,20 +141,20 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 val apiClient = ApiClient() val webService = apiClient.createWebservice(PetApi::class.java) -val tags : kotlin.Array = // kotlin.Array | Tags to filter by +val tags : kotlin.collections.List = // kotlin.collections.List | Tags to filter by -val result : kotlin.Array = webService.findPetsByTags(tags) +val result : kotlin.collections.List = webService.findPetsByTags(tags) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + **tags** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Tags to filter by | ### Return type -[**kotlin.Array<Pet>**](Pet.md) +[**kotlin.collections.List<Pet>**](Pet.md) ### Authorization diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/SpecialModelName.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/SpecialModelName.md index 282649449d96..b179e705ab05 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/SpecialModelName.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **kotlin.Long** | | [optional] +**dollarSpecialPropertyName** | **kotlin.Long** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/UserApi.md b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/UserApi.md index b667d3b0a600..bb904d243cf7 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/UserApi.md +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/UserApi.md @@ -64,7 +64,7 @@ Creates list of users with given input array val apiClient = ApiClient() val webService = apiClient.createWebservice(UserApi::class.java) -val user : kotlin.Array = // kotlin.Array | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object webService.createUsersWithArrayInput(user) ``` @@ -73,7 +73,7 @@ webService.createUsersWithArrayInput(user) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.Array<User>**](User.md)| List of user object | + **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | ### Return type @@ -100,7 +100,7 @@ Creates list of users with given input array val apiClient = ApiClient() val webService = apiClient.createWebservice(UserApi::class.java) -val user : kotlin.Array = // kotlin.Array | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object webService.createUsersWithListInput(user) ``` @@ -109,7 +109,7 @@ webService.createUsersWithListInput(user) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**kotlin.Array<User>**](User.md)| List of user object | + **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt index 21fe5e2e2afb..269f69f3fee1 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt @@ -16,7 +16,7 @@ interface AnotherFakeApi { * - 200: successful operation * * @param client client model - * @return [Call]<[Client]> + * @return [Call]<[Client]> */ @PATCH("another-fake/dummy") fun call123testSpecialTags(@Body client: Client): Single diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 7ccf2391af88..9247827ae175 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -15,7 +15,7 @@ interface DefaultApi { * Responses: * - 0: response * - * @return [Call]<[InlineResponseDefault]> + * @return [Call]<[InlineResponseDefault]> */ @GET("foo") fun fooGet(): Single diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 079756251046..19579ff31393 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -13,6 +13,8 @@ import org.openapitools.client.models.OuterComposite import org.openapitools.client.models.Pet import org.openapitools.client.models.User +import okhttp3.MultipartBody + interface FakeApi { /** * Health check endpoint @@ -20,7 +22,7 @@ interface FakeApi { * Responses: * - 200: The instance started successfully * - * @return [Call]<[HealthCheckResult]> + * @return [Call]<[HealthCheckResult]> */ @GET("fake/health") fun fakeHealthGet(): Single @@ -34,10 +36,10 @@ interface FakeApi { * @param pet Pet object that needs to be added to the store * @param query1 query parameter (optional) * @param header1 header parameter (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @GET("fake/http-signature-test") - fun fakeHttpSignatureTest(@Body pet: Pet, @Query("query_1") query1: kotlin.String, @Header("header_1") header1: kotlin.String): Completable + fun fakeHttpSignatureTest(@Body pet: Pet, @Query("query_1") query1: kotlin.String? = null, @Header("header_1") header1: kotlin.String): Completable /** * @@ -46,7 +48,7 @@ interface FakeApi { * - 200: Output boolean * * @param body Input boolean as post body (optional) - * @return [Call]<[kotlin.Boolean]> + * @return [Call]<[kotlin.Boolean]> */ @POST("fake/outer/boolean") fun fakeOuterBooleanSerialize(@Body body: kotlin.Boolean? = null): Single @@ -58,7 +60,7 @@ interface FakeApi { * - 200: Output composite * * @param outerComposite Input composite as post body (optional) - * @return [Call]<[OuterComposite]> + * @return [Call]<[OuterComposite]> */ @POST("fake/outer/composite") fun fakeOuterCompositeSerialize(@Body outerComposite: OuterComposite? = null): Single @@ -70,7 +72,7 @@ interface FakeApi { * - 200: Output number * * @param body Input number as post body (optional) - * @return [Call]<[java.math.BigDecimal]> + * @return [Call]<[java.math.BigDecimal]> */ @POST("fake/outer/number") fun fakeOuterNumberSerialize(@Body body: java.math.BigDecimal? = null): Single @@ -82,7 +84,7 @@ interface FakeApi { * - 200: Output string * * @param body Input string as post body (optional) - * @return [Call]<[kotlin.String]> + * @return [Call]<[kotlin.String]> */ @POST("fake/outer/string") fun fakeOuterStringSerialize(@Body body: kotlin.String? = null): Single @@ -94,7 +96,7 @@ interface FakeApi { * - 200: Success * * @param fileSchemaTestClass - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("fake/body-with-file-schema") fun testBodyWithFileSchema(@Body fileSchemaTestClass: FileSchemaTestClass): Completable @@ -107,7 +109,7 @@ interface FakeApi { * * @param query * @param user - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("fake/body-with-query-params") fun testBodyWithQueryParams(@Query("query") query: kotlin.String, @Body user: User): Completable @@ -119,7 +121,7 @@ interface FakeApi { * - 200: successful operation * * @param client client model - * @return [Call]<[Client]> + * @return [Call]<[Client]> */ @PATCH("fake") fun testClientModel(@Body client: Client): Single @@ -145,7 +147,7 @@ interface FakeApi { * @param dateTime None (optional) * @param password None (optional) * @param paramCallback None (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @FormUrlEncoded @POST("fake") @@ -159,18 +161,18 @@ interface FakeApi { * - 404: Not found * * @param enumHeaderStringArray Header parameter enum test (string array) (optional) - * @param enumHeaderString Header parameter enum test (string) (optional, default to "-efg") + * @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 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 [Call]<[Unit]> + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return [Call]<[Unit]> */ @FormUrlEncoded @GET("fake") - fun testEnumParameters(@Header("enum_header_string_array") enumHeaderStringArray: kotlin.Array, @Header("enum_header_string") enumHeaderString: kotlin.String, @Query("enum_query_string_array") enumQueryStringArray: kotlin.Array, @Query("enum_query_string") enumQueryString: kotlin.String, @Query("enum_query_integer") enumQueryInteger: kotlin.Int, @Query("enum_query_double") enumQueryDouble: kotlin.Double, @Field("enum_form_string_array") enumFormStringArray: kotlin.Array, @Field("enum_form_string") enumFormString: kotlin.String): Completable + fun testEnumParameters(@Header("enum_header_string_array") enumHeaderStringArray: kotlin.collections.List, @Header("enum_header_string") enumHeaderString: kotlin.String, @Query("enum_query_string_array") enumQueryStringArray: kotlin.collections.List? = null, @Query("enum_query_string") enumQueryString: kotlin.String? = null, @Query("enum_query_integer") enumQueryInteger: kotlin.Int? = null, @Query("enum_query_double") enumQueryDouble: kotlin.Double? = null, @Field("enum_form_string_array") enumFormStringArray: kotlin.collections.List, @Field("enum_form_string") enumFormString: kotlin.String): Completable /** * Fake endpoint to test group parameters (optional) @@ -184,10 +186,10 @@ interface FakeApi { * @param stringGroup String in group parameters (optional) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("fake") - fun testGroupParameters(@Query("required_string_group") requiredStringGroup: kotlin.Int, @Header("required_boolean_group") requiredBooleanGroup: kotlin.Boolean, @Query("required_int64_group") requiredInt64Group: kotlin.Long, @Query("string_group") stringGroup: kotlin.Int, @Header("boolean_group") booleanGroup: kotlin.Boolean, @Query("int64_group") int64Group: kotlin.Long): Completable + fun testGroupParameters(@Query("required_string_group") requiredStringGroup: kotlin.Int, @Header("required_boolean_group") requiredBooleanGroup: kotlin.Boolean, @Query("required_int64_group") requiredInt64Group: kotlin.Long, @Query("string_group") stringGroup: kotlin.Int? = null, @Header("boolean_group") booleanGroup: kotlin.Boolean, @Query("int64_group") int64Group: kotlin.Long? = null): Completable /** * test inline additionalProperties @@ -196,7 +198,7 @@ interface FakeApi { * - 200: successful operation * * @param requestBody request body - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("fake/inline-additionalProperties") fun testInlineAdditionalProperties(@Body requestBody: kotlin.collections.Map): Completable @@ -209,7 +211,7 @@ interface FakeApi { * * @param param field1 * @param param2 field2 - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @FormUrlEncoded @GET("fake/jsonFormData") @@ -226,9 +228,9 @@ interface FakeApi { * @param http * @param url * @param context - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("fake/test-query-paramters") - fun testQueryParameterCollectionFormat(@Query("pipe") pipe: kotlin.Array, @Query("ioutil") ioutil: CSVParams, @Query("http") http: SSVParams, @Query("url") url: CSVParams, @Query("context") context: kotlin.Array): Completable + fun testQueryParameterCollectionFormat(@Query("pipe") pipe: kotlin.collections.List, @Query("ioutil") ioutil: CSVParams, @Query("http") http: SSVParams, @Query("url") url: CSVParams, @Query("context") context: kotlin.collections.List): Completable } diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt index d55a974eb115..518a75780ffa 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt @@ -16,7 +16,7 @@ interface FakeClassnameTags123Api { * - 200: successful operation * * @param client client model - * @return [Call]<[Client]> + * @return [Call]<[Client]> */ @PATCH("fake_classname_test") fun testClassname(@Body client: Client): Single diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 75c7a7051e84..82c0bc4b59f1 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -9,15 +9,18 @@ import io.reactivex.Completable import org.openapitools.client.models.ApiResponse import org.openapitools.client.models.Pet +import okhttp3.MultipartBody + interface PetApi { /** * Add a new pet to the store * * Responses: + * - 200: Successful operation * - 405: Invalid input * * @param pet Pet object that needs to be added to the store - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("pet") fun addPet(@Body pet: Pet): Completable @@ -26,11 +29,12 @@ interface PetApi { * Deletes a pet * * Responses: + * - 200: Successful operation * - 400: Invalid pet value * * @param petId Pet id to delete * @param apiKey (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("pet/{petId}") fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Completable @@ -43,10 +47,10 @@ interface PetApi { * - 400: Invalid status value * * @param status Status values that need to be considered for filter - * @return [Call]<[kotlin.Array]> + * @return [Call]<[kotlin.collections.List]> */ @GET("pet/findByStatus") - fun findPetsByStatus(@Query("status") status: CSVParams): Single> + fun findPetsByStatus(@Query("status") status: CSVParams): Single> /** * Finds Pets by tags @@ -56,11 +60,11 @@ interface PetApi { * - 400: Invalid tag value * * @param tags Tags to filter by - * @return [Call]<[kotlin.Array]> + * @return [Call]<[kotlin.collections.List]> */ @Deprecated("This api was deprecated") @GET("pet/findByTags") - fun findPetsByTags(@Query("tags") tags: CSVParams): Single> + fun findPetsByTags(@Query("tags") tags: CSVParams): Single> /** * Find pet by ID @@ -71,7 +75,7 @@ interface PetApi { * - 404: Pet not found * * @param petId ID of pet to return - * @return [Call]<[Pet]> + * @return [Call]<[Pet]> */ @GET("pet/{petId}") fun getPetById(@Path("petId") petId: kotlin.Long): Single @@ -80,12 +84,13 @@ interface PetApi { * Update an existing pet * * Responses: + * - 200: Successful operation * - 400: Invalid ID supplied * - 404: Pet not found * - 405: Validation exception * * @param pet Pet object that needs to be added to the store - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("pet") fun updatePet(@Body pet: Pet): Completable @@ -94,12 +99,13 @@ interface PetApi { * Updates a pet in the store with form data * * Responses: + * - 200: Successful operation * - 405: Invalid input * * @param petId ID of pet that needs to be updated * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @FormUrlEncoded @POST("pet/{petId}") @@ -114,7 +120,7 @@ interface PetApi { * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server (optional) * @param file file to upload (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ApiResponse]> */ @Multipart @POST("pet/{petId}/uploadImage") @@ -129,7 +135,7 @@ interface PetApi { * @param petId ID of pet to update * @param requiredFile file to upload * @param additionalMetadata Additional data to pass to server (optional) - * @return [Call]<[ApiResponse]> + * @return [Call]<[ApiResponse]> */ @Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 1b55d025d063..6c489f464070 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -17,7 +17,7 @@ interface StoreApi { * - 404: Order not found * * @param orderId ID of the order that needs to be deleted - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("store/order/{order_id}") fun deleteOrder(@Path("order_id") orderId: kotlin.String): Completable @@ -28,7 +28,7 @@ interface StoreApi { * Responses: * - 200: successful operation * - * @return [Call]<[kotlin.collections.Map]> + * @return [Call]<[kotlin.collections.Map]> */ @GET("store/inventory") fun getInventory(): Single> @@ -42,7 +42,7 @@ interface StoreApi { * - 404: Order not found * * @param orderId ID of pet that needs to be fetched - * @return [Call]<[Order]> + * @return [Call]<[Order]> */ @GET("store/order/{order_id}") fun getOrderById(@Path("order_id") orderId: kotlin.Long): Single @@ -55,7 +55,7 @@ interface StoreApi { * - 400: Invalid Order * * @param order order placed for purchasing the pet - * @return [Call]<[Order]> + * @return [Call]<[Order]> */ @POST("store/order") fun placeOrder(@Body order: Order): Single diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 0948c0c47a79..eceeeb29d9c4 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -16,7 +16,7 @@ interface UserApi { * - 0: successful operation * * @param user Created user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("user") fun createUser(@Body user: User): Completable @@ -28,10 +28,10 @@ interface UserApi { * - 0: successful operation * * @param user List of user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("user/createWithArray") - fun createUsersWithArrayInput(@Body user: kotlin.Array): Completable + fun createUsersWithArrayInput(@Body user: kotlin.collections.List): Completable /** * Creates list of users with given input array @@ -40,10 +40,10 @@ interface UserApi { * - 0: successful operation * * @param user List of user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @POST("user/createWithList") - fun createUsersWithListInput(@Body user: kotlin.Array): Completable + fun createUsersWithListInput(@Body user: kotlin.collections.List): Completable /** * Delete user @@ -53,7 +53,7 @@ interface UserApi { * - 404: User not found * * @param username The name that needs to be deleted - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @DELETE("user/{username}") fun deleteUser(@Path("username") username: kotlin.String): Completable @@ -67,7 +67,7 @@ interface UserApi { * - 404: User not found * * @param username The name that needs to be fetched. Use user1 for testing. - * @return [Call]<[User]> + * @return [Call]<[User]> */ @GET("user/{username}") fun getUserByName(@Path("username") username: kotlin.String): Single @@ -81,7 +81,7 @@ interface UserApi { * * @param username The user name for login * @param password The password for login in clear text - * @return [Call]<[kotlin.String]> + * @return [Call]<[kotlin.String]> */ @GET("user/login") fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Single @@ -92,7 +92,7 @@ interface UserApi { * Responses: * - 0: successful operation * - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @GET("user/logout") fun logoutUser(): Completable @@ -106,7 +106,7 @@ interface UserApi { * * @param username name that need to be deleted * @param user Updated user object - * @return [Call]<[Unit]> + * @return [Call]<[Unit]> */ @PUT("user/{username}") fun updateUser(@Path("username") username: kotlin.String, @Body user: User): Completable diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 1e9f9e39d85d..1691620ea5e1 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -22,7 +22,8 @@ import retrofit2.converter.gson.GsonConverterFactory class ApiClient( private var baseUrl: String = defaultBasePath, private val okHttpClientBuilder: OkHttpClient.Builder? = null, - private val serializerBuilder: GsonBuilder = Serializer.gsonBuilder + private val serializerBuilder: GsonBuilder = Serializer.gsonBuilder, + private val okHttpClient : OkHttpClient? = null ) { private val apiAuthorizations = mutableMapOf() var logger: ((String) -> Unit)? = null @@ -33,7 +34,7 @@ class ApiClient( .addConverterFactory(ScalarsConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create(serializerBuilder.create())) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - } + } private val clientBuilder: OkHttpClient.Builder by lazy { okHttpClientBuilder ?: defaultClientBuilder @@ -74,7 +75,7 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, + authName: String, bearerToken: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { setBearerToken(bearerToken) @@ -84,8 +85,8 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, - username: String, + authName: String, + username: String, password: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { setCredentials(username, password) @@ -95,10 +96,10 @@ class ApiClient( baseUrl: String = defaultBasePath, okHttpClientBuilder: OkHttpClient.Builder? = null, serializerBuilder: GsonBuilder = Serializer.gsonBuilder, - authName: String, - clientId: String, - secret: String, - username: String, + authName: String, + clientId: String, + secret: String, + username: String, password: String ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) { getTokenEndPoint() @@ -226,7 +227,8 @@ class ApiClient( } fun createService(serviceClass: Class): S { - return retrofitBuilder.client(clientBuilder.build()).build().create(serviceClass) + val usedClient = this.okHttpClient ?: clientBuilder.build() + return retrofitBuilder.client(usedClient).build().create(serviceClass) } private fun normalizeBaseUrl() { @@ -244,10 +246,10 @@ class ApiClient( } } - companion object { + companion object { @JvmStatic val defaultBasePath: String by lazy { System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io:80/v2") } } -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 6465f1485531..b80e0390de2d 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -11,7 +11,6 @@ import java.util.Date object Serializer { @JvmStatic val gsonBuilder: GsonBuilder = GsonBuilder() - .registerTypeAdapter(Date::class.java, DateAdapter()) .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter()) .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter()) .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter()) diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index d69683337761..54c88ca8e900 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -26,6 +26,7 @@ import java.io.Serializable * @param int64 * @param float * @param double + * @param decimal * @param string * @param binary * @param dateTime @@ -53,6 +54,8 @@ data class FormatTest ( val float: kotlin.Float? = null, @SerializedName("double") val double: kotlin.Double? = null, + @SerializedName("decimal") + val decimal: java.math.BigDecimal? = null, @SerializedName("string") val string: kotlin.String? = null, @SerializedName("binary") diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/List.kt index 8de0d080cedc..d614d69d93bd 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/List.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param `123minusList` + * @param `123list` */ data class List ( @SerializedName("123-list") - val `123minusList`: kotlin.String? = null + val `123list`: kotlin.String? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index 23cd075e530d..2dfb12b8b69b 100644 --- a/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + * @param dollarSpecialPropertyName */ data class SpecialModelname ( @SerializedName("\$special[property.name]") - val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null + val dollarSpecialPropertyName: kotlin.Long? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/FILES b/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/FILES index 17ac9baa409d..f350611489a0 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/FILES @@ -27,12 +27,6 @@ docs/Foo.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineObject.md -docs/InlineObject1.md -docs/InlineObject2.md -docs/InlineObject3.md -docs/InlineObject4.md -docs/InlineObject5.md docs/InlineResponseDefault.md docs/List.md docs/MapTest.md @@ -102,12 +96,6 @@ src/commonMain/kotlin/org/openapitools/client/models/Foo.kt src/commonMain/kotlin/org/openapitools/client/models/FormatTest.kt src/commonMain/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt src/commonMain/kotlin/org/openapitools/client/models/HealthCheckResult.kt -src/commonMain/kotlin/org/openapitools/client/models/InlineObject.kt -src/commonMain/kotlin/org/openapitools/client/models/InlineObject1.kt -src/commonMain/kotlin/org/openapitools/client/models/InlineObject2.kt -src/commonMain/kotlin/org/openapitools/client/models/InlineObject3.kt -src/commonMain/kotlin/org/openapitools/client/models/InlineObject4.kt -src/commonMain/kotlin/org/openapitools/client/models/InlineObject5.kt src/commonMain/kotlin/org/openapitools/client/models/InlineResponseDefault.kt src/commonMain/kotlin/org/openapitools/client/models/List.kt src/commonMain/kotlin/org/openapitools/client/models/MapTest.kt diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/README.md b/samples/openapi3/client/petstore/kotlin-multiplatform/README.md index aeb7c3ce7984..aa3323bbf71c 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/README.md +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/README.md @@ -92,12 +92,6 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - - [org.openapitools.client.models.InlineObject](docs/InlineObject.md) - - [org.openapitools.client.models.InlineObject1](docs/InlineObject1.md) - - [org.openapitools.client.models.InlineObject2](docs/InlineObject2.md) - - [org.openapitools.client.models.InlineObject3](docs/InlineObject3.md) - - [org.openapitools.client.models.InlineObject4](docs/InlineObject4.md) - - [org.openapitools.client.models.InlineObject5](docs/InlineObject5.md) - [org.openapitools.client.models.InlineResponseDefault](docs/InlineResponseDefault.md) - [org.openapitools.client.models.List](docs/List.md) - [org.openapitools.client.models.MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FakeApi.md index 851d2f468215..b8dfefb771b7 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FakeApi.md @@ -551,13 +551,13 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] - **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] - **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to "$"] [enum: >, $] - **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FormatTest.md b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FormatTest.md index 080b13c2d8eb..cfabf1976d61 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **int64** | **kotlin.Long** | | [optional] **float** | **kotlin.Float** | | [optional] **double** | **kotlin.Double** | | [optional] +**decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] **string** | **kotlin.String** | | [optional] **binary** | [**org.openapitools.client.infrastructure.OctetByteArray**](org.openapitools.client.infrastructure.OctetByteArray.md) | | [optional] **dateTime** | **kotlin.String** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/List.md b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/List.md index 13a09a4c4141..f426d541a409 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/List.md +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/List.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**`123minusList`** | **kotlin.String** | | [optional] +**`123list`** | **kotlin.String** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/SpecialModelName.md b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/SpecialModelName.md index 282649449d96..b179e705ab05 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/docs/SpecialModelName.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **kotlin.Long** | | [optional] +**dollarSpecialPropertyName** | **kotlin.Long** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/FakeApi.kt index d98ccb9adb01..73a8ed48ed66 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -405,13 +405,13 @@ class FakeApi @UseExperimental(UnstableDefault::class) constructor( * 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 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 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") + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @return void */ suspend fun testEnumParameters(enumHeaderStringArray: kotlin.collections.List?, enumHeaderString: kotlin.String?, enumQueryStringArray: kotlin.collections.List?, enumQueryString: kotlin.String?, enumQueryInteger: kotlin.Int?, enumQueryDouble: kotlin.Double?, enumFormStringArray: kotlin.collections.List?, enumFormString: kotlin.String?): HttpResponse { diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index f866f94634f8..ed8e28588147 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -46,7 +46,6 @@ open class ApiClient( val clientConfig: (HttpClientConfig<*>) -> Unit = { it.install(JsonFeature, jsonConfig) } httpClientEngine?.let { HttpClient(it, clientConfig) } ?: HttpClient(clientConfig) } - private val authentications: kotlin.collections.Map by lazy { mapOf( "api_key" to ApiKeyAuth("header", "api_key"), @@ -98,12 +97,6 @@ open class ApiClient( serializer.setMapper(org.openapitools.client.models.FormatTest::class, org.openapitools.client.models.FormatTest.serializer()) serializer.setMapper(org.openapitools.client.models.HasOnlyReadOnly::class, org.openapitools.client.models.HasOnlyReadOnly.serializer()) serializer.setMapper(org.openapitools.client.models.HealthCheckResult::class, org.openapitools.client.models.HealthCheckResult.serializer()) - serializer.setMapper(org.openapitools.client.models.InlineObject::class, org.openapitools.client.models.InlineObject.serializer()) - serializer.setMapper(org.openapitools.client.models.InlineObject1::class, org.openapitools.client.models.InlineObject1.serializer()) - serializer.setMapper(org.openapitools.client.models.InlineObject2::class, org.openapitools.client.models.InlineObject2.serializer()) - serializer.setMapper(org.openapitools.client.models.InlineObject3::class, org.openapitools.client.models.InlineObject3.serializer()) - serializer.setMapper(org.openapitools.client.models.InlineObject4::class, org.openapitools.client.models.InlineObject4.serializer()) - serializer.setMapper(org.openapitools.client.models.InlineObject5::class, org.openapitools.client.models.InlineObject5.serializer()) serializer.setMapper(org.openapitools.client.models.InlineResponseDefault::class, org.openapitools.client.models.InlineResponseDefault.serializer()) serializer.setMapper(org.openapitools.client.models.List::class, org.openapitools.client.models.List.serializer()) serializer.setMapper(org.openapitools.client.models.MapTest::class, org.openapitools.client.models.MapTest.serializer()) @@ -133,7 +126,7 @@ open class ApiClient( * @param username Username */ fun setUsername(username: String) { - val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? ?: throw Exception("No HTTP basic authentication configured") auth.username = username } @@ -144,7 +137,7 @@ open class ApiClient( * @param password Password */ fun setPassword(password: String) { - val auth = authentications.values.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? + val auth = authentications?.values?.firstOrNull { it is HttpBasicAuth } as HttpBasicAuth? ?: throw Exception("No HTTP basic authentication configured") auth.password = password } @@ -156,7 +149,7 @@ open class ApiClient( * @param paramName The name of the API key parameter, or null or set the first key. */ fun setApiKey(apiKey: String, paramName: String? = null) { - val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? + val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName)} as ApiKeyAuth? ?: throw Exception("No API key authentication configured") auth.apiKey = apiKey } @@ -168,7 +161,7 @@ open class ApiClient( * @param paramName The name of the API key parameter, or null or set the first key. */ fun setApiKeyPrefix(apiKeyPrefix: String, paramName: String? = null) { - val auth = authentications.values.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? + val auth = authentications?.values?.firstOrNull { it is ApiKeyAuth && (paramName == null || paramName == it.paramName) } as ApiKeyAuth? ?: throw Exception("No API key authentication configured") auth.apiKeyPrefix = apiKeyPrefix } @@ -179,7 +172,7 @@ open class ApiClient( * @param accessToken Access token */ fun setAccessToken(accessToken: String) { - val auth = authentications.values.firstOrNull { it is OAuth } as OAuth? + val auth = authentications?.values?.firstOrNull { it is OAuth } as OAuth? ?: throw Exception("No OAuth2 authentication configured") auth.accessToken = accessToken } @@ -190,7 +183,7 @@ open class ApiClient( * @param bearerToken The bearer token. */ fun setBearerToken(bearerToken: String) { - val auth = authentications.values.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? + val auth = authentications?.values?.firstOrNull { it is HttpBearerAuth } as HttpBearerAuth? ?: throw Exception("No Bearer authentication configured") auth.bearerToken = bearerToken } @@ -234,7 +227,7 @@ open class ApiClient( private fun RequestConfig.updateForAuth(authNames: kotlin.collections.List) { for (authName in authNames) { - val auth = authentications[authName] ?: throw Exception("Authentication undefined: $authName") + val auth = authentications?.get(authName) ?: throw Exception("Authentication undefined: $authName") auth.apply(query, headers) } } diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/FormatTest.kt index ed2e0e2eec2a..251ce3fe48d5 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/FormatTest.kt @@ -26,6 +26,7 @@ import kotlinx.serialization.internal.CommonEnumSerializer * @param int64 * @param float * @param double + * @param decimal * @param string * @param binary * @param dateTime @@ -44,6 +45,7 @@ data class FormatTest ( @SerialName(value = "int64") val int64: kotlin.Long? = null, @SerialName(value = "float") val float: kotlin.Float? = null, @SerialName(value = "double") val double: kotlin.Double? = null, + @SerialName(value = "decimal") val decimal: java.math.BigDecimal? = null, @SerialName(value = "string") val string: kotlin.String? = null, @SerialName(value = "binary") val binary: org.openapitools.client.infrastructure.OctetByteArray? = null, @SerialName(value = "dateTime") val dateTime: kotlin.String? = null, diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/List.kt index f68a4dc3a860..ea3ede2d5cb0 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/List.kt @@ -17,10 +17,10 @@ import kotlinx.serialization.internal.CommonEnumSerializer /** * - * @param `123minusList` + * @param `123list` */ @Serializable data class List ( - @SerialName(value = "123-list") val `123minusList`: kotlin.String? = null + @SerialName(value = "123-list") val `123list`: kotlin.String? = null ) diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/SpecialModelname.kt index 7a8c1c83c8b8..e8a3ddd658f1 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -17,10 +17,10 @@ import kotlinx.serialization.internal.CommonEnumSerializer /** * - * @param dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + * @param dollarSpecialPropertyName */ @Serializable data class SpecialModelname ( - @SerialName(value = "\$special[property.name]") val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null + @SerialName(value = "\$special[property.name]") val dollarSpecialPropertyName: kotlin.Long? = null ) diff --git a/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES b/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES index 535d2438cfdf..2deaf69a977c 100644 --- a/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/kotlin/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md build.gradle docs/200Response.md @@ -28,12 +27,6 @@ docs/Foo.md docs/FormatTest.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md -docs/InlineObject.md -docs/InlineObject1.md -docs/InlineObject2.md -docs/InlineObject3.md -docs/InlineObject4.md -docs/InlineObject5.md docs/InlineResponseDefault.md docs/List.md docs/MapTest.md @@ -100,12 +93,6 @@ src/main/kotlin/org/openapitools/client/models/Foo.kt src/main/kotlin/org/openapitools/client/models/FormatTest.kt src/main/kotlin/org/openapitools/client/models/HasOnlyReadOnly.kt src/main/kotlin/org/openapitools/client/models/HealthCheckResult.kt -src/main/kotlin/org/openapitools/client/models/InlineObject.kt -src/main/kotlin/org/openapitools/client/models/InlineObject1.kt -src/main/kotlin/org/openapitools/client/models/InlineObject2.kt -src/main/kotlin/org/openapitools/client/models/InlineObject3.kt -src/main/kotlin/org/openapitools/client/models/InlineObject4.kt -src/main/kotlin/org/openapitools/client/models/InlineObject5.kt src/main/kotlin/org/openapitools/client/models/InlineResponseDefault.kt src/main/kotlin/org/openapitools/client/models/List.kt src/main/kotlin/org/openapitools/client/models/MapTest.kt diff --git a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/kotlin/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/kotlin/README.md b/samples/openapi3/client/petstore/kotlin/README.md index 0039d13c3568..76aa2b6cd520 100644 --- a/samples/openapi3/client/petstore/kotlin/README.md +++ b/samples/openapi3/client/petstore/kotlin/README.md @@ -101,12 +101,6 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.FormatTest](docs/FormatTest.md) - [org.openapitools.client.models.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [org.openapitools.client.models.HealthCheckResult](docs/HealthCheckResult.md) - - [org.openapitools.client.models.InlineObject](docs/InlineObject.md) - - [org.openapitools.client.models.InlineObject1](docs/InlineObject1.md) - - [org.openapitools.client.models.InlineObject2](docs/InlineObject2.md) - - [org.openapitools.client.models.InlineObject3](docs/InlineObject3.md) - - [org.openapitools.client.models.InlineObject4](docs/InlineObject4.md) - - [org.openapitools.client.models.InlineObject5](docs/InlineObject5.md) - [org.openapitools.client.models.InlineResponseDefault](docs/InlineResponseDefault.md) - [org.openapitools.client.models.List](docs/List.md) - [org.openapitools.client.models.MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/kotlin/build.gradle b/samples/openapi3/client/petstore/kotlin/build.gradle index 9d6960b77a15..56be0bd0dd87 100644 --- a/samples/openapi3/client/petstore/kotlin/build.gradle +++ b/samples/openapi3/client/petstore/kotlin/build.gradle @@ -29,11 +29,9 @@ test { dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "com.squareup.moshi:moshi-kotlin:1.9.2" compile "com.squareup.moshi:moshi-adapters:1.9.2" compile "com.squareup.okhttp3:okhttp:4.2.2" - compile "com.squareup.okhttp3:logging-interceptor:4.4.0" testCompile "io.kotlintest:kotlintest-runner-junit5:3.1.0" } diff --git a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md index 40ca579b51b4..e5aef0b8b6d7 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FakeApi.md @@ -551,13 +551,13 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] - **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumHeaderString** | **kotlin.String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] - **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumQueryString** | **kotlin.String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **kotlin.Int**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **kotlin.Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to "$"] [enum: >, $] - **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to "-efg"] [enum: _abc, -efg, (xyz)] + **enumFormStringArray** | [**kotlin.collections.List<kotlin.String>**](kotlin.String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormString** | **kotlin.String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type diff --git a/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md b/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md index 0357923c97a5..01b408499e73 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/kotlin/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **int64** | **kotlin.Long** | | [optional] **float** | **kotlin.Float** | | [optional] **double** | **kotlin.Double** | | [optional] +**decimal** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] **string** | **kotlin.String** | | [optional] **binary** | [**java.io.File**](java.io.File.md) | | [optional] **dateTime** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin/docs/List.md b/samples/openapi3/client/petstore/kotlin/docs/List.md index 13a09a4c4141..f426d541a409 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/List.md +++ b/samples/openapi3/client/petstore/kotlin/docs/List.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**`123minusList`** | **kotlin.String** | | [optional] +**`123list`** | **kotlin.String** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md b/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md index 282649449d96..b179e705ab05 100644 --- a/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/kotlin/docs/SpecialModelName.md @@ -4,7 +4,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **kotlin.Long** | | [optional] +**dollarSpecialPropertyName** | **kotlin.Long** | | [optional] diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 647272f7e2b2..085f742fe203 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -98,7 +98,8 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("query_1", listOf(query1.toString())) } } - val localVariableHeaders: MutableMap = mutableMapOf("header_1" to header1.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + header1?.apply { localVariableHeaders["header_1"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.GET, "/fake/http-signature-test", @@ -471,13 +472,13 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { * 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 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 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") + * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @return void * @throws UnsupportedOperationException If the API returns an informational or redirection response * @throws ClientException If the API returns a client error response @@ -501,7 +502,9 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("enum_query_double", listOf(enumQueryDouble.toString())) } } - val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded", "enum_header_string_array" to enumHeaderStringArray.joinToString(separator = collectionDelimiter("csv")), "enum_header_string" to enumHeaderString.toString()) + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") + enumHeaderStringArray?.apply { localVariableHeaders["enum_header_string_array"] = this.joinToString(separator = collectionDelimiter("csv")) } + enumHeaderString?.apply { localVariableHeaders["enum_header_string"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.GET, "/fake", @@ -556,7 +559,9 @@ class FakeApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { put("int64_group", listOf(int64Group.toString())) } } - val localVariableHeaders: MutableMap = mutableMapOf("required_boolean_group" to requiredBooleanGroup.toString(), "boolean_group" to booleanGroup.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + requiredBooleanGroup?.apply { localVariableHeaders["required_boolean_group"] = this.toString() } + booleanGroup?.apply { localVariableHeaders["boolean_group"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/fake", diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 8dd12cf26ab5..d0295348e3fd 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -88,7 +88,8 @@ class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit { val localVariableBody: kotlin.Any? = null val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf("api_key" to apiKey.toString()) + val localVariableHeaders: MutableMap = mutableMapOf() + apiKey?.apply { localVariableHeaders["api_key"] = this.toString() } val localVariableConfig = RequestConfig( RequestMethod.DELETE, "/pet/{petId}".replace("{"+"petId"+"}", "$petId"), diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt index 69b562becb07..9bd2790dc144 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -10,6 +10,7 @@ val Response.isInformational : Boolean get() = this.code in 100..199 /** * Provides an extension to evaluation whether the response is a 3xx code */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") val Response.isRedirect : Boolean get() = this.code in 300..399 /** diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt index 697559b2ec16..9a45b67d9b1a 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -1,14 +1,12 @@ package org.openapitools.client.infrastructure import com.squareup.moshi.Moshi -import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import java.util.Date object Serializer { @JvmStatic val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) .add(OffsetDateTimeAdapter()) .add(LocalDateTimeAdapter()) .add(LocalDateAdapter()) diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt index 5a1fec435b1b..d0bbef4836c9 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/FormatTest.kt @@ -26,6 +26,7 @@ import java.io.Serializable * @param int64 * @param float * @param double + * @param decimal * @param string * @param binary * @param dateTime @@ -53,6 +54,8 @@ data class FormatTest ( val float: kotlin.Float? = null, @Json(name = "double") val double: kotlin.Double? = null, + @Json(name = "decimal") + val decimal: java.math.BigDecimal? = null, @Json(name = "string") val string: kotlin.String? = null, @Json(name = "binary") diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt index f16cdddc8c7d..bb3f49c6984e 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/List.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param `123minusList` + * @param `123list` */ data class List ( @Json(name = "123-list") - val `123minusList`: kotlin.String? = null + val `123list`: kotlin.String? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt index c51eefb1ce41..a315761a8f8f 100644 --- a/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt +++ b/samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/models/SpecialModelname.kt @@ -17,12 +17,12 @@ import java.io.Serializable /** * - * @param dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + * @param dollarSpecialPropertyName */ data class SpecialModelname ( @Json(name = "\$special[property.name]") - val dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: kotlin.Long? = null + val dollarSpecialPropertyName: kotlin.Long? = null ) : Serializable { companion object { private const val serialVersionUID: Long = 123 diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py index a12d2c733313..99b40326211a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py @@ -159,6 +159,7 @@ conf = petstore_api.Configuration( def __init__(self, host=None, api_key=None, api_key_prefix=None, + access_token=None, username=None, password=None, discard_unknown_keys=False, disabled_client_side_validations="", @@ -184,6 +185,7 @@ conf = petstore_api.Configuration( """Temp file folder for downloading files """ # Authentication Settings + self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key @@ -210,9 +212,6 @@ conf = petstore_api.Configuration( self.signing_info = signing_info """The HTTP signing configuration """ - self.access_token = None - """access token for OAuth/Bearer - """ self.logger = {} """Logging Settings """ diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES b/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES index 07fb739ffae5..e48401e8ff47 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES @@ -14,8 +14,6 @@ src/main/kotlin/org/openapitools/api/UserApi.kt src/main/kotlin/org/openapitools/api/UserApiService.kt src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt src/main/kotlin/org/openapitools/model/Category.kt -src/main/kotlin/org/openapitools/model/InlineObject.kt -src/main/kotlin/org/openapitools/model/InlineObject1.kt src/main/kotlin/org/openapitools/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/model/Order.kt src/main/kotlin/org/openapitools/model/Pet.kt diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION b/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt index b77d4eaed655..7f02e0938ab6 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -13,14 +13,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -52,11 +45,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 405, message = "Invalid input")]) - @RequestMapping( + @PostMapping( value = ["/pet"], - produces = ["application/xml", "application/json"], - consumes = ["application/json", "application/xml"], - method = [RequestMethod.POST]) + produces = ["application/xml", "application/json"], + consumes = ["application/json", "application/xml"] + ) suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet ): ResponseEntity { return ResponseEntity(service.addPet(pet), HttpStatus.valueOf(200)) @@ -69,9 +62,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid pet value")]) - @RequestMapping( - value = ["/pet/{petId}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/pet/{petId}"] + ) suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String? ): ResponseEntity { @@ -87,10 +80,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) - @RequestMapping( + @GetMapping( value = ["/pet/findByStatus"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List ): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) @@ -105,10 +98,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) - @RequestMapping( + @GetMapping( value = ["/pet/findByTags"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List ): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) @@ -122,10 +115,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) - @RequestMapping( + @GetMapping( value = ["/pet/{petId}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long ): ResponseEntity { return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200)) @@ -139,11 +132,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) - @RequestMapping( + @PutMapping( value = ["/pet"], - produces = ["application/xml", "application/json"], - consumes = ["application/json", "application/xml"], - method = [RequestMethod.PUT]) + produces = ["application/xml", "application/json"], + consumes = ["application/json", "application/xml"] + ) suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet ): ResponseEntity { return ResponseEntity(service.updatePet(pet), HttpStatus.valueOf(200)) @@ -156,10 +149,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 405, message = "Invalid input")]) - @RequestMapping( + @PostMapping( value = ["/pet/{petId}"], - consumes = ["application/x-www-form-urlencoded"], - method = [RequestMethod.POST]) + consumes = ["application/x-www-form-urlencoded"] + ) suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String? ,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String? @@ -175,11 +168,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) - @RequestMapping( + @PostMapping( value = ["/pet/{petId}/uploadImage"], - produces = ["application/json"], - consumes = ["multipart/form-data"], - method = [RequestMethod.POST]) + produces = ["application/json"], + consumes = ["multipart/form-data"] + ) suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt index 528129abc42c..acfb3f62ae03 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -12,14 +12,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -49,9 +42,9 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @RequestMapping( - value = ["/store/order/{orderId}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/store/order/{orderId}"] + ) suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String ): ResponseEntity { return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400)) @@ -66,10 +59,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) - @RequestMapping( + @GetMapping( value = ["/store/inventory"], - produces = ["application/json"], - method = [RequestMethod.GET]) + produces = ["application/json"] + ) suspend fun getInventory(): ResponseEntity> { return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200)) } @@ -81,10 +74,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @RequestMapping( + @GetMapping( value = ["/store/order/{orderId}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long ): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) @@ -97,11 +90,11 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) - @RequestMapping( + @PostMapping( value = ["/store/order"], - produces = ["application/xml", "application/json"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + produces = ["application/xml", "application/json"], + consumes = ["application/json"] + ) suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order ): ResponseEntity { return ResponseEntity(service.placeOrder(order), HttpStatus.valueOf(200)) diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt index 479219327adc..ca309c95e915 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -12,14 +12,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -50,10 +43,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( + @PostMapping( value = ["/user"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + consumes = ["application/json"] + ) suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User ): ResponseEntity { return ResponseEntity(service.createUser(user), HttpStatus.valueOf(200)) @@ -66,10 +59,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( + @PostMapping( value = ["/user/createWithArray"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + consumes = ["application/json"] + ) suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow ): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.valueOf(200)) @@ -82,10 +75,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( + @PostMapping( value = ["/user/createWithList"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + consumes = ["application/json"] + ) suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow ): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.valueOf(200)) @@ -98,9 +91,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( - value = ["/user/{username}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/user/{username}"] + ) suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400)) @@ -113,10 +106,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = User::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( + @GetMapping( value = ["/user/{username}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200)) @@ -129,10 +122,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = kotlin.String::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) - @RequestMapping( + @GetMapping( value = ["/user/login"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String ,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String ): ResponseEntity { @@ -146,9 +139,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - value = ["/user/logout"], - method = [RequestMethod.GET]) + @GetMapping( + value = ["/user/logout"] + ) suspend fun logoutUser(): ResponseEntity { return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200)) } @@ -160,10 +153,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( + @PutMapping( value = ["/user/{username}"], - consumes = ["application/json"], - method = [RequestMethod.PUT]) + consumes = ["application/json"] + ) suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String ,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User ): ResponseEntity { diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt index c62a3ec6c6eb..42348e7084aa 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -20,7 +21,7 @@ data class Category( @ApiModelProperty(example = "null", value = "") @field:JsonProperty("id") val id: kotlin.Long? = null, -@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") + @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiModelProperty(example = "null", value = "") @field:JsonProperty("name") val name: kotlin.String? = null ) { diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 6ac03ab610eb..6ada956e84e4 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt index 83f4ba454214..2de2fa35642b 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -10,6 +10,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -39,7 +40,7 @@ data class Order( @field:JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @field:JsonProperty("complete") val complete: kotlin.Boolean? = null + @field:JsonProperty("complete") val complete: kotlin.Boolean? = false ) { /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt index de74ce560543..22bbe695c0dc 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -12,6 +12,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -25,20 +26,20 @@ import io.swagger.annotations.ApiModelProperty */ data class Pet( - @get:NotNull @ApiModelProperty(example = "doggie", required = true, value = "") - @field:JsonProperty("name") val name: kotlin.String, + @field:JsonProperty("name", required = true) val name: kotlin.String, - @get:NotNull @ApiModelProperty(example = "null", required = true, value = "") - @field:JsonProperty("photoUrls") val photoUrls: kotlin.collections.List, + @field:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, @ApiModelProperty(example = "null", value = "") @field:JsonProperty("id") val id: kotlin.Long? = null, + @field:Valid @ApiModelProperty(example = "null", value = "") @field:JsonProperty("category") val category: Category? = null, + @field:Valid @ApiModelProperty(example = "null", value = "") @field:JsonProperty("tags") val tags: kotlin.collections.List? = null, diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt index 7e7d12349842..ab8e83484980 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt index dc58873346e6..c083bd85dba8 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/FILES b/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/FILES index 7a4e308c40d2..612ea14bbdb4 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/FILES @@ -15,8 +15,6 @@ src/main/kotlin/org/openapitools/api/UserApi.kt src/main/kotlin/org/openapitools/api/UserApiService.kt src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt src/main/kotlin/org/openapitools/model/Category.kt -src/main/kotlin/org/openapitools/model/InlineObject.kt -src/main/kotlin/org/openapitools/model/InlineObject1.kt src/main/kotlin/org/openapitools/model/ModelApiResponse.kt src/main/kotlin/org/openapitools/model/Order.kt src/main/kotlin/org/openapitools/model/Pet.kt diff --git a/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/VERSION b/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/kotlin-springboot/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt index 5b5ec9b8faeb..a2d6231bcb2e 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -13,14 +13,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -51,11 +44,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 405, message = "Invalid input")]) - @RequestMapping( + @PostMapping( value = ["/pet"], - produces = ["application/xml", "application/json"], - consumes = ["application/json", "application/xml"], - method = [RequestMethod.POST]) + produces = ["application/xml", "application/json"], + consumes = ["application/json", "application/xml"] + ) fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet ): ResponseEntity { return ResponseEntity(service.addPet(pet), HttpStatus.valueOf(200)) @@ -68,9 +61,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid pet value")]) - @RequestMapping( - value = ["/pet/{petId}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/pet/{petId}"] + ) fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String? ): ResponseEntity { @@ -86,10 +79,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) - @RequestMapping( + @GetMapping( value = ["/pet/findByStatus"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List ): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) @@ -104,10 +97,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) - @RequestMapping( + @GetMapping( value = ["/pet/findByTags"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List ): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) @@ -121,10 +114,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) - @RequestMapping( + @GetMapping( value = ["/pet/{petId}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long ): ResponseEntity { return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200)) @@ -138,11 +131,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) - @RequestMapping( + @PutMapping( value = ["/pet"], - produces = ["application/xml", "application/json"], - consumes = ["application/json", "application/xml"], - method = [RequestMethod.PUT]) + produces = ["application/xml", "application/json"], + consumes = ["application/json", "application/xml"] + ) fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet ): ResponseEntity { return ResponseEntity(service.updatePet(pet), HttpStatus.valueOf(200)) @@ -155,10 +148,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 405, message = "Invalid input")]) - @RequestMapping( + @PostMapping( value = ["/pet/{petId}"], - consumes = ["application/x-www-form-urlencoded"], - method = [RequestMethod.POST]) + consumes = ["application/x-www-form-urlencoded"] + ) fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String? ,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String? @@ -174,11 +167,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) - @RequestMapping( + @PostMapping( value = ["/pet/{petId}/uploadImage"], - produces = ["application/json"], - consumes = ["multipart/form-data"], - method = [RequestMethod.POST]) + produces = ["application/json"], + consumes = ["multipart/form-data"] + ) fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt index 1e9e28c7b9db..9199ce4e307b 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -12,14 +12,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -48,9 +41,9 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @RequestMapping( - value = ["/store/order/{orderId}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/store/order/{orderId}"] + ) fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String ): ResponseEntity { return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400)) @@ -65,10 +58,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) - @RequestMapping( + @GetMapping( value = ["/store/inventory"], - produces = ["application/json"], - method = [RequestMethod.GET]) + produces = ["application/json"] + ) fun getInventory(): ResponseEntity> { return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200)) } @@ -80,10 +73,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @RequestMapping( + @GetMapping( value = ["/store/order/{orderId}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long ): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) @@ -96,11 +89,11 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) - @RequestMapping( + @PostMapping( value = ["/store/order"], - produces = ["application/xml", "application/json"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + produces = ["application/xml", "application/json"], + consumes = ["application/json"] + ) fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order ): ResponseEntity { return ResponseEntity(service.placeOrder(order), HttpStatus.valueOf(200)) diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index 7a04f660f17f..8fe16331f827 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -12,14 +12,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -49,10 +42,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( + @PostMapping( value = ["/user"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + consumes = ["application/json"] + ) fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User ): ResponseEntity { return ResponseEntity(service.createUser(user), HttpStatus.valueOf(200)) @@ -65,10 +58,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( + @PostMapping( value = ["/user/createWithArray"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + consumes = ["application/json"] + ) fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: kotlin.collections.List ): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.valueOf(200)) @@ -81,10 +74,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( + @PostMapping( value = ["/user/createWithList"], - consumes = ["application/json"], - method = [RequestMethod.POST]) + consumes = ["application/json"] + ) fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: kotlin.collections.List ): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.valueOf(200)) @@ -97,9 +90,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( - value = ["/user/{username}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/user/{username}"] + ) fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400)) @@ -112,10 +105,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = User::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( + @GetMapping( value = ["/user/{username}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200)) @@ -128,10 +121,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = kotlin.String::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) - @RequestMapping( + @GetMapping( value = ["/user/login"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String ,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String ): ResponseEntity { @@ -145,9 +138,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - value = ["/user/logout"], - method = [RequestMethod.GET]) + @GetMapping( + value = ["/user/logout"] + ) fun logoutUser(): ResponseEntity { return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200)) } @@ -159,10 +152,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( + @PutMapping( value = ["/user/{username}"], - consumes = ["application/json"], - method = [RequestMethod.PUT]) + consumes = ["application/json"] + ) fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String ,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User ): ResponseEntity { diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index c62a3ec6c6eb..42348e7084aa 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -20,7 +21,7 @@ data class Category( @ApiModelProperty(example = "null", value = "") @field:JsonProperty("id") val id: kotlin.Long? = null, -@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") + @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiModelProperty(example = "null", value = "") @field:JsonProperty("name") val name: kotlin.String? = null ) { diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 6ac03ab610eb..6ada956e84e4 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index 83f4ba454214..2de2fa35642b 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -10,6 +10,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -39,7 +40,7 @@ data class Order( @field:JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @field:JsonProperty("complete") val complete: kotlin.Boolean? = null + @field:JsonProperty("complete") val complete: kotlin.Boolean? = false ) { /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index de74ce560543..22bbe695c0dc 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -12,6 +12,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -25,20 +26,20 @@ import io.swagger.annotations.ApiModelProperty */ data class Pet( - @get:NotNull @ApiModelProperty(example = "doggie", required = true, value = "") - @field:JsonProperty("name") val name: kotlin.String, + @field:JsonProperty("name", required = true) val name: kotlin.String, - @get:NotNull @ApiModelProperty(example = "null", required = true, value = "") - @field:JsonProperty("photoUrls") val photoUrls: kotlin.collections.List, + @field:JsonProperty("photoUrls", required = true) val photoUrls: kotlin.collections.List, @ApiModelProperty(example = "null", value = "") @field:JsonProperty("id") val id: kotlin.Long? = null, + @field:Valid @ApiModelProperty(example = "null", value = "") @field:JsonProperty("category") val category: Category? = null, + @field:Valid @ApiModelProperty(example = "null", value = "") @field:JsonProperty("tags") val tags: kotlin.collections.List? = null, diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index 7e7d12349842..ab8e83484980 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index dc58873346e6..c083bd85dba8 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/openapi3/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION b/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION index 3fa3b389a57d..c30f0ec2be7f 100644 --- a/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION +++ b/samples/server/petstore/java-vertx-web/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.1-SNAPSHOT \ No newline at end of file +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator-ignore b/samples/server/petstore/java-vertx/async/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/server/petstore/java-vertx/async/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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/java-vertx/async/.openapi-generator/FILES b/samples/server/petstore/java-vertx/async/.openapi-generator/FILES deleted file mode 100644 index d863c5cf45a6..000000000000 --- a/samples/server/petstore/java-vertx/async/.openapi-generator/FILES +++ /dev/null @@ -1,21 +0,0 @@ -README.md -pom.xml -src/main/java/org/openapitools/server/api/MainApiException.java -src/main/java/org/openapitools/server/api/MainApiVerticle.java -src/main/java/org/openapitools/server/api/model/Category.java -src/main/java/org/openapitools/server/api/model/ModelApiResponse.java -src/main/java/org/openapitools/server/api/model/Order.java -src/main/java/org/openapitools/server/api/model/Pet.java -src/main/java/org/openapitools/server/api/model/Tag.java -src/main/java/org/openapitools/server/api/model/User.java -src/main/java/org/openapitools/server/api/verticle/PetApi.java -src/main/java/org/openapitools/server/api/verticle/PetApiException.java -src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/StoreApi.java -src/main/java/org/openapitools/server/api/verticle/StoreApiException.java -src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/UserApi.java -src/main/java/org/openapitools/server/api/verticle/UserApiException.java -src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java -src/main/resources/openapi.json -src/main/resources/vertx-default-jul-logging.properties diff --git a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION deleted file mode 100644 index 3fa3b389a57d..000000000000 --- a/samples/server/petstore/java-vertx/async/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/README.md b/samples/server/petstore/java-vertx/async/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/samples/server/petstore/java-vertx/async/pom.xml b/samples/server/petstore/java-vertx/async/pom.xml deleted file mode 100644 index 217266e583ed..000000000000 --- a/samples/server/petstore/java-vertx/async/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - 4.0.0 - - org.openapitools - openapi-java-vertx-server - 1.0.0-SNAPSHOT - jar - - OpenAPI Petstore - - - UTF-8 - 1.8 - 4.13.1 - 3.4.1 - 3.8.1 - 1.4.0 - 2.3 - 2.7.4 - - - - - junit - junit - ${junit.version} - test - - - - io.vertx - vertx-unit - ${vertx.version} - test - - - - com.github.phiz71 - vertx-swagger-router - ${vertx-swagger-router.version} - - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-datatype-jsr310.version} - - - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - - package - - shade - - - - - - io.vertx.core.Starter - org.openapitools.server.api.MainApiVerticle - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-fat.jar - - - - - - - diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java deleted file mode 100644 index 4aef710c011b..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api; - -public class MainApiException extends Exception { - private int statusCode; - private String statusMessage; - - public MainApiException(int statusCode, String statusMessage) { - super(); - this.statusCode = statusCode; - this.statusMessage = statusMessage; - } - - public int getStatusCode() { - return statusCode; - } - - public String getStatusMessage() { - return statusMessage; - } - - public static final MainApiException INTERNAL_SERVER_ERROR = new MainApiException(500, "Internal Server Error"); -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java deleted file mode 100644 index 26381f058f1b..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/MainApiVerticle.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.openapitools.server.api; - -import java.nio.charset.Charset; - -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.github.phiz71.vertx.swagger.router.OperationIdServiceIdResolver; -import com.github.phiz71.vertx.swagger.router.SwaggerRouter; - -import io.swagger.models.Swagger; -import io.swagger.parser.SwaggerParser; -import io.vertx.core.AbstractVerticle; -import io.vertx.core.Context; -import io.vertx.core.Future; -import io.vertx.core.file.FileSystem; -import io.vertx.core.json.Json; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; -import io.vertx.core.Vertx; -import io.vertx.ext.web.Router; - -public class MainApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); - - private int serverPort = 8080; - protected Router router; - - public int getServerPort() { - return serverPort; - } - - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - @Override - public void init(Vertx vertx, Context context) { - super.init(vertx, context); - router = Router.router(vertx); - } - - @Override - public void start(Future startFuture) throws Exception { - Json.mapper.registerModule(new JavaTimeModule()); - FileSystem vertxFileSystem = vertx.fileSystem(); - vertxFileSystem.readFile("openapi.json", readFile -> { - if (readFile.succeeded()) { - Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8"))); - Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver()); - - deployVerticles(startFuture); - - vertx.createHttpServer() - .requestHandler(swaggerRouter::accept) - .listen(serverPort, h -> { - if (h.succeeded()) { - startFuture.complete(); - } else { - startFuture.fail(h.cause()); - } - }); - } else { - startFuture.fail(readFile.cause()); - } - }); - } - - public void deployVerticles(Future startFuture) { - - vertx.deployVerticle("org.openapitools.server.api.verticle.PetApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("PetApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("PetApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.StoreApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("StoreApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("StoreApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.UserApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("UserApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("UserApiVerticle : Deployment failed"); - } - }); - - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java deleted file mode 100644 index f05201c45add..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Category.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A category for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Category { - - private Long id; - private String name; - - public Category () { - - } - - public Category (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return Objects.equals(id, category.id) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java deleted file mode 100644 index 934a6efdf966..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Describes the result of uploading an image resource - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class ModelApiResponse { - - private Integer code; - private String type; - private String message; - - public ModelApiResponse () { - - } - - public ModelApiResponse (Integer code, String type, String message) { - this.code = code; - this.type = type; - this.message = message; - } - - - @JsonProperty("code") - public Integer getCode() { - return code; - } - public void setCode(Integer code) { - this.code = code; - } - - - @JsonProperty("type") - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(code, _apiResponse.code) && - Objects.equals(type, _apiResponse.type) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java deleted file mode 100644 index 0d8d6714212c..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Order.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; - -/** - * An order for a pets from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Order { - - private Long id; - private Long petId; - private Integer quantity; - private OffsetDateTime shipDate; - - - public enum StatusEnum { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - private Boolean complete = false; - - public Order () { - - } - - public Order (Long id, Long petId, Integer quantity, OffsetDateTime shipDate, StatusEnum status, Boolean complete) { - this.id = id; - this.petId = petId; - this.quantity = quantity; - this.shipDate = shipDate; - this.status = status; - this.complete = complete; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("petId") - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - - @JsonProperty("quantity") - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - - @JsonProperty("shipDate") - public OffsetDateTime getShipDate() { - return shipDate; - } - public void setShipDate(OffsetDateTime shipDate) { - this.shipDate = shipDate; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @JsonProperty("complete") - public Boolean getComplete() { - return complete; - } - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Order order = (Order) o; - return Objects.equals(id, order.id) && - Objects.equals(petId, order.petId) && - Objects.equals(quantity, order.quantity) && - Objects.equals(shipDate, order.shipDate) && - Objects.equals(status, order.status) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java deleted file mode 100644 index cb9325acf5db..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Pet.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.ArrayList; -import java.util.List; -import org.openapitools.server.api.model.Category; -import org.openapitools.server.api.model.Tag; - -/** - * A pet for sale in the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Pet { - - private Long id; - private Category category; - private String name; - private List photoUrls = new ArrayList<>(); - private List tags = new ArrayList<>(); - - - public enum StatusEnum { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - - public Pet () { - - } - - public Pet (Long id, Category category, String name, List photoUrls, List tags, StatusEnum status) { - this.id = id; - this.category = category; - this.name = name; - this.photoUrls = photoUrls; - this.tags = tags; - this.status = status; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java deleted file mode 100644 index 0389c2fbeea8..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/Tag.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A tag for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Tag { - - private Long id; - private String name; - - public Tag () { - - } - - public Tag (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Tag tag = (Tag) o; - return Objects.equals(id, tag.id) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java deleted file mode 100644 index 0e1e87555552..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/model/User.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A User who is purchasing from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class User { - - private Long id; - private String username; - private String firstName; - private String lastName; - private String email; - private String password; - private String phone; - private Integer userStatus; - - public User () { - - } - - public User (Long id, String username, String firstName, String lastName, String email, String password, String phone, Integer userStatus) { - this.id = id; - this.username = username; - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - this.password = password; - this.phone = phone; - this.userStatus = userStatus; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("username") - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - - @JsonProperty("firstName") - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - - @JsonProperty("lastName") - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - - - @JsonProperty("email") - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - - @JsonProperty("password") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - @JsonProperty("phone") - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - - - @JsonProperty("userStatus") - public Integer getUserStatus() { - return userStatus; - } - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(id, user.id) && - Objects.equals(username, user.username) && - Objects.equals(firstName, user.firstName) && - Objects.equals(lastName, user.lastName) && - Objects.equals(email, user.email) && - Objects.equals(password, user.password) && - Objects.equals(phone, user.phone) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java deleted file mode 100644 index 7ec2b40b8ff3..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApi.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; - -import java.util.List; -import java.util.Map; - -public interface PetApi { - //addPet - void addPet(Pet body, Handler> handler); - - //deletePet - void deletePet(Long petId, String apiKey, Handler> handler); - - //findPetsByStatus - void findPetsByStatus(List status, Handler>> handler); - - //findPetsByTags - void findPetsByTags(List tags, Handler>> handler); - - //getPetById - void getPetById(Long petId, Handler> handler); - - //updatePet - void updatePet(Pet body, Handler> handler); - - //updatePetWithForm - void updatePetWithForm(Long petId, String name, String status, Handler> handler); - - //uploadFile - void uploadFile(Long petId, String additionalMetadata, File file, Handler> handler); - -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java deleted file mode 100644 index d357d90ca1a4..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -public final class PetApiException extends MainApiException { - public PetApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final PetApiException Pet_addPet_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_deletePet_400_Exception = new PetApiException(400, "Invalid pet value"); - public static final PetApiException Pet_findPetsByStatus_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByStatus_400_Exception = new PetApiException(400, "Invalid status value"); - public static final PetApiException Pet_findPetsByTags_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByTags_400_Exception = new PetApiException(400, "Invalid tag value"); - public static final PetApiException Pet_getPetById_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_getPetById_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_getPetById_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_updatePet_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_405_Exception = new PetApiException(405, "Validation exception"); - public static final PetApiException Pet_updatePetWithForm_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_uploadFile_200_Exception = new PetApiException(200, "successful operation"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java deleted file mode 100644 index d1849cb43f16..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java +++ /dev/null @@ -1,276 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import java.util.List; -import java.util.Map; - -public class PetApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); - - static final String ADDPET_SERVICE_ID = "addPet"; - static final String DELETEPET_SERVICE_ID = "deletePet"; - static final String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; - static final String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; - static final String GETPETBYID_SERVICE_ID = "getPetById"; - static final String UPDATEPET_SERVICE_ID = "updatePet"; - static final String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; - static final String UPLOADFILE_SERVICE_ID = "uploadFile"; - - final PetApi service; - - public PetApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.PetApiImpl"); - service = (PetApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("PetApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for addPet - vertx.eventBus(). consumer(ADDPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "addPet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.addPet(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "addPet"); - } - }); - } catch (Exception e) { - logUnexpectedError("addPet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deletePet - vertx.eventBus(). consumer(DELETEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deletePet"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String apiKeyParam = message.body().getString("api_key"); - String apiKey = (apiKeyParam == null) ? null : apiKeyParam; - service.deletePet(petId, apiKey, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "deletePet"); - } - }); - } catch (Exception e) { - logUnexpectedError("deletePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByStatus - vertx.eventBus(). consumer(FINDPETSBYSTATUS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByStatus"; - JsonArray statusParam = message.body().getJsonArray("status"); - if(statusParam == null) { - manageError(message, new MainApiException(400, "status is required"), serviceId); - return; - } - List status = Json.mapper.readValue(statusParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByStatus(status, result -> { - if (result.succeeded()) - message.reply(new JsonArray(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "findPetsByStatus"); - } - }); - } catch (Exception e) { - logUnexpectedError("findPetsByStatus", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByTags - vertx.eventBus(). consumer(FINDPETSBYTAGS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByTags"; - JsonArray tagsParam = message.body().getJsonArray("tags"); - if(tagsParam == null) { - manageError(message, new MainApiException(400, "tags is required"), serviceId); - return; - } - List tags = Json.mapper.readValue(tagsParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByTags(tags, result -> { - if (result.succeeded()) - message.reply(new JsonArray(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "findPetsByTags"); - } - }); - } catch (Exception e) { - logUnexpectedError("findPetsByTags", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getPetById - vertx.eventBus(). consumer(GETPETBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getPetById"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - service.getPetById(petId, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getPetById"); - } - }); - } catch (Exception e) { - logUnexpectedError("getPetById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePet - vertx.eventBus(). consumer(UPDATEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.updatePet(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "updatePet"); - } - }); - } catch (Exception e) { - logUnexpectedError("updatePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePetWithForm - vertx.eventBus(). consumer(UPDATEPETWITHFORM_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePetWithForm"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String nameParam = message.body().getString("name"); - String name = (nameParam == null) ? null : nameParam; - String statusParam = message.body().getString("status"); - String status = (statusParam == null) ? null : statusParam; - service.updatePetWithForm(petId, name, status, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "updatePetWithForm"); - } - }); - } catch (Exception e) { - logUnexpectedError("updatePetWithForm", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for uploadFile - vertx.eventBus(). consumer(UPLOADFILE_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "uploadFile"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String additionalMetadataParam = message.body().getString("additionalMetadata"); - String additionalMetadata = (additionalMetadataParam == null) ? null : additionalMetadataParam; - String fileParam = message.body().getString("file"); - File file = (fileParam == null) ? null : Json.mapper.readValue(fileParam, File.class); - service.uploadFile(petId, additionalMetadata, file, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "uploadFile"); - } - }); - } catch (Exception e) { - logUnexpectedError("uploadFile", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java deleted file mode 100644 index 656978f999b8..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApi.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; - -import java.util.List; -import java.util.Map; - -public interface StoreApi { - //deleteOrder - void deleteOrder(String orderId, Handler> handler); - - //getInventory - void getInventory(Handler>> handler); - - //getOrderById - void getOrderById(Long orderId, Handler> handler); - - //placeOrder - void placeOrder(Order body, Handler> handler); - -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java deleted file mode 100644 index 7a7a7ea59fb7..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -public final class StoreApiException extends MainApiException { - public StoreApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final StoreApiException Store_deleteOrder_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_deleteOrder_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_getInventory_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_getOrderById_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_placeOrder_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_placeOrder_400_Exception = new StoreApiException(400, "Invalid Order"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java deleted file mode 100644 index b8cb7b01f361..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import java.util.List; -import java.util.Map; - -public class StoreApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); - - static final String DELETEORDER_SERVICE_ID = "deleteOrder"; - static final String GETINVENTORY_SERVICE_ID = "getInventory"; - static final String GETORDERBYID_SERVICE_ID = "getOrderById"; - static final String PLACEORDER_SERVICE_ID = "placeOrder"; - - final StoreApi service; - - public StoreApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.StoreApiImpl"); - service = (StoreApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("StoreApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for deleteOrder - vertx.eventBus(). consumer(DELETEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteOrder"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - String orderId = orderIdParam; - service.deleteOrder(orderId, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "deleteOrder"); - } - }); - } catch (Exception e) { - logUnexpectedError("deleteOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getInventory - vertx.eventBus(). consumer(GETINVENTORY_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getInventory"; - service.getInventory(result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getInventory"); - } - }); - } catch (Exception e) { - logUnexpectedError("getInventory", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getOrderById - vertx.eventBus(). consumer(GETORDERBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getOrderById"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - Long orderId = Json.mapper.readValue(orderIdParam, Long.class); - service.getOrderById(orderId, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getOrderById"); - } - }); - } catch (Exception e) { - logUnexpectedError("getOrderById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for placeOrder - vertx.eventBus(). consumer(PLACEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "placeOrder"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Order body = Json.mapper.readValue(bodyParam.encode(), Order.class); - service.placeOrder(body, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "placeOrder"); - } - }); - } catch (Exception e) { - logUnexpectedError("placeOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java deleted file mode 100644 index 28f23b1501b3..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApi.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; - -import java.util.List; -import java.util.Map; - -public interface UserApi { - //createUser - void createUser(User body, Handler> handler); - - //createUsersWithArrayInput - void createUsersWithArrayInput(List body, Handler> handler); - - //createUsersWithListInput - void createUsersWithListInput(List body, Handler> handler); - - //deleteUser - void deleteUser(String username, Handler> handler); - - //getUserByName - void getUserByName(String username, Handler> handler); - - //loginUser - void loginUser(String username, String password, Handler> handler); - - //logoutUser - void logoutUser(Handler> handler); - - //updateUser - void updateUser(String username, User body, Handler> handler); - -} diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java deleted file mode 100644 index 3fdf14a842e4..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -public final class UserApiException extends MainApiException { - public UserApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final UserApiException User_deleteUser_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_deleteUser_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_getUserByName_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_getUserByName_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_getUserByName_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_loginUser_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_loginUser_400_Exception = new UserApiException(400, "Invalid username/password supplied"); - public static final UserApiException User_updateUser_400_Exception = new UserApiException(400, "Invalid user supplied"); - public static final UserApiException User_updateUser_404_Exception = new UserApiException(404, "User not found"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java b/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java deleted file mode 100644 index 61ac44f5584b..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import java.util.List; -import java.util.Map; - -public class UserApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); - - static final String CREATEUSER_SERVICE_ID = "createUser"; - static final String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; - static final String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; - static final String DELETEUSER_SERVICE_ID = "deleteUser"; - static final String GETUSERBYNAME_SERVICE_ID = "getUserByName"; - static final String LOGINUSER_SERVICE_ID = "loginUser"; - static final String LOGOUTUSER_SERVICE_ID = "logoutUser"; - static final String UPDATEUSER_SERVICE_ID = "updateUser"; - - final UserApi service; - - public UserApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.UserApiImpl"); - service = (UserApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("UserApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for createUser - vertx.eventBus(). consumer(CREATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUser"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.createUser(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "createUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("createUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithArrayInput - vertx.eventBus(). consumer(CREATEUSERSWITHARRAYINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithArrayInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithArrayInput(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "createUsersWithArrayInput"); - } - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithArrayInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithListInput - vertx.eventBus(). consumer(CREATEUSERSWITHLISTINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithListInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithListInput(body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "createUsersWithListInput"); - } - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithListInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deleteUser - vertx.eventBus(). consumer(DELETEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.deleteUser(username, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "deleteUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("deleteUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getUserByName - vertx.eventBus(). consumer(GETUSERBYNAME_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getUserByName"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.getUserByName(username, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "getUserByName"); - } - }); - } catch (Exception e) { - logUnexpectedError("getUserByName", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for loginUser - vertx.eventBus(). consumer(LOGINUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "loginUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - String passwordParam = message.body().getString("password"); - if(passwordParam == null) { - manageError(message, new MainApiException(400, "password is required"), serviceId); - return; - } - String password = passwordParam; - service.loginUser(username, password, result -> { - if (result.succeeded()) - message.reply(new JsonObject(Json.encode(result.result())).encodePrettily()); - else { - Throwable cause = result.cause(); - manageError(message, cause, "loginUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("loginUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for logoutUser - vertx.eventBus(). consumer(LOGOUTUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "logoutUser"; - service.logoutUser(result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "logoutUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("logoutUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updateUser - vertx.eventBus(). consumer(UPDATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updateUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.updateUser(username, body, result -> { - if (result.succeeded()) - message.reply(null); - else { - Throwable cause = result.cause(); - manageError(message, cause, "updateUser"); - } - }); - } catch (Exception e) { - logUnexpectedError("updateUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json deleted file mode 100644 index c292bb5e95a4..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/resources/openapi.json +++ /dev/null @@ -1,1082 +0,0 @@ -{ - "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", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "addPet", - "x-serviceid-varname" : "ADDPET_SERVICE_ID" - }, - "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", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "updatePet", - "x-serviceid-varname" : "UPDATEPET_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "findPetsByStatus", - "x-serviceid-varname" : "FINDPETSBYSTATUS_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "findPetsByTags", - "x-serviceid-varname" : "FINDPETSBYTAGS_SERVICE_ID" - } - }, - "/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" ], - "x-accepts" : "application/json", - "x-serviceid" : "deletePet", - "x-serviceid-varname" : "DELETEPET_SERVICE_ID" - }, - "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", - "x-serviceid" : "getPetById", - "x-serviceid-varname" : "GETPETBYID_SERVICE_ID" - }, - "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", - "x-serviceid" : "updatePetWithForm", - "x-serviceid-varname" : "UPDATEPETWITHFORM_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "uploadFile", - "x-serviceid-varname" : "UPLOADFILE_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "getInventory", - "x-serviceid-varname" : "GETINVENTORY_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "placeOrder", - "x-serviceid-varname" : "PLACEORDER_SERVICE_ID" - } - }, - "/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" ], - "x-accepts" : "application/json", - "x-serviceid" : "deleteOrder", - "x-serviceid-varname" : "DELETEORDER_SERVICE_ID" - }, - "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" ], - "x-accepts" : "application/json", - "x-serviceid" : "getOrderById", - "x-serviceid-varname" : "GETORDERBYID_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "createUser", - "x-serviceid-varname" : "CREATEUSER_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "createUsersWithArrayInput", - "x-serviceid-varname" : "CREATEUSERSWITHARRAYINPUT_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "createUsersWithListInput", - "x-serviceid-varname" : "CREATEUSERSWITHLISTINPUT_SERVICE_ID" - } - }, - "/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" ], - "x-accepts" : "application/json", - "x-serviceid" : "loginUser", - "x-serviceid-varname" : "LOGINUSER_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "logoutUser", - "x-serviceid-varname" : "LOGOUTUSER_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "deleteUser", - "x-serviceid-varname" : "DELETEUSER_SERVICE_ID" - }, - "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", - "x-serviceid" : "getUserByName", - "x-serviceid-varname" : "GETUSERBYNAME_SERVICE_ID" - }, - "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", - "x-serviceid" : "updateUser", - "x-serviceid-varname" : "UPDATEUSER_SERVICE_ID" - } - } - }, - "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" - } - } - }, - "x-original-swagger-version" : "2.0" -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties b/samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties deleted file mode 100644 index 706d6d9b2f4c..000000000000 --- a/samples/server/petstore/java-vertx/async/src/main/resources/vertx-default-jul-logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2014 Red Hat, Inc. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# and Apache License v2.0 which accompanies this distribution. -# -# The Eclipse Public License is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# The Apache License v2.0 is available at -# http://www.opensource.org/licenses/apache2.0.php -# -# You may elect to redistribute this code under either of these licenses. -# -handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler -java.util.logging.SimpleFormatter.format=%5$s %6$s\n -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.FileHandler.level=INFO -java.util.logging.FileHandler.formatter=io.vertx.core.logging.VertxLoggerFormatter - -# Put the log in the system temporary directory -java.util.logging.FileHandler.pattern=vertx.log - -.level=INFO -io.vertx.ext.web.level=FINEST -io.vertx.level=INFO -com.hazelcast.level=INFO -io.netty.util.internal.PlatformDependent.level=SEVERE \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator-ignore b/samples/server/petstore/java-vertx/rx/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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/java-vertx/rx/.openapi-generator/FILES b/samples/server/petstore/java-vertx/rx/.openapi-generator/FILES deleted file mode 100644 index d863c5cf45a6..000000000000 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator/FILES +++ /dev/null @@ -1,21 +0,0 @@ -README.md -pom.xml -src/main/java/org/openapitools/server/api/MainApiException.java -src/main/java/org/openapitools/server/api/MainApiVerticle.java -src/main/java/org/openapitools/server/api/model/Category.java -src/main/java/org/openapitools/server/api/model/ModelApiResponse.java -src/main/java/org/openapitools/server/api/model/Order.java -src/main/java/org/openapitools/server/api/model/Pet.java -src/main/java/org/openapitools/server/api/model/Tag.java -src/main/java/org/openapitools/server/api/model/User.java -src/main/java/org/openapitools/server/api/verticle/PetApi.java -src/main/java/org/openapitools/server/api/verticle/PetApiException.java -src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/StoreApi.java -src/main/java/org/openapitools/server/api/verticle/StoreApiException.java -src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java -src/main/java/org/openapitools/server/api/verticle/UserApi.java -src/main/java/org/openapitools/server/api/verticle/UserApiException.java -src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java -src/main/resources/openapi.json -src/main/resources/vertx-default-jul-logging.properties diff --git a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION b/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION deleted file mode 100644 index 3fa3b389a57d..000000000000 --- a/samples/server/petstore/java-vertx/rx/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/README.md b/samples/server/petstore/java-vertx/rx/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/samples/server/petstore/java-vertx/rx/pom.xml b/samples/server/petstore/java-vertx/rx/pom.xml deleted file mode 100644 index 2b575c68e750..000000000000 --- a/samples/server/petstore/java-vertx/rx/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - 4.0.0 - - org.openapitools - java-vertx-rx-server - 1.0.0-SNAPSHOT - jar - - OpenAPI Petstore - - - UTF-8 - 1.8 - 4.13.1 - 3.4.1 - 3.8.1 - 1.4.0 - 2.3 - 2.7.4 - - - - - junit - junit - ${junit.version} - test - - - - io.vertx - vertx-unit - ${vertx.version} - test - - - - com.github.phiz71 - vertx-swagger-router - ${vertx-swagger-router.version} - - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-datatype-jsr310.version} - - - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - - package - - shade - - - - - - io.vertx.core.Starter - org.openapitools.server.api.MainApiVerticle - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-fat.jar - - - - - - - diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java deleted file mode 100644 index 4aef710c011b..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api; - -public class MainApiException extends Exception { - private int statusCode; - private String statusMessage; - - public MainApiException(int statusCode, String statusMessage) { - super(); - this.statusCode = statusCode; - this.statusMessage = statusMessage; - } - - public int getStatusCode() { - return statusCode; - } - - public String getStatusMessage() { - return statusMessage; - } - - public static final MainApiException INTERNAL_SERVER_ERROR = new MainApiException(500, "Internal Server Error"); -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java deleted file mode 100644 index 26381f058f1b..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/MainApiVerticle.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.openapitools.server.api; - -import java.nio.charset.Charset; - -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.github.phiz71.vertx.swagger.router.OperationIdServiceIdResolver; -import com.github.phiz71.vertx.swagger.router.SwaggerRouter; - -import io.swagger.models.Swagger; -import io.swagger.parser.SwaggerParser; -import io.vertx.core.AbstractVerticle; -import io.vertx.core.Context; -import io.vertx.core.Future; -import io.vertx.core.file.FileSystem; -import io.vertx.core.json.Json; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; -import io.vertx.core.Vertx; -import io.vertx.ext.web.Router; - -public class MainApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class); - - private int serverPort = 8080; - protected Router router; - - public int getServerPort() { - return serverPort; - } - - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - @Override - public void init(Vertx vertx, Context context) { - super.init(vertx, context); - router = Router.router(vertx); - } - - @Override - public void start(Future startFuture) throws Exception { - Json.mapper.registerModule(new JavaTimeModule()); - FileSystem vertxFileSystem = vertx.fileSystem(); - vertxFileSystem.readFile("openapi.json", readFile -> { - if (readFile.succeeded()) { - Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8"))); - Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver()); - - deployVerticles(startFuture); - - vertx.createHttpServer() - .requestHandler(swaggerRouter::accept) - .listen(serverPort, h -> { - if (h.succeeded()) { - startFuture.complete(); - } else { - startFuture.fail(h.cause()); - } - }); - } else { - startFuture.fail(readFile.cause()); - } - }); - } - - public void deployVerticles(Future startFuture) { - - vertx.deployVerticle("org.openapitools.server.api.verticle.PetApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("PetApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("PetApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.StoreApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("StoreApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("StoreApiVerticle : Deployment failed"); - } - }); - - vertx.deployVerticle("org.openapitools.server.api.verticle.UserApiVerticle", res -> { - if (res.succeeded()) { - LOGGER.info("UserApiVerticle : Deployed"); - } else { - startFuture.fail(res.cause()); - LOGGER.error("UserApiVerticle : Deployment failed"); - } - }); - - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java deleted file mode 100644 index f05201c45add..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Category.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A category for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Category { - - private Long id; - private String name; - - public Category () { - - } - - public Category (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return Objects.equals(id, category.id) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java deleted file mode 100644 index 934a6efdf966..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/ModelApiResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Describes the result of uploading an image resource - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class ModelApiResponse { - - private Integer code; - private String type; - private String message; - - public ModelApiResponse () { - - } - - public ModelApiResponse (Integer code, String type, String message) { - this.code = code; - this.type = type; - this.message = message; - } - - - @JsonProperty("code") - public Integer getCode() { - return code; - } - public void setCode(Integer code) { - this.code = code; - } - - - @JsonProperty("type") - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - - - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(code, _apiResponse.code) && - Objects.equals(type, _apiResponse.type) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java deleted file mode 100644 index 0d8d6714212c..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Order.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.time.OffsetDateTime; - -/** - * An order for a pets from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Order { - - private Long id; - private Long petId; - private Integer quantity; - private OffsetDateTime shipDate; - - - public enum StatusEnum { - PLACED("placed"), - APPROVED("approved"), - DELIVERED("delivered"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - private Boolean complete = false; - - public Order () { - - } - - public Order (Long id, Long petId, Integer quantity, OffsetDateTime shipDate, StatusEnum status, Boolean complete) { - this.id = id; - this.petId = petId; - this.quantity = quantity; - this.shipDate = shipDate; - this.status = status; - this.complete = complete; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("petId") - public Long getPetId() { - return petId; - } - public void setPetId(Long petId) { - this.petId = petId; - } - - - @JsonProperty("quantity") - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - - @JsonProperty("shipDate") - public OffsetDateTime getShipDate() { - return shipDate; - } - public void setShipDate(OffsetDateTime shipDate) { - this.shipDate = shipDate; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @JsonProperty("complete") - public Boolean getComplete() { - return complete; - } - public void setComplete(Boolean complete) { - this.complete = complete; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Order order = (Order) o; - return Objects.equals(id, order.id) && - Objects.equals(petId, order.petId) && - Objects.equals(quantity, order.quantity) && - Objects.equals(shipDate, order.shipDate) && - Objects.equals(status, order.status) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java deleted file mode 100644 index cb9325acf5db..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Pet.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.ArrayList; -import java.util.List; -import org.openapitools.server.api.model.Category; -import org.openapitools.server.api.model.Tag; - -/** - * A pet for sale in the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Pet { - - private Long id; - private Category category; - private String name; - private List photoUrls = new ArrayList<>(); - private List tags = new ArrayList<>(); - - - public enum StatusEnum { - AVAILABLE("available"), - PENDING("pending"), - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return value; - } - } - - private StatusEnum status; - - public Pet () { - - } - - public Pet (Long id, Category category, String name, List photoUrls, List tags, StatusEnum status) { - this.id = id; - this.category = category; - this.name = name; - this.photoUrls = photoUrls; - this.tags = tags; - this.status = status; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("category") - public Category getCategory() { - return category; - } - public void setCategory(Category category) { - this.category = category; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @JsonProperty("photoUrls") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - - @JsonProperty("tags") - public List getTags() { - return tags; - } - public void setTags(List tags) { - this.tags = tags; - } - - - @JsonProperty("status") - public StatusEnum getStatus() { - return status; - } - public void setStatus(StatusEnum status) { - this.status = status; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pet pet = (Pet) o; - return Objects.equals(id, pet.id) && - Objects.equals(category, pet.category) && - Objects.equals(name, pet.name) && - Objects.equals(photoUrls, pet.photoUrls) && - Objects.equals(tags, pet.tags) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java deleted file mode 100644 index 0389c2fbeea8..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/Tag.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A tag for a pet - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Tag { - - private Long id; - private String name; - - public Tag () { - - } - - public Tag (Long id, String name) { - this.id = id; - this.name = name; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("name") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Tag tag = (Tag) o; - return Objects.equals(id, tag.id) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java deleted file mode 100644 index 0e1e87555552..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/model/User.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.openapitools.server.api.model; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * A User who is purchasing from the pet store - **/ -@JsonInclude(JsonInclude.Include.NON_NULL) -public class User { - - private Long id; - private String username; - private String firstName; - private String lastName; - private String email; - private String password; - private String phone; - private Integer userStatus; - - public User () { - - } - - public User (Long id, String username, String firstName, String lastName, String email, String password, String phone, Integer userStatus) { - this.id = id; - this.username = username; - this.firstName = firstName; - this.lastName = lastName; - this.email = email; - this.password = password; - this.phone = phone; - this.userStatus = userStatus; - } - - - @JsonProperty("id") - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - - @JsonProperty("username") - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - - - @JsonProperty("firstName") - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - - @JsonProperty("lastName") - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - - - @JsonProperty("email") - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - - @JsonProperty("password") - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - - - @JsonProperty("phone") - public String getPhone() { - return phone; - } - public void setPhone(String phone) { - this.phone = phone; - } - - - @JsonProperty("userStatus") - public Integer getUserStatus() { - return userStatus; - } - public void setUserStatus(Integer userStatus) { - this.userStatus = userStatus; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(id, user.id) && - Objects.equals(username, user.username) && - Objects.equals(firstName, user.firstName) && - Objects.equals(lastName, user.lastName) && - Objects.equals(email, user.email) && - Objects.equals(password, user.password) && - Objects.equals(phone, user.phone) && - Objects.equals(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(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java deleted file mode 100644 index ae86f9bee709..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApi.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import rx.Completable; -import rx.Single; - -import java.util.List; -import java.util.Map; - -public interface PetApi { - //addPet - public Completable addPet(Pet body); - - //deletePet - public Completable deletePet(Long petId,String apiKey); - - //findPetsByStatus - public Single> findPetsByStatus(List status); - - //findPetsByTags - public Single> findPetsByTags(List tags); - - //getPetById - public Single getPetById(Long petId); - - //updatePet - public Completable updatePet(Pet body); - - //updatePetWithForm - public Completable updatePetWithForm(Long petId,String name,String status); - - //uploadFile - public Single uploadFile(Long petId,String additionalMetadata,File file); - -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java deleted file mode 100644 index d357d90ca1a4..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openapitools.server.api.verticle; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -public final class PetApiException extends MainApiException { - public PetApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final PetApiException Pet_addPet_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_deletePet_400_Exception = new PetApiException(400, "Invalid pet value"); - public static final PetApiException Pet_findPetsByStatus_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByStatus_400_Exception = new PetApiException(400, "Invalid status value"); - public static final PetApiException Pet_findPetsByTags_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_findPetsByTags_400_Exception = new PetApiException(400, "Invalid tag value"); - public static final PetApiException Pet_getPetById_200_Exception = new PetApiException(200, "successful operation"); - public static final PetApiException Pet_getPetById_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_getPetById_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_400_Exception = new PetApiException(400, "Invalid ID supplied"); - public static final PetApiException Pet_updatePet_404_Exception = new PetApiException(404, "Pet not found"); - public static final PetApiException Pet_updatePet_405_Exception = new PetApiException(405, "Validation exception"); - public static final PetApiException Pet_updatePetWithForm_405_Exception = new PetApiException(405, "Invalid input"); - public static final PetApiException Pet_uploadFile_200_Exception = new PetApiException(200, "successful operation"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java deleted file mode 100644 index 2d5cfdb068be..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/PetApiVerticle.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import java.io.File; -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.ModelApiResponse; -import org.openapitools.server.api.model.Pet; - -import java.util.List; -import java.util.Map; - -public class PetApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(PetApiVerticle.class); - - static final String ADDPET_SERVICE_ID = "addPet"; - static final String DELETEPET_SERVICE_ID = "deletePet"; - static final String FINDPETSBYSTATUS_SERVICE_ID = "findPetsByStatus"; - static final String FINDPETSBYTAGS_SERVICE_ID = "findPetsByTags"; - static final String GETPETBYID_SERVICE_ID = "getPetById"; - static final String UPDATEPET_SERVICE_ID = "updatePet"; - static final String UPDATEPETWITHFORM_SERVICE_ID = "updatePetWithForm"; - static final String UPLOADFILE_SERVICE_ID = "uploadFile"; - - final PetApi service; - - public PetApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.PetApiImpl"); - service = (PetApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("PetApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for addPet - vertx.eventBus(). consumer(ADDPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "addPet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.addPet(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "addPet"); - }); - } catch (Exception e) { - logUnexpectedError("addPet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deletePet - vertx.eventBus(). consumer(DELETEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deletePet"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String apiKeyParam = message.body().getString("api_key"); - String apiKey = (apiKeyParam == null) ? null : apiKeyParam; - service.deletePet(petId, apiKey).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "deletePet"); - }); - } catch (Exception e) { - logUnexpectedError("deletePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByStatus - vertx.eventBus(). consumer(FINDPETSBYSTATUS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByStatus"; - JsonArray statusParam = message.body().getJsonArray("status"); - if(statusParam == null) { - manageError(message, new MainApiException(400, "status is required"), serviceId); - return; - } - List status = Json.mapper.readValue(statusParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByStatus(status).subscribe( - result -> { - message.reply(new JsonArray(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "findPetsByStatus"); - }); - } catch (Exception e) { - logUnexpectedError("findPetsByStatus", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for findPetsByTags - vertx.eventBus(). consumer(FINDPETSBYTAGS_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "findPetsByTags"; - JsonArray tagsParam = message.body().getJsonArray("tags"); - if(tagsParam == null) { - manageError(message, new MainApiException(400, "tags is required"), serviceId); - return; - } - List tags = Json.mapper.readValue(tagsParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, String.class)); - service.findPetsByTags(tags).subscribe( - result -> { - message.reply(new JsonArray(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "findPetsByTags"); - }); - } catch (Exception e) { - logUnexpectedError("findPetsByTags", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getPetById - vertx.eventBus(). consumer(GETPETBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getPetById"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - service.getPetById(petId).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getPetById"); - }); - } catch (Exception e) { - logUnexpectedError("getPetById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePet - vertx.eventBus(). consumer(UPDATEPET_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePet"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Pet body = Json.mapper.readValue(bodyParam.encode(), Pet.class); - service.updatePet(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "updatePet"); - }); - } catch (Exception e) { - logUnexpectedError("updatePet", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updatePetWithForm - vertx.eventBus(). consumer(UPDATEPETWITHFORM_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updatePetWithForm"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String nameParam = message.body().getString("name"); - String name = (nameParam == null) ? null : nameParam; - String statusParam = message.body().getString("status"); - String status = (statusParam == null) ? null : statusParam; - service.updatePetWithForm(petId, name, status).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "updatePetWithForm"); - }); - } catch (Exception e) { - logUnexpectedError("updatePetWithForm", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for uploadFile - vertx.eventBus(). consumer(UPLOADFILE_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "uploadFile"; - String petIdParam = message.body().getString("petId"); - if(petIdParam == null) { - manageError(message, new MainApiException(400, "petId is required"), serviceId); - return; - } - Long petId = Json.mapper.readValue(petIdParam, Long.class); - String additionalMetadataParam = message.body().getString("additionalMetadata"); - String additionalMetadata = (additionalMetadataParam == null) ? null : additionalMetadataParam; - String fileParam = message.body().getString("file"); - File file = (fileParam == null) ? null : Json.mapper.readValue(fileParam, File.class); - service.uploadFile(petId, additionalMetadata, file).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "uploadFile"); - }); - } catch (Exception e) { - logUnexpectedError("uploadFile", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java deleted file mode 100644 index 8f9c735708bd..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApi.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import rx.Completable; -import rx.Single; - -import java.util.List; -import java.util.Map; - -public interface StoreApi { - //deleteOrder - public Completable deleteOrder(String orderId); - - //getInventory - public Single> getInventory(); - - //getOrderById - public Single getOrderById(Long orderId); - - //placeOrder - public Single placeOrder(Order body); - -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java deleted file mode 100644 index 7a7a7ea59fb7..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -public final class StoreApiException extends MainApiException { - public StoreApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final StoreApiException Store_deleteOrder_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_deleteOrder_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_getInventory_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_getOrderById_400_Exception = new StoreApiException(400, "Invalid ID supplied"); - public static final StoreApiException Store_getOrderById_404_Exception = new StoreApiException(404, "Order not found"); - public static final StoreApiException Store_placeOrder_200_Exception = new StoreApiException(200, "successful operation"); - public static final StoreApiException Store_placeOrder_400_Exception = new StoreApiException(400, "Invalid Order"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java deleted file mode 100644 index f8b2d9ce0aa5..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/StoreApiVerticle.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.Order; - -import java.util.List; -import java.util.Map; - -public class StoreApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(StoreApiVerticle.class); - - static final String DELETEORDER_SERVICE_ID = "deleteOrder"; - static final String GETINVENTORY_SERVICE_ID = "getInventory"; - static final String GETORDERBYID_SERVICE_ID = "getOrderById"; - static final String PLACEORDER_SERVICE_ID = "placeOrder"; - - final StoreApi service; - - public StoreApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.StoreApiImpl"); - service = (StoreApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("StoreApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for deleteOrder - vertx.eventBus(). consumer(DELETEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteOrder"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - String orderId = orderIdParam; - service.deleteOrder(orderId).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "deleteOrder"); - }); - } catch (Exception e) { - logUnexpectedError("deleteOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getInventory - vertx.eventBus(). consumer(GETINVENTORY_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getInventory"; - service.getInventory().subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getInventory"); - }); - } catch (Exception e) { - logUnexpectedError("getInventory", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getOrderById - vertx.eventBus(). consumer(GETORDERBYID_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getOrderById"; - String orderIdParam = message.body().getString("orderId"); - if(orderIdParam == null) { - manageError(message, new MainApiException(400, "orderId is required"), serviceId); - return; - } - Long orderId = Json.mapper.readValue(orderIdParam, Long.class); - service.getOrderById(orderId).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getOrderById"); - }); - } catch (Exception e) { - logUnexpectedError("getOrderById", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for placeOrder - vertx.eventBus(). consumer(PLACEORDER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "placeOrder"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - Order body = Json.mapper.readValue(bodyParam.encode(), Order.class); - service.placeOrder(body).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "placeOrder"); - }); - } catch (Exception e) { - logUnexpectedError("placeOrder", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java deleted file mode 100644 index cc6be61055cd..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApi.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import rx.Completable; -import rx.Single; - -import java.util.List; -import java.util.Map; - -public interface UserApi { - //createUser - public Completable createUser(User body); - - //createUsersWithArrayInput - public Completable createUsersWithArrayInput(List body); - - //createUsersWithListInput - public Completable createUsersWithListInput(List body); - - //deleteUser - public Completable deleteUser(String username); - - //getUserByName - public Single getUserByName(String username); - - //loginUser - public Single loginUser(String username,String password); - - //logoutUser - public Completable logoutUser(); - - //updateUser - public Completable updateUser(String username,User body); - -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java deleted file mode 100644 index 3fdf14a842e4..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiException.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.openapitools.server.api.verticle; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -public final class UserApiException extends MainApiException { - public UserApiException(int statusCode, String statusMessage) { - super(statusCode, statusMessage); - } - - public static final UserApiException User_deleteUser_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_deleteUser_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_getUserByName_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_getUserByName_400_Exception = new UserApiException(400, "Invalid username supplied"); - public static final UserApiException User_getUserByName_404_Exception = new UserApiException(404, "User not found"); - public static final UserApiException User_loginUser_200_Exception = new UserApiException(200, "successful operation"); - public static final UserApiException User_loginUser_400_Exception = new UserApiException(400, "Invalid username/password supplied"); - public static final UserApiException User_updateUser_400_Exception = new UserApiException(400, "Invalid user supplied"); - public static final UserApiException User_updateUser_404_Exception = new UserApiException(404, "User not found"); - - -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java b/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java deleted file mode 100644 index 756b31863fa7..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/java/org/openapitools/server/api/verticle/UserApiVerticle.java +++ /dev/null @@ -1,262 +0,0 @@ -package org.openapitools.server.api.verticle; - -import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.Message; -import io.vertx.core.json.Json; -import io.vertx.core.json.JsonArray; -import io.vertx.core.json.JsonObject; -import io.vertx.core.logging.Logger; -import io.vertx.core.logging.LoggerFactory; - -import org.openapitools.server.api.MainApiException; -import org.openapitools.server.api.model.User; - -import java.util.List; -import java.util.Map; - -public class UserApiVerticle extends AbstractVerticle { - static final Logger LOGGER = LoggerFactory.getLogger(UserApiVerticle.class); - - static final String CREATEUSER_SERVICE_ID = "createUser"; - static final String CREATEUSERSWITHARRAYINPUT_SERVICE_ID = "createUsersWithArrayInput"; - static final String CREATEUSERSWITHLISTINPUT_SERVICE_ID = "createUsersWithListInput"; - static final String DELETEUSER_SERVICE_ID = "deleteUser"; - static final String GETUSERBYNAME_SERVICE_ID = "getUserByName"; - static final String LOGINUSER_SERVICE_ID = "loginUser"; - static final String LOGOUTUSER_SERVICE_ID = "logoutUser"; - static final String UPDATEUSER_SERVICE_ID = "updateUser"; - - final UserApi service; - - public UserApiVerticle() { - try { - Class serviceImplClass = getClass().getClassLoader().loadClass("org.openapitools.server.api.verticle.UserApiImpl"); - service = (UserApi)serviceImplClass.newInstance(); - } catch (Exception e) { - logUnexpectedError("UserApiVerticle constructor", e); - throw new RuntimeException(e); - } - } - - @Override - public void start() throws Exception { - - //Consumer for createUser - vertx.eventBus(). consumer(CREATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUser"; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.createUser(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "createUser"); - }); - } catch (Exception e) { - logUnexpectedError("createUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithArrayInput - vertx.eventBus(). consumer(CREATEUSERSWITHARRAYINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithArrayInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithArrayInput(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "createUsersWithArrayInput"); - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithArrayInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for createUsersWithListInput - vertx.eventBus(). consumer(CREATEUSERSWITHLISTINPUT_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "createUsersWithListInput"; - JsonArray bodyParam = message.body().getJsonArray("body"); - if(bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - List body = Json.mapper.readValue(bodyParam.encode(), - Json.mapper.getTypeFactory().constructCollectionType(List.class, User.class)); - service.createUsersWithListInput(body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "createUsersWithListInput"); - }); - } catch (Exception e) { - logUnexpectedError("createUsersWithListInput", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for deleteUser - vertx.eventBus(). consumer(DELETEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "deleteUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.deleteUser(username).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "deleteUser"); - }); - } catch (Exception e) { - logUnexpectedError("deleteUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for getUserByName - vertx.eventBus(). consumer(GETUSERBYNAME_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "getUserByName"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - service.getUserByName(username).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "getUserByName"); - }); - } catch (Exception e) { - logUnexpectedError("getUserByName", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for loginUser - vertx.eventBus(). consumer(LOGINUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "loginUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - String passwordParam = message.body().getString("password"); - if(passwordParam == null) { - manageError(message, new MainApiException(400, "password is required"), serviceId); - return; - } - String password = passwordParam; - service.loginUser(username, password).subscribe( - result -> { - message.reply(new JsonObject(Json.encode(result)).encodePrettily()); - }, - error -> { - manageError(message, error, "loginUser"); - }); - } catch (Exception e) { - logUnexpectedError("loginUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for logoutUser - vertx.eventBus(). consumer(LOGOUTUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "logoutUser"; - service.logoutUser().subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "logoutUser"); - }); - } catch (Exception e) { - logUnexpectedError("logoutUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - //Consumer for updateUser - vertx.eventBus(). consumer(UPDATEUSER_SERVICE_ID).handler(message -> { - try { - // Workaround for #allParams section clearing the vendorExtensions map - String serviceId = "updateUser"; - String usernameParam = message.body().getString("username"); - if(usernameParam == null) { - manageError(message, new MainApiException(400, "username is required"), serviceId); - return; - } - String username = usernameParam; - JsonObject bodyParam = message.body().getJsonObject("body"); - if (bodyParam == null) { - manageError(message, new MainApiException(400, "body is required"), serviceId); - return; - } - User body = Json.mapper.readValue(bodyParam.encode(), User.class); - service.updateUser(username, body).subscribe( - () -> { - message.reply(null); - }, - error -> { - manageError(message, error, "updateUser"); - }); - } catch (Exception e) { - logUnexpectedError("updateUser", e); - message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage()); - } - }); - - } - - private void manageError(Message message, Throwable cause, String serviceName) { - int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(); - String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage(); - if (cause instanceof MainApiException) { - code = ((MainApiException)cause).getStatusCode(); - statusMessage = ((MainApiException)cause).getStatusMessage(); - } else { - logUnexpectedError(serviceName, cause); - } - - message.fail(code, statusMessage); - } - - private void logUnexpectedError(String serviceName, Throwable cause) { - LOGGER.error("Unexpected error in "+ serviceName, cause); - } -} diff --git a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json b/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json deleted file mode 100644 index c292bb5e95a4..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/resources/openapi.json +++ /dev/null @@ -1,1082 +0,0 @@ -{ - "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", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "addPet", - "x-serviceid-varname" : "ADDPET_SERVICE_ID" - }, - "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", - "x-contentType" : "application/json", - "x-accepts" : "application/json", - "x-serviceid" : "updatePet", - "x-serviceid-varname" : "UPDATEPET_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "findPetsByStatus", - "x-serviceid-varname" : "FINDPETSBYSTATUS_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "findPetsByTags", - "x-serviceid-varname" : "FINDPETSBYTAGS_SERVICE_ID" - } - }, - "/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" ], - "x-accepts" : "application/json", - "x-serviceid" : "deletePet", - "x-serviceid-varname" : "DELETEPET_SERVICE_ID" - }, - "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", - "x-serviceid" : "getPetById", - "x-serviceid-varname" : "GETPETBYID_SERVICE_ID" - }, - "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", - "x-serviceid" : "updatePetWithForm", - "x-serviceid-varname" : "UPDATEPETWITHFORM_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "uploadFile", - "x-serviceid-varname" : "UPLOADFILE_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "getInventory", - "x-serviceid-varname" : "GETINVENTORY_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "placeOrder", - "x-serviceid-varname" : "PLACEORDER_SERVICE_ID" - } - }, - "/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" ], - "x-accepts" : "application/json", - "x-serviceid" : "deleteOrder", - "x-serviceid-varname" : "DELETEORDER_SERVICE_ID" - }, - "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" ], - "x-accepts" : "application/json", - "x-serviceid" : "getOrderById", - "x-serviceid-varname" : "GETORDERBYID_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "createUser", - "x-serviceid-varname" : "CREATEUSER_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "createUsersWithArrayInput", - "x-serviceid-varname" : "CREATEUSERSWITHARRAYINPUT_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "createUsersWithListInput", - "x-serviceid-varname" : "CREATEUSERSWITHLISTINPUT_SERVICE_ID" - } - }, - "/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" ], - "x-accepts" : "application/json", - "x-serviceid" : "loginUser", - "x-serviceid-varname" : "LOGINUSER_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "logoutUser", - "x-serviceid-varname" : "LOGOUTUSER_SERVICE_ID" - } - }, - "/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", - "x-serviceid" : "deleteUser", - "x-serviceid-varname" : "DELETEUSER_SERVICE_ID" - }, - "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", - "x-serviceid" : "getUserByName", - "x-serviceid-varname" : "GETUSERBYNAME_SERVICE_ID" - }, - "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", - "x-serviceid" : "updateUser", - "x-serviceid-varname" : "UPDATEUSER_SERVICE_ID" - } - } - }, - "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" - } - } - }, - "x-original-swagger-version" : "2.0" -} \ No newline at end of file diff --git a/samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties b/samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties deleted file mode 100644 index 706d6d9b2f4c..000000000000 --- a/samples/server/petstore/java-vertx/rx/src/main/resources/vertx-default-jul-logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2014 Red Hat, Inc. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# and Apache License v2.0 which accompanies this distribution. -# -# The Eclipse Public License is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# The Apache License v2.0 is available at -# http://www.opensource.org/licenses/apache2.0.php -# -# You may elect to redistribute this code under either of these licenses. -# -handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler -java.util.logging.SimpleFormatter.format=%5$s %6$s\n -java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.ConsoleHandler.level=FINEST -java.util.logging.FileHandler.level=INFO -java.util.logging.FileHandler.formatter=io.vertx.core.logging.VertxLoggerFormatter - -# Put the log in the system temporary directory -java.util.logging.FileHandler.pattern=vertx.log - -.level=INFO -io.vertx.ext.web.level=FINEST -io.vertx.level=INFO -com.hazelcast.level=INFO -io.netty.util.internal.PlatformDependent.level=SEVERE \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java index 498a5e0d55a4..7bd7f41f1203 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java @@ -10,6 +10,7 @@ import io.swagger.jaxrs.*; import java.io.File; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; +import java.util.Set; import java.util.Map; import java.util.List; @@ -115,17 +116,17 @@ public class PetApi { @Path("/findByTags") @Produces({ "application/xml", "application/json" }) - @io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "Set", authorizations = { @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") }) }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "Set"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @QueryParam("tags") @NotNull @Valid List tags,@Context SecurityContext securityContext) + public Response findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @QueryParam("tags") @NotNull @Valid Set tags,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags, securityContext); } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java index 980e4a86f31e..a019a9f498f7 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java @@ -8,6 +8,7 @@ import org.glassfish.jersey.media.multipart.FormDataBodyPart; import java.io.File; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; +import java.util.Set; import java.util.List; import org.openapitools.api.NotFoundException; @@ -22,7 +23,7 @@ public abstract class PetApiService { public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; public abstract Response findPetsByStatus( @NotNull List status,SecurityContext securityContext) throws NotFoundException; - public abstract Response findPetsByTags( @NotNull List tags,SecurityContext securityContext) throws NotFoundException; + public abstract Response findPetsByTags( @NotNull Set tags,SecurityContext securityContext) throws NotFoundException; public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; public abstract Response updatePet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java index 65d3a132944b..adcdbf24a57d 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java @@ -20,7 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; import org.openapitools.model.Category; import org.openapitools.model.Tag; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -54,7 +56,7 @@ public class Pet { public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; @JsonProperty(JSON_PROPERTY_PHOTO_URLS) - private List photoUrls = new ArrayList(); + private Set photoUrls = new LinkedHashSet(); public static final String JSON_PROPERTY_TAGS = "tags"; @JsonProperty(JSON_PROPERTY_TAGS) @@ -157,7 +159,7 @@ public class Pet { this.name = name; } - public Pet photoUrls(List photoUrls) { + public Pet photoUrls(Set photoUrls) { this.photoUrls = photoUrls; return this; } @@ -174,11 +176,11 @@ public class Pet { @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") @NotNull - public List getPhotoUrls() { + public Set getPhotoUrls() { return photoUrls; } - public void setPhotoUrls(List photoUrls) { + public void setPhotoUrls(Set photoUrls) { this.photoUrls = photoUrls; } diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index 6d874bf7d91a..950a9f175fa4 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -6,6 +6,7 @@ import org.openapitools.model.*; import java.io.File; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; +import java.util.Set; import java.util.List; import org.openapitools.api.NotFoundException; @@ -35,7 +36,7 @@ public class PetApiServiceImpl extends PetApiService { return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } @Override - public Response findPetsByTags( @NotNull List tags, SecurityContext securityContext) throws NotFoundException { + public Response findPetsByTags( @NotNull Set tags, SecurityContext securityContext) throws NotFoundException { // do some magic! return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); } diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt index dc79ef79e703..dd392773e96a 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/models/Order.kt @@ -26,7 +26,7 @@ data class Order ( val id: kotlin.Long? = null, val petId: kotlin.Long? = null, val quantity: kotlin.Int? = null, - val shipDate: java.time.LocalDateTime? = null, + val shipDate: java.time.OffsetDateTime? = null, /* Order Status */ val status: Order.Status? = null, val complete: kotlin.Boolean? = null diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION +++ b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt index b500f9155686..9de503175ac7 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -13,14 +13,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -39,7 +32,7 @@ import kotlin.collections.Map @RestController @Validated -@Api(value = "Pet", description = "The Pet API") +@Api(value = "pet", description = "The pet API") @RequestMapping("\${api.base-path:/v2}") class PetApiController(@Autowired(required = true) val service: PetApiService) { @@ -50,10 +43,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 405, message = "Invalid input")]) - @RequestMapping( + @PostMapping( value = ["/pet"], - consumes = ["application/json", "application/xml"], - method = [RequestMethod.POST]) + consumes = ["application/json", "application/xml"] + ) fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet ): ResponseEntity { return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405)) @@ -66,9 +59,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid pet value")]) - @RequestMapping( - value = ["/pet/{petId}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/pet/{petId}"] + ) fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String? ): ResponseEntity { @@ -84,10 +77,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) - @RequestMapping( + @GetMapping( value = ["/pet/findByStatus"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List ): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) @@ -102,10 +95,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) - @RequestMapping( + @GetMapping( value = ["/pet/findByTags"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List ): ResponseEntity> { return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) @@ -119,10 +112,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) - @RequestMapping( + @GetMapping( value = ["/pet/{petId}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long ): ResponseEntity { return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200)) @@ -135,10 +128,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) - @RequestMapping( + @PutMapping( value = ["/pet"], - consumes = ["application/json", "application/xml"], - method = [RequestMethod.PUT]) + consumes = ["application/json", "application/xml"] + ) fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet ): ResponseEntity { return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400)) @@ -151,10 +144,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 405, message = "Invalid input")]) - @RequestMapping( + @PostMapping( value = ["/pet/{petId}"], - consumes = ["application/x-www-form-urlencoded"], - method = [RequestMethod.POST]) + consumes = ["application/x-www-form-urlencoded"] + ) fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String? ,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String? @@ -170,11 +163,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) - @RequestMapping( + @PostMapping( value = ["/pet/{petId}/uploadImage"], - produces = ["application/json"], - consumes = ["multipart/form-data"], - method = [RequestMethod.POST]) + produces = ["application/json"], + consumes = ["multipart/form-data"] + ) fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long ,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt index 71017e33a506..3b82141c4df5 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -12,14 +12,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -38,7 +31,7 @@ import kotlin.collections.Map @RestController @Validated -@Api(value = "Store", description = "The Store API") +@Api(value = "store", description = "The store API") @RequestMapping("\${api.base-path:/v2}") class StoreApiController(@Autowired(required = true) val service: StoreApiService) { @@ -48,9 +41,9 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @RequestMapping( - value = ["/store/order/{orderId}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/store/order/{orderId}"] + ) fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String ): ResponseEntity { return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400)) @@ -65,10 +58,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic authorizations = [Authorization(value = "api_key")]) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) - @RequestMapping( + @GetMapping( value = ["/store/inventory"], - produces = ["application/json"], - method = [RequestMethod.GET]) + produces = ["application/json"] + ) fun getInventory(): ResponseEntity> { return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200)) } @@ -80,10 +73,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) - @RequestMapping( + @GetMapping( value = ["/store/order/{orderId}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long ): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) @@ -96,10 +89,10 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic response = Order::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) - @RequestMapping( + @PostMapping( value = ["/store/order"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.POST]) + produces = ["application/xml", "application/json"] + ) fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order ): ResponseEntity { return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200)) diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt index 1dbc304d88e4..7071afde110f 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -12,14 +12,7 @@ import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.RequestBody -import org.springframework.web.bind.annotation.RequestPart -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.PathVariable -import org.springframework.web.bind.annotation.RequestHeader -import org.springframework.web.bind.annotation.RequestMethod -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RestController +import org.springframework.web.bind.annotation.* import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -38,7 +31,7 @@ import kotlin.collections.Map @RestController @Validated -@Api(value = "User", description = "The User API") +@Api(value = "user", description = "The user API") @RequestMapping("\${api.base-path:/v2}") class UserApiController(@Autowired(required = true) val service: UserApiService) { @@ -48,9 +41,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "This can only be done by the logged in user.") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - value = ["/user"], - method = [RequestMethod.POST]) + @PostMapping( + value = ["/user"] + ) fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User ): ResponseEntity { return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200)) @@ -62,9 +55,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - value = ["/user/createWithArray"], - method = [RequestMethod.POST]) + @PostMapping( + value = ["/user/createWithArray"] + ) fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List ): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200)) @@ -76,9 +69,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - value = ["/user/createWithList"], - method = [RequestMethod.POST]) + @PostMapping( + value = ["/user/createWithList"] + ) fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List ): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200)) @@ -90,9 +83,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "This can only be done by the logged in user.") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( - value = ["/user/{username}"], - method = [RequestMethod.DELETE]) + @DeleteMapping( + value = ["/user/{username}"] + ) fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400)) @@ -105,10 +98,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = User::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( + @GetMapping( value = ["/user/{username}"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200)) @@ -121,10 +114,10 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) response = kotlin.String::class) @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) - @RequestMapping( + @GetMapping( value = ["/user/login"], - produces = ["application/xml", "application/json"], - method = [RequestMethod.GET]) + produces = ["application/xml", "application/json"] + ) fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String ,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String ): ResponseEntity { @@ -137,9 +130,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "") @ApiResponses( value = [ApiResponse(code = 200, message = "successful operation")]) - @RequestMapping( - value = ["/user/logout"], - method = [RequestMethod.GET]) + @GetMapping( + value = ["/user/logout"] + ) fun logoutUser(): ResponseEntity { return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200)) } @@ -150,9 +143,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) notes = "This can only be done by the logged in user.") @ApiResponses( value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) - @RequestMapping( - value = ["/user/{username}"], - method = [RequestMethod.PUT]) + @PutMapping( + value = ["/user/{username}"] + ) fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String ,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User ): ResponseEntity { diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt index 4b26b45aa17c..106585ec1500 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 20f2e157d476..9916aaf62e38 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt index 39a980deede1..2cfdd429793a 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt @@ -10,6 +10,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -39,7 +40,7 @@ data class Order( @field:JsonProperty("status") var status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @field:JsonProperty("complete") var complete: kotlin.Boolean? = null + @field:JsonProperty("complete") var complete: kotlin.Boolean? = false ) { /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt index 974d6647ac38..88d1eb64f41b 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt @@ -12,6 +12,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** @@ -25,20 +26,20 @@ import io.swagger.annotations.ApiModelProperty */ data class Pet( - @get:NotNull @ApiModelProperty(example = "doggie", required = true, value = "") - @field:JsonProperty("name") var name: kotlin.String, + @field:JsonProperty("name", required = true) var name: kotlin.String, - @get:NotNull @ApiModelProperty(example = "null", required = true, value = "") - @field:JsonProperty("photoUrls") var photoUrls: kotlin.collections.List, + @field:JsonProperty("photoUrls", required = true) var photoUrls: kotlin.collections.List, @ApiModelProperty(example = "null", value = "") @field:JsonProperty("id") var id: kotlin.Long? = null, + @field:Valid @ApiModelProperty(example = "null", value = "") @field:JsonProperty("category") var category: Category? = null, + @field:Valid @ApiModelProperty(example = "null", value = "") @field:JsonProperty("tags") var tags: kotlin.collections.List? = null, diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt index 817a4af7e41b..77fc054dc915 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt index 8995281f28dc..58ba8f5177b8 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt @@ -9,6 +9,7 @@ import javax.validation.constraints.Min import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size +import javax.validation.Valid import io.swagger.annotations.ApiModelProperty /** diff --git a/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION b/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION index d99e7162d01f..3fa3b389a57d 100644 --- a/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION +++ b/samples/server/petstore/kotlin/vertx/.openapi-generator/VERSION @@ -1 +1 @@ -5.0.0-SNAPSHOT \ No newline at end of file +5.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt index 2d806e9e2fc0..f3dfdd42e316 100644 --- a/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt +++ b/samples/server/petstore/kotlin/vertx/src/main/kotlin/org/openapitools/server/api/model/Order.kt @@ -31,7 +31,7 @@ data class Order ( var id: kotlin.Long? = null, var petId: kotlin.Long? = null, var quantity: kotlin.Int? = null, - var shipDate: java.time.LocalDateTime? = null, + var shipDate: java.time.OffsetDateTime? = null, /* Order Status */ var status: Order.Status? = null, var complete: kotlin.Boolean? = null diff --git a/website/src/dynamic/users.yml b/website/src/dynamic/users.yml index ee96702c9c9f..c8c0cc81f455 100644 --- a/website/src/dynamic/users.yml +++ b/website/src/dynamic/users.yml @@ -425,7 +425,7 @@ pinned: false - caption: "viadee" - image: "img/companies/viadee.png" + image: "img/companies/viadee.jpg" infoLink: "https://www.viadee.de" pinned: false -